OhMyCalc

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

  1. Enter or paste your text in the input field.
  2. The encoded or decoded result appears automatically.
  3. Copy the output using the copy button.
  4. Switch between encode and decode modes if available.

Référence rapide

DeVers
A65 (ASCII)
Z90 (ASCII)
a97 (ASCII)
048 (ASCII)
Space32 (ASCII)
@64 (ASCII)

Cas d'utilisation

Formule

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.

Questions fréquemment posées

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.