Advertisement

Coding & Decoding: Guide

Translating messages using coding rules and substitution patterns

Learn

Substitution Codes

Direct letter-to-symbol or letter-to-number mappings

  1. Letter-to-Number Codes
  2. Number-to-Letter Codes
  3. Symbol Substitution
  4. Polybius Square

Alphabet Transformations

Shifting and transforming the alphabet

  1. Atbash Cipher
  2. Caesar Cipher
  3. Vowel-Consonant Code
  4. Keyboard Cipher

Advanced Codes

Combined and multi-step coding rules

  1. Combined Codes
  2. Variable Shift Cipher
  3. Binary Encoding
  4. Phone Keypad (Multi-tap) Encoding
  5. Rail Fence Cipher
  6. ROT13 Cipher
  7. Vigenère Cipher

Transposition Ciphers

Rearranging letter positions without substitution

  1. Reverse Word
  2. Skip Cipher

Learn 1

Letter-to-Number Codes

Each letter is replaced by its position in the alphabet.

Letter-to-number coding is the simplest substitution cipher. Each letter is replaced by its position in the alphabet: A=1, B=2, C=3, and so on up to Z=26. To decode, convert each number back to its corresponding letter. This is often the first code type introduced in aptitude tests.

A=1, B=2, C=3, ... Z=26

  • CAT = 3-1-20
  • HELLO = 8-5-12-12-15
  • 3-15-4-5 = CODE

How to recognize it

  • Numbers 1-26 (no numbers higher than 26)
  • Pattern follows alphabetical position
  • Often separated by hyphens or spaces

Common mistakes

  • Confusing letter positions (common: J=10, not 11)
  • Forgetting alphabet order mid-word
  • Not recognizing double-digit numbers (12 is L, not 1-2)

Step-by-step walkthrough

Encode the word 'CAT' using letter-to-number coding

  1. C is the 3rd letter of the alphabet
  2. A is the 1st letter of the alphabet
  3. T is the 20th letter of the alphabet

Answer: 3-1-20

Learn 2

Number-to-Letter Codes

Decode numbers by converting each to its corresponding letter.

Number-to-letter decoding is the reverse of letter-to-number encoding. Given a sequence of numbers, convert each to the letter at that position in the alphabet: 1=A, 2=B, 3=C, etc. The key skill is quickly recognizing position values, especially for letters later in the alphabet.

1=A, 2=B, 3=C, ... 26=Z

  • 19-21-14 = SUN
  • 2-15-15-11 = BOOK
  • 23-1-20-5-18 = WATER

How to recognize it

  • Given numbers, asked to find the word
  • Numbers are between 1 and 26
  • Decode by finding the letter at each position

Common mistakes

  • Confusing high numbers (is 20 T or U?)
  • Not recognizing common patterns (15=O, 5=E)
  • Mixing up single and double digit parsing

Step-by-step walkthrough

Decode the sequence 19-21-14

  1. 19 is the 19th letter of the alphabet = S
  2. 21 is the 21st letter of the alphabet = U
  3. 14 is the 14th letter of the alphabet = N

Answer: SUN

Learn 3

Atbash Cipher

Each letter is replaced by its mirror in the alphabet (A to Z, B to Y, etc.).

The Atbash cipher is an ancient Hebrew substitution cipher that replaces each letter with the letter at the opposite end of the alphabet. A becomes Z, B becomes Y, C becomes X, and so on. The pattern is symmetric: encoding and decoding use the same operation.

A to Z, B to Y, C to X, D to W, E to V, F to U, G to T, H to S, I to R, J to Q, K to P, L to O, M to N

  • HELLO -> SVOOL
  • CAT -> XZG
  • WIZVM -> DREAM

How to recognize it

  • Each letter maps to its 'mirror' position
  • A always becomes Z, Z always becomes A
  • Encoding and decoding are identical operations

Common mistakes

  • Confusing middle letters (L->O, M->N)
  • Not recognizing the symmetric pattern
  • Forgetting that the same operation encodes and decodes

Step-by-step walkthrough

Encode 'HELLO' using the Atbash cipher

  1. H is the 8th letter. Its mirror is the 8th from the end = S
  2. E is the 5th letter. Its mirror is the 5th from the end = V
  3. L is the 12th letter. Its mirror is the 12th from the end = O
  4. L again maps to O
  5. O is the 15th letter. Its mirror is the 15th from the end = L

Answer: SVOOL

Learn 4

Caesar Cipher

Each letter is shifted by a fixed number of positions in the alphabet.

The Caesar cipher shifts each letter by a fixed number of positions. If the shift is 3, A becomes D, B becomes E, and so on. At the end of the alphabet, it wraps around: X→A, Y→B, Z→C (with shift 3). Named after Julius Caesar who reportedly used a shift of 3 for military messages.

Shifted letter = (Original position + Shift) mod 26. With shift=3: A→D, B→E, C→F, ..., X→A, Y→B, Z→C

  • Shift 1: CAT → DBU
  • Shift 3: HELLO → KHOOR
  • Shift 5: APPLE → FUUQJ

How to recognize it

  • All letters shifted by the same amount
  • Key shows consistent pattern (A→D, B→E means shift 3)
  • Wraps around at Z back to A

Common mistakes

  • Forgetting to wrap around (Y+3 should be B, not beyond Z)
  • Shifting in the wrong direction for decoding
  • Not identifying the shift value from given examples

Step-by-step walkthrough

Encode 'HELLO' using a Caesar cipher with shift 3

  1. H is the 8th letter. Add 3: position 11 = K
  2. E is the 5th letter. Add 3: position 8 = H
  3. L is the 12th letter. Add 3: position 15 = O
  4. L again: position 15 = O
  5. O is the 15th letter. Add 3: position 18 = R

Answer: KHOOR

Learn 5

Symbol Substitution

Letters are replaced with symbols according to a given key.

Symbol substitution codes replace letters with symbols (@, #, $, %, etc.) according to a provided key. Unlike alphabetic shifts, there's no predictable pattern—you must use the key exactly as given. The key may only cover some letters, with others following a different rule.

A=@, B=#, C=$, etc. (as specified in key)

  • If A=@, B=#, C=$ then ABC = @#$
  • If X=!, Y=?, Z=* then XYZ = !?*
  • Decode #@$ using A=@, B=#, C=$ → BAC

How to recognize it

  • Message contains symbols not normally in words
  • A key is provided mapping letters to symbols
  • No predictable pattern—must use the key

Common mistakes

  • Trying to find a pattern instead of using the key
  • Confusing similar-looking symbols
  • Misreading which symbol maps to which letter

Step-by-step walkthrough

Decode '#@$' using the key: A=@, B=#, C=$

  1. Look up # in the key: B=#, so # = B
  2. Look up @ in the key: A=@, so @ = A
  3. Look up $ in the key: C=$, so $ = C

Answer: BAC

Learn 6

Combined Codes

Multiple coding rules are applied in sequence.

Combined codes apply multiple transformations in sequence. For example, first reverse the alphabet, then shift by 2. Or first convert to numbers, then apply an operation. These are more complex because you must apply each rule in the correct order. The key will usually show the final result.

Apply Rule 1 to get intermediate result, then apply Rule 2 to get final result

  • Reverse then shift 1: A→Z→A (reverse gives Z, shift gives A)
  • Shift 2 then reverse: A→C→X (shift gives C, reverse gives X)
  • Number + 5: A=1+5=6, B=2+5=7, etc.

How to recognize it

  • Key doesn't match any single simple pattern
  • May need to work backwards to identify rules
  • Look for two-step transformations in examples

Common mistakes

  • Applying rules in the wrong order
  • Trying to find a single rule when two are needed
  • Not checking your work by encoding back

Step-by-step walkthrough

Encode 'AB' using: first shift +2, then reverse alphabet

  1. Step 1: Apply shift +2 to A → C
  2. Step 2: Reverse alphabet on C → X (C is 3rd, X is 3rd from end)
  3. Step 1: Apply shift +2 to B → D
  4. Step 2: Reverse alphabet on D → W (D is 4th, W is 4th from end)

Answer: XW

Learn 7

Polybius Square

Letters are encoded as coordinate pairs from a 5x5 grid.

The Polybius square is a cipher invented by the Greek historian Polybius around 150 BCE. Letters are arranged in a 5x5 grid, and each letter is represented by its row and column numbers. Since there are 26 letters but only 25 cells, I and J share a position.

Grid: Row 1 (ABCDE), Row 2 (FGHIK), Row 3 (LMNOP), Row 4 (QRSTU), Row 5 (VWXYZ). A=11, B=12, ... I/J=24, ... Z=55

  • CAT -> 13 11 44
  • HELLO -> 23 15 31 31 34
  • DOG -> 14 34 22

How to recognize it

  • Two-digit numbers representing coordinates
  • First digit is row (1-5), second is column (1-5)
  • I and J encode to the same value (24)

Common mistakes

  • Confusing row and column order
  • Forgetting I/J share a cell
  • Not recognizing the 5x5 grid pattern

Step-by-step walkthrough

Encode 'CAT' using the Polybius square

  1. The grid: Row 1 = ABCDE, Row 2 = FGHIK, Row 3 = LMNOP, Row 4 = QRSTU, Row 5 = VWXYZ
  2. C is in Row 1, Column 3 → 13
  3. A is in Row 1, Column 1 → 11
  4. T is in Row 4, Column 4 → 44

Answer: 13 11 44

Learn 8

Variable Shift Cipher

Each letter shifts by its position number (1st +1, 2nd +2, etc.).

Unlike the Caesar cipher where all letters shift by the same amount, the variable shift cipher uses position-dependent shifting. The first letter shifts by 1, the second by 2, and so on. This makes the cipher harder to break since the same letter can encode differently based on its position.

Letter at position N shifts forward by N positions. Position 1: +1, Position 2: +2, Position 3: +3, etc.

  • CAT -> D(C+1) C(A+2) W(T+3) = DCW
  • HELLO -> I(H+1) G(E+2) O(L+3) P(L+4) T(O+5) = IGOPT

How to recognize it

  • Different shifts for each position
  • First letter always shifts by 1
  • Pattern: 1st +1, 2nd +2, 3rd +3...

Common mistakes

  • Using same shift for all letters
  • Forgetting to wrap around Z back to A
  • Miscounting positions (starting from 0 vs 1)

Step-by-step walkthrough

Encode 'CAT' with variable shift (position 1 = +1, position 2 = +2, etc.)

  1. C is at position 1. Shift by +1: C (3rd letter) + 1 = D
  2. A is at position 2. Shift by +2: A (1st letter) + 2 = C
  3. T is at position 3. Shift by +3: T (20th letter) + 3 = W

Answer: DCW

Learn 9

Vowel-Consonant Code

Vowels and consonants follow different shift rules.

This cipher applies different transformation rules to vowels (A, E, I, O, U) versus consonants. Typically, vowels shift by one amount while consonants shift by another. This creates two parallel encoding systems within the same cipher.

Vowels (A,E,I,O,U) shift by X positions. Consonants shift by Y positions.

  • With vowels +1, consonants +2: CAT -> E(C+2) B(A+1) V(T+2) = EBV
  • WATER -> Y(W+2) B(A+1) V(T+2) F(E+1) T(R+2) = YBVFT

How to recognize it

  • Two different shift patterns
  • Identify vowels vs consonants first
  • Vowels: A, E, I, O, U; all others are consonants

Common mistakes

  • Applying wrong shift to vowels/consonants
  • Forgetting Y is a consonant (not a vowel)
  • Not identifying which shift applies to which group

Step-by-step walkthrough

Encode 'CAT' with vowels +1, consonants +2

  1. C is a consonant. Shift by +2: C (3rd) + 2 = E
  2. A is a vowel. Shift by +1: A (1st) + 1 = B
  3. T is a consonant. Shift by +2: T (20th) + 2 = V

Answer: EBV

Learn 10

Keyboard Cipher

Letters shift along their QWERTY keyboard row.

The keyboard cipher shifts letters within their QWERTY keyboard row. Q-W-E-R-T-Y-U-I-O-P form the top row, A-S-D-F-G-H-J-K-L the middle row, and Z-X-C-V-B-N-M the bottom row. Each letter shifts to an adjacent letter in its row, wrapping around at the end.

Top row: QWERTYUIOP, Middle row: ASDFGHJKL, Bottom row: ZXCVBNM. Shift right within each row.

  • Shift 1: CAT -> V(C->V) S(A->S) Y(T->Y)
  • Shift 1: DOG -> F(D->F) P(O->P) H(G->H)

How to recognize it

  • Letters stay in their keyboard row
  • Adjacent letters on keyboard
  • Q->W, A->S, Z->X pattern

Common mistakes

  • Not visualizing the keyboard layout
  • Confusing which row a letter belongs to
  • Forgetting row wrap-around (P->Q, L->A, M->Z)

Step-by-step walkthrough

Encode 'DOG' with keyboard shift +1 (shift right within each row)

  1. Keyboard rows: Top = QWERTYUIOP, Middle = ASDFGHJKL, Bottom = ZXCVBNM
  2. D is in middle row (ASDFGHJKL). Shift right by 1 → F
  3. O is in top row (QWERTYUIOP). Shift right by 1 → P
  4. G is in middle row (ASDFGHJKL). Shift right by 1 → H

Answer: FPH

Learn 11

Reverse Word

The word is spelled backwards (transposition, not substitution).

Unlike substitution ciphers that replace letters, the reverse word cipher is a transposition cipher that rearranges the order of letters. The word is simply spelled backwards. This is one of the simplest ciphers but represents a fundamentally different approach to encoding.

Read letters from right to left. WORD -> DROW

  • WATER -> RETAW
  • HELLO -> OLLEH
  • STAR -> RATS

How to recognize it

  • No letter substitution occurs
  • Same letters in reversed order
  • Read backwards to decode

Common mistakes

  • Looking for letter substitution patterns
  • Not recognizing it as simple reversal
  • Confusing with Atbash (reverse alphabet)

Step-by-step walkthrough

Encode 'WATER' by reversing

  1. Write the word: W-A-T-E-R
  2. Read from right to left: R is now first
  3. E is second
  4. T is third
  5. A is fourth, W is last

Answer: RETAW

Learn 12

Skip Cipher

Letters are rearranged by taking alternating positions.

The skip cipher is a transposition cipher that rearranges letters by extracting them at regular intervals. In the basic form, odd-positioned letters (1st, 3rd, 5th...) are written first, followed by even-positioned letters (2nd, 4th, 6th...). This scrambles the word without changing any individual letters.

Take positions 1,3,5... then 2,4,6... Example: WATER (W1,A2,T3,E4,R5) -> WTR + AE = WTRAE

  • WATER -> WTRAE
  • HELLO -> HLOEL
  • STARS -> SASRT

How to recognize it

  • Same letters, different order
  • Pattern: odd positions first, then even
  • No letter substitution

Common mistakes

  • Looking for substitution patterns
  • Miscounting odd/even positions
  • Forgetting which set comes first

Step-by-step walkthrough

Encode 'WATER' using the skip cipher

  1. Number the positions: W(1) A(2) T(3) E(4) R(5)
  2. Extract odd positions (1, 3, 5): W, T, R
  3. Extract even positions (2, 4): A, E
  4. Combine: odd letters first, then even letters

Answer: WTRAE

Learn 13

Binary Encoding

Represent each letter's alphabet position as a base-2 number (0s and 1s).

Binary encoding uses only the digits 0 and 1 to represent numbers. Each position in a binary number represents a power of 2: the rightmost digit is 2^0 = 1, then 2^1 = 2, 2^2 = 4, 2^3 = 8, and so on. To encode a letter, map it to its alphabet index (A=1, B=2, ..., Z=26 or A=0, B=1, ..., Z=25 — the convention is fixed by the puzzle) and convert that index to binary. Five bits are enough to cover all 26 letters.

Letter → position → binary; e.g. C = 3 = 00011; K = 11 = 01011

  • A (= 1) → 00001
  • M (= 13) → 01101
  • Z (= 26) → 11010
  • Example: 1011₂ = 1·8 + 0·4 + 1·2 + 1·1 = 11

How to recognize it

  • Only the digits 0 and 1 appear
  • Each code-group is typically 5 bits (or 6 bits if 0-indexed)
  • Decoding requires interpreting each group as a base-2 number

Common mistakes

  • Mixing A=0 and A=1 conventions mid-decoding
  • Reading bits right-to-left when the puzzle writes them left-to-right (or vice versa)
  • Counting bit positions as powers of 10 instead of powers of 2

Learn 14

Phone Keypad (Multi-tap) Encoding

Encode letters as (key, tap) pairs using the ITU E.161 phone keypad layout.

On a standard ITU E.161 telephone keypad, letters are grouped under digits 2–9: 2=ABC, 3=DEF, 4=GHI, 5=JKL, 6=MNO, 7=PQRS (four letters), 8=TUV, 9=WXYZ (four letters). In multi-tap encoding, each letter is represented by its key digit plus the number of presses needed to reach that letter on the key — A = 2-1, B = 2-2, C = 2-3, D = 3-1, ..., S = 7-4, Z = 9-4. The encoding is not case-sensitive and does not use the 1 or 0 keys (reserved for punctuation/space).

letter → (key, tap), where key ∈ {2..9} and tap is the 1-based index within that key's group

  • HELLO → 4-2 3-2 5-3 5-3 6-3
  • ABC → 2-1 2-2 2-3
  • Z → 9-4 (the fourth letter on 9)

How to recognize it

  • Digits 2–9 paired with small numbers 1–4
  • No 0 or 1 digits appear as the first number of a pair
  • The keypad layout 2=ABC ... 9=WXYZ is explicitly referenced

Common mistakes

  • Forgetting that 7 and 9 each have four letters (not three)
  • Starting the count at 0 instead of 1 for the tap number
  • Assigning letters to 1 or 0 (those keys hold no letters)

Learn 15

Rail Fence Cipher

A transposition cipher that writes the plaintext in a zigzag across N rails and reads ciphertext row by row.

In the rail fence cipher, the plaintext is written diagonally downward and upward across a number of 'rails' (rows), forming a zigzag pattern. Once the text is laid out, the ciphertext is read off row by row. The number of rails N is the key. The cipher is a pure transposition — no letter is changed, only rearranged — so letter frequencies in the ciphertext match the plaintext.

Write M diagonally on N rails (zigzag); read rail-by-rail to get C

  • HELLOWORLD, 3 rails → H...O...L | .E.L.W.R.D | ..L...O.. → HOLELWRDLO
  • 'WE ARE DISCOVERED' with 3 rails → zigzag then row-read
  • Decryption reverses the zigzag using the known number of rails

How to recognize it

  • The problem specifies a number of rails or rows
  • Ciphertext contains exactly the same letters as the plaintext (transposition)
  • Letter frequencies match the original language

Common mistakes

  • Mistaking it for a substitution cipher and analyzing frequencies
  • Reading the zigzag incorrectly (missing the 'up' portion of the bounce)
  • Using the wrong number of rails

Learn 16

ROT13 Cipher

A Caesar cipher with fixed shift of 13 that is its own inverse for the 26-letter Latin alphabet.

ROT13 replaces each letter with the letter 13 positions after it in the alphabet, wrapping around: A↔N, B↔O, C↔P, ..., M↔Z. Because 13 is exactly half of 26, applying ROT13 twice returns the original text — the cipher is its own inverse. Case and non-letter characters are left unchanged. ROT13 provides essentially no cryptographic security; it is used as a light obfuscation to hide spoilers, punchlines, or mild offensive material.

E(x) = (x + 13) mod 26, applied letter-by-letter

  • HELLO → URYYB
  • CLAUDE → PYNHQR
  • ROT13(ROT13(x)) = x

How to recognize it

  • Every letter is shifted by the same amount
  • Applying the transformation twice returns the original
  • A↔N, B↔O, C↔P are the classic letter pairs

Common mistakes

  • Confusing ROT13 with atbash (which reverses the alphabet A↔Z, B↔Y, ...)
  • Applying the shift to digits or punctuation
  • Shifting by 12 or 14 instead of exactly 13

Learn 17

Vigenère Cipher

A polyalphabetic substitution cipher using a repeating keyword to determine each letter's shift.

The Vigenère cipher encrypts each letter of the plaintext with a Caesar shift whose size is determined by the corresponding letter of a repeating key. With letters encoded A=0, B=1, ..., Z=25, encryption is C_i = (M_i + K_i) mod 26 and decryption is M_i = (C_i − K_i) mod 26, where K_i is the key letter at position i (the key repeats if shorter than the message). This breaks simple frequency analysis because the same plaintext letter maps to different ciphertext letters depending on its position in the key cycle.

C_i = (M_i + K_i) mod 26; M_i = (C_i − K_i) mod 26

  • Plaintext HELLO with key KEY → shifts K(10) E(4) Y(24) K(10) E(4) → RIJVS
  • Plaintext ATTACK with key LEMON → shifts 11 4 12 14 13 11 → LXFOPV
  • A repeating-letter key (e.g., AAAA) reduces Vigenère to a plain Caesar shift of 0

How to recognize it

  • A key or keyword is given alongside the ciphertext
  • The same ciphertext letter does not always decode to the same plaintext letter
  • Letter frequencies in the ciphertext appear flatter than in a monoalphabetic cipher

Common mistakes

  • Forgetting to repeat the key when the message is longer
  • Using A=1 instead of A=0 (off-by-one shifts)
  • Subtracting instead of adding (or vice versa) during encryption

Worked examples

The worked examples below preserve the original practice set at every difficulty. Open an example to compare the prompt, answer choices, correct answer, and explanation.

Explanation

Advertisement