■■■■■■■■■■
■ ■
■ LOCK ■
■■■■■■■■■■
■■■■
■■■■
THE COMPLETE
CIPHER
CODEBOOK
All Major Cipher Types · How to Read & Write Them · Live Examples
From ancient substitution ciphers to modern encoding — your complete guide
to secret communication.
Secret Messaging · Cryptography · Codes & Ciphers
TABLE OF CONTENTS
1. Caesar Cipher — Shift every letter by a fixed number
2. ROT13 Cipher — The famous 13-shift rotation
3. Atbash Cipher — Mirror alphabet substitution
4. Vigenère Cipher — Keyword-based polyalphabetic cipher
5. Morse Code — Dots and dashes for each letter
6. Pigpen Cipher — Geometric symbol substitution
7. Rail Fence (Zigzag) — Transposition over multiple rails
8. Columnar Transposition — Rearranging columns with a key
9. Binary / ASCII Code — Encoding text as 0s and 1s
10. Base64 Encoding — The web's favourite encoding scheme
11. Playfair Cipher — Digraph-based substitution
12. Book / Bible Cipher — Using a shared text as the key
13. One-Time Pad (OTP) — The unbreakable cipher
14. Null Cipher (Steganography) — Hiding messages inside plain text
15. Quick Reference & Cheat Sheet — All alphabets & tables at a glance
The Complete Cipher Codebook Page 2
1. Caesar Cipher
◆ Substitution Cipher | Difficulty: Easy
The Caesar Cipher is one of the oldest and simplest encryption techniques, named after Julius Caesar
who used it to protect military communications. It works by shifting every letter in your message by a
fixed number of positions in the alphabet. The most common shift is 3, but any number 1–25 works as
your secret key.
ALPHABET / KEY TABLE
Plain A B C D E F G H I J K L M
Shift-3 D E F G H I J K L M N O P
Plain N O P Q R S T U V W X Y Z
Shift-3 Q R S T U V W X Y Z A B C
HOW TO ENCODE (Write a Secret Message)
• Agree on a shift number (key) with your partner — e.g. shift = 3.
• For each letter in your message, count forward by the shift in the alphabet.
• A → D, B → E, Z wraps around → C. Numbers and spaces stay the same.
• Write down the resulting letters — that is your ciphertext.
HOW TO DECODE (Read a Secret Message)
• Know the shift number used.
• For each letter in the ciphertext, count backward by the shift.
• D → A, E → B, etc. Reconstruct the original message.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : HELLO WORLD
Ciphertext : KHOOR ZRUOG
H+3=K E+3=H L+3=O L+3=O O+3=R | W+3=Z O+3=R R+3=U L+3=O D+3=G
■ ROT13 is just a Caesar Cipher with shift 13 — a special case.
■ To crack an unknown Caesar cipher, try all 25 shifts (brute force).
■ Negative shifts work too — shift -3 = shift 23.
The Complete Cipher Codebook Page 3
2. ROT13 Cipher
◆ Special Caesar (Shift-13) | Difficulty: Easy
ROT13 — 'Rotate by 13' — is a Caesar cipher with a shift of exactly 13. Because the alphabet has 26
letters, applying ROT13 twice returns the original text. Encoding and decoding use the exact same
operation. It is widely used on the internet to hide spoilers, puzzle answers, or mild profanity.
ALPHABET / KEY TABLE
Plain A B C D E F G H I J K L M
ROT13 N O P Q R S T U V W X Y Z
Plain N O P Q R S T U V W X Y Z
ROT13 A B C D E F G H I J K L M
HOW TO ENCODE (Write a Secret Message)
• Replace A↔N, B↔O, C↔P … M↔Z (each letter swaps with its 'opposite').
• Apply the same rule again to decode — no separate process needed.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : MEET ME AT MIDNIGHT
Ciphertext : ZRRG ZR NG ZVQAVTUG
■ ROT13 is NOT secure — it's purely for obfuscation, not secrecy.
■ Run the same function twice to get back the original text.
The Complete Cipher Codebook Page 4
3. Atbash Cipher
◆ Mirror Substitution | Difficulty: Easy
The Atbash cipher originates from ancient Hebrew and is one of the simplest substitution ciphers. It maps
each letter to its mirror opposite: A becomes Z, B becomes Y, C becomes X, and so on. Like ROT13,
encoding and decoding are identical operations.
ALPHABET / KEY TABLE
Plain A B C D E F G H I J K L M
Atbash Z Y X W V U T S R Q P O N
Plain N O P Q R S T U V W X Y Z
Atbash M L K J I H G F E D C B A
HOW TO ENCODE (Write a Secret Message)
• For each letter, find its position from the start of the alphabet (A=1, B=2 … Z=26).
• Replace it with the letter at position (27 − position): A(1)→Z(26), B(2)→Y(25), etc.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : SECRET MESSAGE
Ciphertext : HVXIVG NVHHZTV
■ Originally used in the Hebrew Bible to encode 'Babel' as 'Sheshach'.
■ Self-reciprocal: apply it twice to recover the original.
The Complete Cipher Codebook Page 5
4. Vigenère Cipher
◆ Polyalphabetic Substitution | Difficulty: Medium
The Vigenère cipher uses a keyword to apply a different Caesar shift to each letter of the message.
Because the shift changes with every letter, simple frequency analysis cannot crack it — earning it the
nickname 'le chiffre indéchiffrable' (the indecipherable cipher) for centuries.
VIGENÈRE TABLE (partial — first 8 rows/columns)
Key\Plain A B C D E F G H
A A B C D E F G H
B B C D E F G H I
C C D E F G H I J
D D E F G H I J K
E E F G H I J K L
F F G H I J K L M
G G H I J K L M N
H H I J K L M N O
HOW TO ENCODE
• Choose a keyword, e.g. KEY.
• Write the keyword repeatedly above your message: K E Y K E Y K E Y …
• For each letter pair, add their alphabet positions (A=0 … Z=25), mod 26.
• M(12)+K(10)=22=W, E(4)+E(4)=8=I, E(4)+Y(24)=28 mod 26=2=C → WIC…
HOW TO DECODE
• Know the keyword.
• For each letter, subtract the key letter's value (mod 26) to recover the original.
↓ LIVE EXAMPLE ↓
Plaintext : MEET ME TONIGHT
Keyword : KEY KEY KEYKEYKE
Ciphertext : WICB WI XSCSMKB
M+K=W E+E=I E+Y=C T+K=D | M+E=Q E+Y=C (etc.)
■ The longer and more random your keyword, the stronger the cipher.
The Complete Cipher Codebook Page 6
5. Morse Code
◆ Encoding System | Difficulty: Easy–Medium
Morse Code represents letters and numbers as sequences of dots (·) and dashes (−). Invented by
Samuel Morse in the 1830s for telegraph transmission, it remains one of the most recognisable codes. It
can be transmitted as sound, light flashes, or written symbols.
CHAR CODE CHAR CODE CHAR CODE
0 ----- 1 .---- 2 ..---
3 ...-- 4 ....- 5 .....
6 -.... 7 --... 8 ---..
9 ----. A .- B -...
C -.-. D -.. E .
F ..-. G --. H ....
I .. J .--- K -.-
L .-.. M -- N -.
O --- P .--. Q --.-
R .-. S ... T -
U ..- V ...- W .--
X -..- Y -.-- Z --..
↓ EXAMPLE ↓
Plaintext : HELLO
Morse : .... . .-.. .-.. ---
Rules:
· = dot (short) | - = dash (long)
Space between letters | / between words
■ SOS in Morse: · · · − − − · · · — the universal distress signal.
The Complete Cipher Codebook Page 7
6. Pigpen Cipher
◆ Geometric Symbol Substitution | Difficulty: Easy
The Pigpen (or Freemason) cipher replaces letters with geometric fragments derived from two grids and
two X shapes. Each letter maps to the shape of the cell or angle that surrounds it. It was used by
Freemasons in the 18th century.
HOW TO ENCODE (Write a Secret Message)
• Draw two 3×3 grids (like tic-tac-toe): fill A-I in the first, J-R in the second (with a dot).
• Draw two X shapes: fill S-V in the first X, W-Z in the second X (with a dot).
• For each letter, write the shape (lines/angle) surrounding its position.
• A = corner ■ (top-left of grid 1), E = cross + (centre), etc.
HOW TO DECODE (Read a Secret Message)
• Recognise which grid/X the shape comes from.
• Count the position of the letter within that section.
• The dot on the shape means it's from the second grid/X.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : SECRET
Ciphertext : [■][■][■][■][■][■] ← (symbolic representation)
■ Draw the two grids on paper — once you memorise the shapes, encoding is fast.
■ There is no mathematical formula; it's purely visual memory.
PIGPEN KEY
Grid 1 (no dot): A B C / D E F / G H I
Grid 2 (dot): J K L / M N O / P Q R
X 1 (no dot): S(TL) T(TR) U(BL) V(BR)
X 2 (dot): W(TL) X(TR) Y(BL) Z(BR)
TL=top-left arm TR=top-right BL=bottom-left BR=bottom-right
The Complete Cipher Codebook Page 8
7. Rail Fence (Zigzag) Cipher
◆ Transposition Cipher | Difficulty: Medium
The Rail Fence cipher rearranges — rather than substitutes — the letters of your message. You write the
text in a zigzag pattern across a number of 'rails' (rows), then read off each rail left-to-right to form the
ciphertext. Only the order of letters changes, not the letters themselves.
HOW TO ENCODE (Write a Secret Message)
• Choose the number of rails (e.g. 2 or 3).
• Write your message diagonally downward then upward across the rails, like a zigzag.
• Read each rail from left to right, one after another — this is the ciphertext.
HOW TO DECODE (Read a Secret Message)
• Know the number of rails.
• Calculate how many characters fall on each rail.
• Fill each rail with the correct number of characters from the ciphertext, then read diagonally.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : WE ARE DISCOVERED
Ciphertext : WAEICVRD ERDSOEE (2 rails)
W . A . E . I . C . V . R . D
. E . R . D . S . O . E . E .
Ciphertext: WAEICRDE ERDSOEE = WAEICVRDERDSOEE
■ 3 rails are more secure than 2.
■ The key is simply the number of rails.
The Complete Cipher Codebook Page 9
8. Columnar Transposition Cipher
◆ Transposition Cipher | Difficulty: Medium
In Columnar Transposition, you write your message into a grid row-by-row, then read the columns in the
order given by a keyword. The keyword's alphabetical order determines which column to read first,
second, etc.
HOW TO ENCODE (Write a Secret Message)
• Choose a keyword, e.g. ZEBRAS (length = number of columns).
• Number the keyword letters alphabetically: Z=6, E=2, B=1, R=4, A=1→A=1,B=2 … (sort to get order).
• Write the message row-by-row under the numbered keyword.
• Read down each column in the sorted order (1, 2, 3 …) to get the ciphertext.
HOW TO DECODE (Read a Secret Message)
• Know the keyword and message length.
• Calculate rows, then fill each column in sorted key order.
• Read the grid row-by-row to recover the plaintext.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : ATTACK AT DAWN
Ciphertext : Keyword SAFE → sorted S(3)A(1)F(2)E(4) → read col A,F,S,E
S A F E Col order: A(1) F(2) S(3) E(4)
A T T A
C K A T
D A W N
Ciphertext: TKA TAW ACD ATN = TKATAWACDAT N
■ Combine with substitution ciphers for double security.
■ A long, random keyword is harder to guess.
The Complete Cipher Codebook Page 10
9. Binary / ASCII Code
◆ Digital Encoding | Difficulty: Medium
Every character on a computer has a numeric ASCII code (0–127) which can be written in binary
(base-2). It's not designed for secrecy — but knowing it lets you decode any raw binary message and is
the foundation of all digital communication.
Char Decimal Binary (8-bit)
A 65 01000001
B 66 01000010
C 67 01000011
H 72 01001000
E 69 01000101
L 76 01001100
O 79 01001111
a 97 01100001
z 122 01111010
0 48 00110000
32 00100000
! 33 00100001
EXAMPLE
Plaintext : HI
ASCII dec : 72 73
Binary : 01001000 01001001
To decode: split into 8-bit chunks → convert each to decimal → look up ASCII table
■ Use an online ASCII table or a simple Python script: chr(72) → 'H'
The Complete Cipher Codebook Page 11
10. Base64 Encoding
◆ Digital Encoding | Difficulty: Medium
Base64 encodes binary data (or text) using only 64 safe printable characters: A–Z, a–z, 0–9, + and /, with
= for padding. It is not encryption — anyone who knows it's Base64 can decode it instantly. However, it's
excellent for disguising messages as innocuous-looking data strings or embedding them in emails and
URLs.
HOW TO ENCODE (Write a Secret Message)
• Convert each character to its 8-bit binary ASCII value.
• Concatenate all the bits into one long bit string.
• Split into 6-bit groups. Each 6-bit group (0–63) maps to a Base64 character.
• Pad with = characters if the bit count isn't divisible by 6.
HOW TO DECODE (Read a Secret Message)
• Replace each Base64 character with its 6-bit binary value.
• Concatenate and split into 8-bit groups.
• Convert each 8-bit value to its ASCII character.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : Hello
Ciphertext : SGVsbG8=
H=01001000 e=01100101 l=01101100 l=01101100 o=01101111
→ 010010000110010101101100011011000110111
→ 6-bit: 010010 000110 010101 101100 011011 000110 1111(00)
→ S G V s b G 8 + padding =
■ Use: echo -n 'Hello' | base64 in Terminal to encode instantly.
■ Or in Python: import base64; base64.b64encode(b'Hello')
The Complete Cipher Codebook Page 12
11. Playfair Cipher
◆ Digraph Substitution | Difficulty: Hard
The Playfair cipher encrypts pairs of letters (digraphs) using a 5×5 grid built from a keyword. Because it
encrypts two letters at once, simple frequency analysis doesn't work. It was used by the British military in
WWI.
HOW TO ENCODE (Write a Secret Message)
• Build a 5×5 grid: write your keyword (no repeats), then fill remaining letters A–Z (I and J share one cell).
• Split the plaintext into pairs. If a pair has identical letters, insert X between them. Pad with X if odd length.
• For each pair (R, S): if same row → shift each letter one column right; if same column → shift one row
down; otherwise → swap columns within the rectangle they form.
HOW TO DECODE (Read a Secret Message)
• Reverse the rules: same row → shift left; same column → shift up; rectangle → swap columns.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : HIDE THE GOLD
Ciphertext : Depends on keyword grid
Keyword: MONARCHY
Grid: M O N A R | C H Y B D | E F G I K | L P Q S T | U V W X Z
Pairs: HI DE TH EG OL DX
HI → same row? No. Same col? No. Rectangle swap → BM
Result varies — the grid is the key!
■ Always write out the full 5×5 grid before encoding.
■ Never forget: I and J share one cell.
The Complete Cipher Codebook Page 13
12. Book / Bible Cipher
◆ Key-Text Cipher | Difficulty: Medium
In a Book Cipher, both sender and receiver have the same copy of a book (or any agreed text). Each
word in the secret message is replaced by a set of three numbers: page number, line number, word
number. Without the exact same edition of the book, it's impossible to decode.
HOW TO ENCODE (Write a Secret Message)
• Agree on a specific book edition with your partner.
• For each word in your message, find it in the book.
• Write its location as: [Link] — e.g. 42.7.3
• Send the number sequence; it looks like random data.
HOW TO DECODE (Read a Secret Message)
• Open the agreed book to the given page.
• Count to the given line, then to the given word.
• Write it down — reconstruct the message word by word.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : MEET AT DAWN
Ciphertext : 14.2.5 88.11.3 203.4.7
■ Digital PDFs with fixed pagination work perfectly.
■ The more common the book (e.g. a dictionary), the more word choices you have.
■ Never reveal which book you're using!
The Complete Cipher Codebook Page 14
13. One-Time Pad (OTP)
◆ Information-Theoretically Secure | Difficulty: Hard
The One-Time Pad is the only mathematically unbreakable cipher in existence — proven by Claude
Shannon in 1949. It requires a truly random key that is at least as long as the message, used once only,
and shared secretly. In practice, the challenge is safely exchanging the key.
HOW TO ENCODE (Write a Secret Message)
• Generate a truly random key of the same length as your message (e.g. from dice rolls).
• Convert each letter to a number (A=0 … Z=25).
• Add each message number to the corresponding key number, mod 26.
• Convert back to letters — this is the ciphertext.
HOW TO DECODE (Read a Secret Message)
• Subtract each key number from the ciphertext number, mod 26.
• Convert back to letters.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : HELLO
Ciphertext : RIJVS
Message : H(7) E(4) L(11) L(11) O(14)
Key : K(10) D(3) X(23) F(5) G(6)
Sum mod26: 17 7 34%26=8 16 20
Cipher : R H I Q U → RHIQU
(Small example — exact result depends on key chosen)
■ NEVER reuse a key — reuse makes it completely breakable.
■ The key must be truly random, not pseudo-random.
■ The hardest part is key distribution — both parties must have the same key beforehand.
The Complete Cipher Codebook Page 15
14. Null Cipher (Steganography)
◆ Hidden-in-Plain-Sight | Difficulty: Medium
A Null Cipher hides a message inside an innocent-looking sentence or paragraph — the secret is not
that the text is scrambled, but that the reader doesn't know to look for a message. Only the agreed
'extraction rule' reveals the hidden text. This is a form of steganography (hiding existence, not just
content).
HOW TO ENCODE (Write a Secret Message)
• Agree on an extraction rule — e.g. 'take the first letter of every word' or 'take the 3rd letter of every
sentence'.
• Compose a natural-sounding cover message that produces your secret when the rule is applied.
• Send the cover message openly — it looks perfectly innocent.
HOW TO DECODE (Read a Secret Message)
• Apply the agreed extraction rule to the received message.
• E.g. for 'first letter of each word': collect those letters in order.
LIVE EXAMPLE
↓ Try it yourself ↓
Plaintext : FLEE NOW
Ciphertext : Find Lena's elephant early. Never offer wine.
Rule: First letter of each word
F-L-E-E N-O-W → FLEE NOW
Cover text reads like a normal sentence!
■ The stronger the cover text looks, the better.
■ Other rules: every Nth letter, first letter of each sentence, capitalised letters only.
■ True steganography uses images/audio — pixel values hide bits of data.
The Complete Cipher Codebook Page 16
15. Quick Reference & Cheat Sheet
CIPHER COMPARISON TABLE
Cipher Type Key Security Best For
Caesar Substitution Shift # Very Low Fun/Learning
ROT13 Substitution None (13) None Spoilers
Atbash Substitution None Very Low Simple codes
Vigenère Poly-Subst. Keyword Low–Med Intermediate
Morse Encoding None None (public) Transmission
Pigpen Symbol Subst. Grid Low Visual codes
Rail Fence Transposition # of rails Low Rearranging
Columnar Transposition Keyword Medium Rearranging
Binary/ASCII Encoding None None Digital
Base64 Encoding None None Disguising
Playfair Digraph Subst. Keyword Medium Historical
Book Cipher Key-Text Book edition High Shared-book
One-Time Pad XOR/Add Random key Unbreakable True secrecy
Null Cipher Steganography Extraction rule High Hide existence
FULL ALPHABET REFERENCE (A–Z positions)
A B C D E F G H I J K L M
1 2 3 4 5 6 7 8 9 10 11 12 13
N O P Q R S T U V W X Y Z
14 15 16 17 18 19 20 21 22 23 24 25 26
GOLDEN RULES OF SECRET MESSAGING
1. Agree on the cipher type AND the key with your partner before sending.
2. Never reuse a one-time pad key — ever.
3. Keep the key secret; even the best cipher is broken if the key is known.
4. Test-decode your own message before sending it.
5. The longer and more random your key, the harder it is to crack.
6. Combine ciphers (e.g. Caesar then Rail Fence) for extra security.
7. A null cipher hides that a message exists — pair with another cipher for double protection.
The Complete Cipher Codebook Page 17
Happy ciphering! ■ — Keep your secrets safe.
The Complete Cipher Codebook Page 18