Home > College Algebra > Ciphers > Playfair Cipher (encoder / decoder) example

23. Playfair Cipher example (encoder / decoder) ( Enter your problem )
  1. Examples
Other related methods
  1. A1Z26 Cipher (Letter to number Cipher)
  2. ADFGVX Cipher
  3. ADFGX Cipher
  4. Affine Cipher
  5. Alberti Cipher
  6. Atbash Cipher
  7. Autokey Cipher / Autoclave Cipher
  8. Bacon Cipher
  9. Beaufort Cipher
  10. Bifid Cipher
  11. Caesar Cipher
  12. Chaocipher
  13. Columnar transposition Cipher
  14. Double Transposition Cipher
  15. Enigma machine Cipher
  16. Four Square Cipher
  17. Gronsfeld Cipher
  18. Hill Cipher
  19. Kamasutra Cipher | Vatsyayana Cipher
  20. Morse Code Translator
  21. Multiplicative Cipher | Decimation Cipher
  22. Nihilist Cipher
  23. Playfair Cipher
  24. Polybius Square Cipher
  25. Porta Cipher
  26. Rail fence Cipher
  27. ROT-5 Cipher
  28. ROT-13 Cipher
  29. ROT-18 Cipher
  30. ROT-47 Cipher
  31. ROT-N Cipher
  32. Running Key Cipher
  33. Substitution Cipher
  34. Tap code Cipher | Knock code Cipher
  35. Three Square Cipher
  36. Trifid Cipher
  37. Trithemius Cipher
  38. Two-square Cipher
  39. Vigenere Cipher

22. Nihilist Cipher
(Previous method)
24. Polybius Square Cipher
(Next method)

1. Examples





1. Playfair Cipher encoder

Text : ABCD efghi
Alphabet25 : abcdefghiklmnopqrstuvwxyz
Padding Character : x


Solution:
The Playfair cipher is a digraph substitution cipher, that encrypts pairs of letters (digraphs) instead of a single alphabet

Alphabet = abcdefghiklmnopqrstuvwxyz

12345
1abcde
2fghik
3lmnop
4qrstu
5vwxyz

Plaintext = abcdefghi
Split into pairs of letters (digraphs)
Pairs : ab cd ef gh i

Pad at end, if necessary
If one letter is left at the end, then pad to make it pair
Pairs : ab cd ef gh ix

Encryption :
ab = a(1,1), b(1,2) `=>` b(1,2), c(1,3) = bc, Letters on the same row (Replace each letter with the one to its right)

cd = c(1,3), d(1,4) `=>` d(1,4), e(1,5) = de, Letters on the same row (Replace each letter with the one to its right)

ef = e(1,5), f(2,1) `=>` a(1,1), k(2,5) = ak, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

gh = g(2,2), h(2,3) `=>` h(2,3), i(2,4) = hi, Letters on the same row (Replace each letter with the one to its right)

ix = i(2,4), x(5,3) `=>` h(2,3), y(5,4) = hy, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

Plaintext : abcdefghix
Ciphertext : bcdeakhihy

2. Playfair Cipher encoder

Text : hello world
Alphabet25 : abcdefghiklmnopqrstuvwxyz
Padding Character : x


Solution:
The Playfair cipher is a digraph substitution cipher, that encrypts pairs of letters (digraphs) instead of a single alphabet

Alphabet = abcdefghiklmnopqrstuvwxyz

12345
1abcde
2fghik
3lmnop
4qrstu
5vwxyz

Plaintext = helloworld
Split into pairs of letters (digraphs)
Pairs : he ll ow or ld

Pad duplicate-letters
If a pair has same letters, insert a padding letter between them, to avoid revealing doubled letters in the ciphertext
Pairs : he lx lo wo rl d

Pad at end, if necessary
If one letter is left at the end, then pad to make it pair
Pairs : he lx lo wo rl dx

Encryption :
he = h(2,3), e(1,5) `=>` k(2,5), c(1,3) = kc, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

lx = l(3,1), x(5,3) `=>` n(3,3), v(5,1) = nv, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

lo = l(3,1), o(3,4) `=>` m(3,2), p(3,5) = mp, Letters on the same row (Replace each letter with the one to its right)

wo = w(5,2), o(3,4) `=>` y(5,4), m(3,2) = ym, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

rl = r(4,2), l(3,1) `=>` q(4,1), m(3,2) = qm, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

dx = d(1,4), x(5,3) `=>` c(1,3), y(5,4) = cy, Rectangle rule (Replace each letter with the one in its row, but in the other letter's column)

Plaintext : helxloworldx
Ciphertext : kcnvmpymqmcy





This material is intended as a summary. Use your textbook for detail explanation.
Any bug, improvement, feedback then Submit Here



22. Nihilist Cipher
(Previous method)
24. Polybius Square Cipher
(Next method)





Share this solution or page with your friends.
 
 
Copyright © 2026. All rights reserved. Terms, Privacy
 
 

.