What is a Caesar cipher?
The Caesar cipher shifts every plaintext letter by the same number of positions in a chosen alphabet. With a shift of 3 in the 26-letter English alphabet, A becomes D, B becomes E, and X wraps around to A.
Because one fixed substitution is used throughout the message, Caesar is a monoalphabetic substitution cipher. The shift is the key. An alphabet of N symbols has N − 1 non-trivial shifts, so English has 25 candidates. That small keyspace makes exhaustive manual testing practical, although very short messages can have more than one plausible reading.
Before you start
First identify the alphabet used by the message. For this English example, write 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 on a strip of paper. A cipher made with another alphabet can have a different number and order of symbols.
To decrypt, move each ciphertext letter backward by the candidate key. A shift of 3 backward in a 26-letter alphabet is equivalent to 23 forward. Spaces, digits, and punctuation are normally preserved, but confirm that convention when the source is known.
Method 1 — Try every shift (brute force)
For an alphabet of N symbols, test shifts 1 through N − 1. Take the English ciphertext WKLV LV D WHVW:
- Shift 1:
VJKU KU C VGUV. - Shift 2:
UIJT JT B UFTU. - Shift 3:
THIS IS A TEST.
Shift 3 produces a clear sentence, so it is the strongest candidate. With a very short ciphertext, keep more than one plausible result until context confirms the answer. The Caesar brute-force tool lists every shift at once for checking your manual work.
Method 2 — Frequency analysis
Longer texts let you prioritize likely keys. In English, E, T, A, and O are common, but the exact order varies by sample. Count the ciphertext letters and compare several high-frequency candidates rather than trusting a single match.
If H is frequent and you hypothesize that it represents E, the distance is 3, so test key 3 on the whole message. Accept it only if words, grammar, and multiple letter patterns agree. The frequency analysis tool can produce the counts; frequency is a clue, not proof.
Method 3 — Use a crib (a likely word)
A likely word—a greeting, a name, or a term suggested by context—is called a crib. Align it with a ciphertext fragment and calculate the backward shift for every letter.
If you expect THE and see WKH, then W→T, K→H, and H→E all require a shift of 3. That consistency makes key 3 worth testing on the complete message. A crib is convincing only when the rest of the plaintext also becomes coherent.
Common mistakes and checks
Check these common failure points:
- Wrong alphabet. The number and order of letters determine every shift.
- Wrong direction or wraparound. In English,
Bshifted back by 3 isY. - Premature certainty. A short result can look meaningful by chance; verify the entire message.
- ROT13 scope. ROT13 is the self-inverse shift-13 case for the 26-letter Latin alphabet.
If no shift produces coherent text, reconsider the alphabet, the language, and the assumption that the message uses a Caesar cipher. It may instead use a different substitution or a transposition.