Playfair Cipher — Digraph Substitution
Encrypt and decrypt text using the Playfair cipher. Enter a keyword to build a 5×5 key matrix and encode pairs of letters. Visualizes the key matrix.
—
5×5 Key Matrix
K
E
Y
W
O
R
D
A
B
C
F
G
H
I
L
M
N
P
Q
S
T
U
V
X
Z
J is merged with I in the Playfair cipher
How to Use the Playfair Cipher — Digraph Substitution
- Enter or paste your text in the input field.
- The encoded or decoded result appears automatically.
- Copy the output using the copy button.
- Switch between encode and decode modes if available.
Referencia Rápida
| De | A |
|---|---|
| A | 65 (ASCII) |
| Z | 90 (ASCII) |
| a | 97 (ASCII) |
| 0 | 48 (ASCII) |
| Space | 32 (ASCII) |
| @ | 64 (ASCII) |
Casos de Uso
- •Encoding or decoding data for web development projects.
- •Learning about cryptography and different cipher techniques.
- •Preparing encoded content for APIs or data transmission.
- •Solving cipher puzzles, CTF challenges, or educational exercises.
Fórmula
The Playfair cipher encrypts pairs of letters (digraphs) using a 5×5 matrix built from a keyword. J is treated as I. Same-row letters shift right; same-column letters shift down; others swap columns within their rows.
Preguntas Frecuentes
What is the Playfair cipher?
Playfair is a digraph substitution cipher that encrypts two letters at a time using a 5×5 key matrix. It was invented by Charles Wheatstone in 1854 and popularized by Lord Playfair. It was the first practical digraph cipher.
Why is J merged with I?
The standard Latin alphabet has 26 letters, which does not fit evenly into a 5×5 matrix (25 cells). Traditionally I and J are combined into a single cell, reducing the alphabet to 25 letters.
How is the key matrix built?
Start with the keyword (removing duplicate letters), then append the remaining unused letters of the alphabet in order. The result fills a 5×5 grid left to right, top to bottom.
What are the Playfair encryption rules?
1) Split plaintext into digraphs; insert X between repeated letters in a pair. 2) Same row: shift each letter one position right (wrapping). 3) Same column: shift down. 4) Different row and column (rectangle): swap each letter to the column of its partner.
Is Playfair secure today?
No. Playfair was significantly stronger than simple mono-alphabetic ciphers, but it is still easily broken with frequency analysis of digraphs. It is used for educational purposes.