Coding - Decoding
🔒 Log in to trackLetter shift coding
🔒 Log in to trackEvery letter moves forward or backward by some steps in the alphabet. Find the steps from the sample pair, slot by slot. Then move the letters of the new word by the same steps. After Z the alphabet starts again at A.
What a letter shift is
Each letter moves forward or back by a fixed number of steps. With +2, CAT becomes ECV.
Think of the alphabet as a circle of 26 letters. After Z it starts again at A. This is the most common coding question in SSC, Railway and Banking papers.
- Coding: the word is given, you write the code.
- Decoding: the code is given, you bring back the word.
Know the positions fast
Each letter has a position: A = 1, B = 2, … Z = 26. Learn five anchors and you will never count on your fingers.
| E | J | O | T | Y |
|---|---|---|---|---|
| 5 | 10 | 15 | 20 | 25 |
Every letter is at most 2 steps from an anchor. R = T − 2 = 18. H = J − 2 = 8. W = Y − 2 = 23.
Tip: Also remember M = 13 and N = 14. They sit in the middle of the alphabet.
Find the shift from the sample
Write the word above its code. For each slot, work out code position − word position. This list is the shift list.
KITE → MKVG. K(11) → M(13) is +2. I → K is +2, T → V is +2, E → G is +2. The shift list is (+2, +2, +2, +2). This is a flat shift.
Rule: Check at least three letters before you trust a shift. One letter can fool you.
Wrap-around
If the new position is more than 26, subtract 26. If it is 0 or less, add 26.
- Y + 3: 25 + 3 = 28, and 28 − 26 = 2 = B.
- C − 5: 3 − 5 = −2, and −2 + 26 = 24 = X.
- W + 4: W is Y − 2, so W + 4 = Y + 2, which crosses Z and lands on A.
A full question, start to finish
"In a certain code, PEN is written as RGP. How is CAT written in that code?"
- Find the shift: P(16) → R(18) is +2. E(5) → G(7) is +2. N(14) → P(16) is +2.
- The rule is a flat +2 shift.
- Apply it to CAT: C → E, A → C, T → V.
- Write the code: ECV.
For decoding, run the film backwards. RGP − 2 gives P, G − 2 gives E, P − 2 gives N. You are back at PEN.
The five kinds of shift
- Flat: every letter moves the same, like +2 or −3.
- Rising or falling: +1, +2, +3, … or −1, −2, −3, … LAMP with −1, −2, −3, −4 gives KYJL.
- Alternating: +1, −1, +1, −1, … Odd places go one way, even places the other.
- Length-based: the shift equals the number of letters. CAT (3 letters) → FDW. FISH (4 letters) → JMWL.
- Decoding: the code is given and the word is asked. Undo each step. Where the rule adds 2, you subtract 2.
Example: WORD → XQUH. The shifts are +1, +2, +3, +4, a rising list. So BOOK → B+1, O+2, O+3, K+4 = CQRO. The two O's get different codes, because the place decides the shift.
Use the options
- Code only the first letter. Usually one or two options survive.
- Then code the last letter to choose between them.
- For decoding, code your chosen option forward once. If it gives the code, you are right.
Question types you will see
Each type: how to recognise it, the method step by step, and one question to try.
Flat shift (+k or −k on every letter)
Every code letter is the same number of steps ahead of (or behind) its word letter.
Subtract positions for three letters of the sample.
If all differences are equal, that is k.
Add k to each letter of the new word. Wrap after Z.
A flat rule treats every letter the same way.
In a certain code language, SILK is written as UKNM. How will COTTON be written in that language?
Show solutionHide solution
S→U, I→K, L→N, K→M: each is +2.
COTTON +2: C→E, O→Q, T→V, T→V, O→Q, N→P.
EQVVQP
Rising or falling shift (+1, +2, +3, …)
The differences are not equal but grow or fall by place: +1, +2, +3, +4 or −1, −2, −3.
Write the full shift list from the sample.
Apply the same list to the new word, place by place.
Expect a repeated letter to get different codes.
The place of a letter decides its shift, not the letter itself.
In a certain code language, LAMP is written as MCPT. How will DESK be written in that language?
Show solutionHide solution
L→M +1, A→C +2, M→P +3, P→T +4.
DESK: D+1 = E, E+2 = G, S+3 = V, K+4 = O.
EGVO
Decoding (code given, word asked)
The question gives a code and asks: which word is written as …?
Find the rule from the sample pair.
Undo it: subtract where the rule adds, add where it subtracts.
Code your answer forward once to confirm.
Decoding is the same rule played backwards.
In a certain code language, BIRD is written as DKTF. Which word is written as HTQI in that language?
Show solutionHide solution
BIRD → DKTF is +2 on every letter.
Decode with −2: H→F, T→R, Q→O, I→G.
Check: FROG +2 = HTQI.
FROG
Alternating shift (odd and even places)
The shifts swing: +1, −1, +1, −1, … Letters in odd places move one way, even places the other.
Write the shift list and find the 2-step cycle.
Apply the cycle to the new word from the first letter.
For a longer word, keep repeating the cycle.
The rule depends only on whether the place is odd or even.
In a certain code language, FLOWER is written as GKPVFQ. How will GARDEN be written in that language?
Show solutionHide solution
F→G +1, L→K −1, O→P +1, W→V −1, E→F +1, R→Q −1.
GARDEN with +1, −1 repeating: G→H, A→Z, R→S, D→C, E→F, N→M.
HZSCFM
Shift equal to the number of letters
Two samples of different lengths have different flat shifts. Each shift equals the word's letter count.
Find the flat shift of each sample.
Compare it with the number of letters.
Count the letters of the new word and shift by that number.
The shift is not fixed. It is tied to the length of the word.
In a certain code language, CAT is written as FDW and DEER is written as HIIV. How will PLANT be written in that language?
Show solutionHide solution
CAT is +3 (3 letters). DEER is +4 (4 letters).
PLANT has 5 letters, so shift +5.
P→U, L→Q, A→F, N→S, T→Y.
UQFSY
Formula sheet
d is the shift for place i, found from the sample. Above 26, subtract 26.
To decode, subtract the same shifts. At 0 or below, add 26.
Shortcuts that save time
To shift a letter, jump from the nearest EJOTY anchor. W is Y − 2, so W + 4 = Y + 2 = A. Two small hops are faster than counting W, X, Y, Z, A.
If MANGO is written as OCPIQ, how is JUICE written?
Show solutionHide solution
MANGO → OCPIQ is +2 on every letter.
J+2 = L, U+2 = W, I+2 = K, C+2 = E, E+2 = G.
LWKEG
When the code is given and the word is asked, subtract the shift instead of adding it.
If MANGO is written as OCPIQ, which word is written as LWKEG?
Show solutionHide solution
The rule is +2, so decode with −2.
L→J, W→U, K→I, E→C, G→E.
JUICE
Mistakes to avoid
Where most students lose marks on this subtopic.
Adding the shift in a decoding question.
Decoding runs backwards. Subtract where the rule adds.
Treating a rising list (+1, +2, +3) as flat after checking one letter.
Check three letters. Write the full shift list.
Losing count when a shift crosses Z.
Above 26, subtract 26. At 0 or below, add 26.
In a length-based rule, using the sample's shift for the new word.
Count the letters of the new word. That count is its shift.
Giving a repeated letter the same code in a rising-shift rule.
In rising or alternating rules the place decides the shift, not the letter.
Quick revision
Read this the night before the exam.
Positions: A = 1 … Z = 26; anchors E5, J10, O15, T20, Y25.
Shift = code position − word position, slot by slot.
Flat, rising/falling, alternating and length-based are the main kinds.
Wrap-around: above 26 subtract 26; at 0 or below add 26.
Decode = subtract the shifts; check by coding your answer forward.
Code the first letter of each option first to cut options fast.
Practice: 15 questions
Sets of 10, mixed across the question types above. Every answer has a step-by-step explanation.
Topic test · 10 questions
Suggested time 6 min · wrong answers go to your mistake notebook automatically.