Caesar Cipher
Move every letter by the same fixed amount and learn to reverse the shift without guessing.
What is the Caesar Cipher?
A Caesar cipher replaces every plaintext letter with a letter a fixed number of positions away in the alphabet. The shift is the same everywhere in the message.
Because one plaintext letter always maps to one ciphertext letter, letter patterns are preserved. A doubled plaintext letter stays doubled, and repeated words keep the same pattern.
The cipher mechanics on this page are self-contained. Science Olympiad event formats, allowed variants, and tournament constraints can change by season; the current official Rules Manual and official clarifications take precedence.
No outside reference is assumed. Work through Foundations → Complete Reference → Encryption → Decryption in order, then use the competition and cryptanalysis sections.
What you need to know
- Plaintext is the readable message.
- Ciphertext is the shifted message.
- Shift is the number of alphabet positions moved.
- The alphabet wraps around: after Z comes A.
Beginner glossary
| Term | Meaning |
|---|---|
| Shift | The fixed number of alphabet positions moved for every letter. |
| Wraparound | Continuing from Z back to A, or from A back to Z. |
| Modulo 26 | Arithmetic where values repeat every 26 positions; it handles alphabet wraparound. |
| Brute force | Testing every possible shift systematically. |
Keep this beside you while solving
| Plain | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Cipher | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
Example reference for shift +3. To decrypt, move three positions backward.
Alphabet numbers used in formulas
| Letter | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Value | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 |
How encryption works
Choose the shift
For a shift of +3, every plaintext letter moves three places forward.
Map each letter
A→D, B→E, C→F, and so on.
Wrap at Z
X→A, Y→B, Z→C.
Preserve separators
Keep spaces and punctuation unless a problem explicitly removes them.
How decryption works
Find or infer the shift
If the shift is given, use it directly. Otherwise test shifts or use recognizable word patterns.
Move backward
Subtract the shift from every ciphertext letter.
Wrap below A
With shift 3, B decrypts to Y.
Read the result
Check that the whole message—not just one word—makes sense.
How to approach it in Codebusters practice
- If a shift is supplied, this is mainly a speed-and-accuracy task.
- If it is not supplied, test all 26 possibilities systematically rather than guessing random letters.
- Use short words and repeated patterns to identify the correct plaintext quickly.
What the problem gives you vs. what you produce
| Part | What to expect |
|---|---|
| You may be given | A ciphertext and a shift, or a ciphertext whose shift must be identified. |
| You must find | Usually the plaintext; sometimes the shift as well. |
| Fastest first move | If the shift is known, write one shifted alphabet row. If unknown, test shifts systematically. |
How to attack an unknown or partially known key
- A Caesar cipher has only 26 possible shifts, so exhaustive testing is practical.
- Frequency analysis can help on longer texts: the most common ciphertext letter may correspond to a common plaintext letter such as E or T, but do not trust one frequency alone.
- A known plaintext fragment immediately determines the shift.
Follow one example from start to finish
WKH GDLOB FLSKHU
with shift 3.
W → T
,
K → H
,
H → E
gives THE.
THE DAILY CIPHER
Before moving on, make sure you can answer these without another site:
- Can you explain why Z shifted by +2 becomes B?
- Can you decrypt D with a shift of +3 without rebuilding the entire alphabet?
- If the shift is unknown, can you explain why there are only 25 nontrivial shifts to test?
Common mistakes
Shifting in the wrong direction.
Forgetting to wrap around A/Z.
Changing the shift halfway through.
Accepting one plausible word without checking the rest of the message.
Competition speed strategies
Write one shifted alphabet row once and use it for the entire problem.
For unknown shifts, test a likely short word against a few shifts first.
When a shift is known, work left-to-right and mark each word as soon as it is decoded.
What to remember under time pressure
See every transformation
Use the lab to change inputs and keys, keep the relevant reference material visible, inspect each intermediate transformation, and then read the “How to reverse it” panel so encryption and decryption connect.