Les pubs vous déplaisent ? Aller Sans pub Auj.

Playfair Cipher Encoder & Decoder

PromoteurSécuritéTexte
ANNONCE · Supprimer ?
Alphabetic characters only. Duplicates are removed when building the 5x5 grid.
Playfair uses a 5x5 grid which only fits 25 letters — pick which letter is folded or dropped.
Used to separate doubled letters and pad an odd-length plaintext.

5x5 Playfair Square

Step-by-Step Digraph Breakdown

How the Playfair Cipher Works

L'Algorithme : Playfair is a digraph substitution cipher. The keyword is laid out into a 5x5 matrix (without duplicates), followed by the remaining alphabet. Because the grid only holds 25 letters, one letter is folded into another — traditionally I et J share a cell, though some variants omit Q plutôt.

Preparing the plaintext: Strip non-alphabetic characters, then split into pairs. If a pair contains two identical letters (e.g. LL), insert a filler letter (typically X) between them. If the final pair has only one letter, append a filler.

Encoding each digraph:

Same row: replace each letter with the one immediately to its right (wrap around).
Same column: replace each letter with the one immediately below it (wrap around).
Rectangle: replace each letter with the one in the same row but in the other letter's column.

Décoder is the inverse: shift left for same-row pairs, shift up for same-column pairs; rectangle pairs use the same column-swap rule.

Histoire: Invented by Charles Wheatstone in 1854 and championed by Lord Playfair, the cipher was used by British forces in the Boer War and World War I. It was the first practical literal digraph substitution cipher and resisted casual cryptanalysis far better than monoalphabetic ciphers because letter frequencies of digraphs are flatter than single-letter frequencies.

Breaking the cipher: Playfair is vulnerable to digraph frequency analysis on long ciphertexts. Common English digraphs like TH, HEet IN map consistently to the same ciphertext pairs, which can reveal the matrix structure.

ANNONCE · Supprimer ?

Guide

Playfair Cipher Encoder & Decoder

Playfair Cipher Encoder & Decoder

Encrypt or decrypt text with the classic Playfair cipher entirely in your browser. Enter a keyword, paste your plaintext or ciphertext, and watch the tool build the 5×5 keyed matrix, prepare the digraphs, and walk through every substitution step. No data ever leaves your device.

Comment utiliser

  1. Choisir un mode : Encoder to turn plaintext into ciphertext, or Décoder to recover the original message.
  2. Type or paste your text into the input box. Punctuation, digits and spaces are ignored.
  3. Enter a keyword (any alphabetic word or phrase). Duplicates are stripped when the 5×5 matrix is built.
  4. Choose a matrix variant: I/J share a cell (the original 1854 form) or Omit Q (J kept separate).
  5. Optionally change the filler letter used to split doubled pairs and pad odd-length plaintexts.
  6. Read the result, inspect the keyed matrix, and review the digraph-by-digraph breakdown below.

Caractéristiques

  • Visual 5×5 keyed matrix – Keyword letters are highlighted so you can see how the grid is built.
  • Both classic variants – Choose I/J fold or Omit-Q to match whichever historical Playfair flavor you need.
  • Automatic digraph preparation – Doubled letters get a filler split, odd-length input gets padded, and inserted filler characters are highlighted.
  • Step-by-step substitution table – Each digraph is shown with the rule applied (same row, same column, or rectangle) and the output pair.
  • Configurable filler letter – Pick X, Q, or Z depending on what fits your plaintext best.
  • Encode and decode in one tool – Round-trip your messages without switching pages.
  • Entirely client-side – Encryption runs in pure JavaScript, so your messages and keywords never touch our servers.

FAQ

  1. Why does the Playfair cipher use a 5x5 grid instead of 6x5 or 5x6?

    A 5x5 grid holds exactly 25 letters, one short of the English alphabet. The original cipher squeezed the alphabet to 25 by folding I and J into a single cell. A 5x5 layout also keeps the row, column, and rectangle rules symmetric and easy to apply by hand — a 6x5 or 5x6 grid would force the rules to handle differing wrap-around sizes per axis, which would be impractical for the pencil-and-paper use the cipher was designed for.

  2. Why does Playfair encrypt pairs of letters instead of single letters?

    Encrypting digraphs flattens letter-frequency statistics. In English the letter E appears about 12.7% of the time, but the digraph TH appears only around 2.7%. Because Playfair maps each plaintext digraph to a unique ciphertext digraph, single-letter frequency analysis fails. This is what made Playfair dramatically harder to break than monoalphabetic ciphers like Caesar.

  3. What is the difference between the I/J variant and the Omit-Q variant?

    Both variants squeeze 26 letters into 25 cells. The I/J variant treats I and J as the same letter — any J in the plaintext is replaced with I before encoding. The Omit-Q variant drops Q entirely from the matrix; texts containing Q must be rewritten before encoding (often as KW or simply omitted). I/J is the historically correct form used by British forces; Omit-Q is sometimes preferred for texts where I and J carry independent meaning, such as legal documents.

  4. Why does decoding produce extra X letters in the plaintext?

    Playfair cannot encrypt a digraph made of two identical letters because the encoding rules require the pair to be in different positions on the grid. The encoder splits such pairs by inserting a filler letter (commonly X). The decoder is rule-based and has no way to know which X letters were original and which were inserted, so the recovered plaintext contains the filler. Removing fillers is a manual post-processing step left to the reader.

  5. Is the Playfair cipher still secure today?

    No. Playfair was considered field-secure for short tactical messages in the 19th and early 20th centuries, but modern cryptanalysis breaks it easily. Digraph frequency analysis on a few hundred letters of ciphertext usually reveals enough of the matrix to recover the rest with hill-climbing or simulated annealing. Treat Playfair as an educational tool, a puzzle device, or a historical exercise — not a real-world encryption scheme.

Envie d'une expérience sans pub ? Passez à la version sans pub

Installez nos extensions

Ajoutez des outils IO à votre navigateur préféré pour un accès instantané et une recherche plus rapide

Sur Extension Chrome Sur Extension de bord Sur Extension Firefox Sur Extension de l'opéra

Le Tableau de Bord Est Arrivé !

Tableau de Bord est une façon amusante de suivre vos jeux, toutes les données sont stockées dans votre navigateur. D'autres fonctionnalités arrivent bientôt !

ANNONCE · Supprimer ?
ANNONCE · Supprimer ?
ANNONCE · Supprimer ?

Coin des nouvelles avec points forts techniques

Impliquez-vous

Aidez-nous à continuer à fournir des outils gratuits et précieux

Offre-moi un café
ANNONCE · Supprimer ?