OlyPrep

§ TOOLS / CIPHER LAB / CAESAR

Caesar cipher

The Caesar cipher slides the whole alphabet along by a fixed number of places: with a shift of three, A is written as D, B as E, and so on, wrapping from Z back round to A. It is the oldest cipher most children learn by name, and on Science Olympiad Codebusters papers it is usually one of the quick questions, with the shift either given or found in a few tries.

Free on every planNo sign-in to tryThe lab below runs this cipher only

§ THE CIPHER

What the Caesar cipher is

A Caesar cipher is a monoalphabetic substitution with one number as its key, the shift. To encode, every letter moves forward through the alphabet by that many places; to decode, every letter moves back by the same amount. Because the alphabet wraps around, a shift of 23 forward is the same as a shift of 3 back, and there are only twenty-five shifts that change anything, since a shift of 26 lands every letter on itself. Spaces and punctuation usually stay where they were, which leaves the word shapes in view.

The name comes from Julius Caesar, who is reported by Roman writers to have protected his correspondence by replacing each letter with the one three places further on. The ROT13 scheme once used to hide spoilers in online forums is a Caesar shift of thirteen, chosen because applying it twice restores the original. The cipher is also the first step toward several others: the Vigenère cipher applies a different Caesar shift at every position, and the affine cipher adds a multiplication before the shift.

When the shift is given, decoding is counting. The reliable way is to write the alphabet on one line and the shifted alphabet underneath it, so every ciphertext letter sits above its plaintext letter and no letter is counted in the head. When the shift is not given, there are only twenty-five possibilities, and English gives them away: the most frequent ciphertext letter is probably E, so the shift that turns it into E is the first guess, checked on a short word before it is applied everywhere. One-letter words help in the same way, since they can only be A or I.

The mistakes kids make are mostly about direction and wrap-around. Shifting forward when the message needs shifting back produces nonsense that looks plausible for a letter or two; the fix is to decide the direction once and write the two alphabets down. Letters near the start of the alphabet trip people up when a backward shift passes A: C shifted back by five is X, not something off the end. A written pair of alphabets removes both errors, and it takes less than a minute to make.

§ THE METHOD

How to solve a Caesar cipher

Every letter of the original text is shifted the same number of places down the alphabet — a shift of 3 turns A into D, B into E, and so on, wrapping around at Z. The shift amount may be given to you, or it may not be.

  1. If the shift IS given: decode by shifting each letter BACKWARD by that amount (encode shifted forward, so decode shifts back).
  2. If the shift is NOT given: find the most common ciphertext letter and try the shift that turns it into E.
  3. Test the guess on a short word — if it reads as English, apply the shift everywhere; if not, try the next most common letter.
  4. Watch the wrap-around: shifting B back by 3 goes past A to Y.
§ WORKED EXAMPLE

A worked example

Decode WKH VXQ (shift 3)

Shift each letter BACK by 3:
W → T
K → H
H → E

V → S
X → U
Q → N

Plaintext: THE SUN
§ ON THE TEST

Caesar in Codebusters

On the Science Olympiad Codebusters papers OlyPrep has read, the Caesar cipher is commonly one of the lower-value questions, often paired with Atbash as the warm-up pair. Some tournaments state the shift in the question; others leave it to be found, and the frequency trick above settles it in a few tries. The rule sets that keep the word breaks make it quicker still, because a decoded short word confirms or kills a guessed shift at once.

Scoring is usually by the letters of the decoded message, and a decoded quotation with up to two wrong letters is commonly counted as solved. The two-alphabet habit matters more here than it looks: a student who counts in their head tends to drift by one place partway through a long sentence, and a one-place drift wrongs every letter after it. Written alphabets make a Caesar question a steady read rather than a feat of concentration.

Some elementary tournaments limit the shift to a few places in either direction; the Macomb rules OlyPrep has read cap it at three, which turns the question into a quick count. The lab below shows the shift beside each challenge, so the practice is in the decoding itself: it uses a shift of three on the easy setting, a shift between four and ten on medium, and a larger one on hard. Cover the key line to practise finding the shift from the letters alone.

§ PRACTICE

Practice the Caesar cipher

The lab below is set to the Caesar cipher alone. Pick a difficulty, generate a challenge, decode it, then check your answer or reveal the solution. It runs in your browser, needs no account, and is unlimited on every OlyPrep plan.

Scoped to Caesar · 1 cipher type. Generate a challenge, solve it, and we'll track what you've cracked.

Shift cipher
§ PAST CHALLENGES

Your first decode is the hardest.

Pick a cipher above and give it a shot — we'll keep track of what you've solved.

§ WHERE IT IS TESTED

Where the Caesar cipher is tested

The Science Olympiad rule sets OlyPrep has read that name this cipher:

Bay Area ESO never asks teams to encode; five to ten of its twenty questions are multiple choice or fill-in on how the ciphers work.

Cipher lists change with each season’s rules; a tournament’s own rulebook is the authority on what it tests.

§ ABOUT THE CAESAR CIPHER

Questions about the Caesar cipher.

Q·01What is the difference between a Caesar cipher and ROT13?
ROT13 is a Caesar cipher with a shift of thirteen. Because thirteen is half of twenty-six, shifting by thirteen twice brings every letter back to where it started, so one operation both encodes and decodes. Any other Caesar shift needs a shift back of the same size to decode.
Q·02How do I find the shift when it is not given?
Count how often each ciphertext letter appears. The most common one is probably E, so try the shift that turns it into E and test it on a short word. If the word does not read as English, try the next most common letter. There are only twenty-five possible shifts, so a few guesses usually settle it.
Q·03How does the OlyPrep lab check a Caesar answer?
The lab encodes a short science sentence with a shift it shows you, and compares your decoded sentence against the original letter by letter, ignoring spaces and punctuation. Check says whether every letter matches; Reveal shows the solution.
Q·04Is OlyPrep part of Science Olympiad?
No. OlyPrep is independent and is not affiliated with Science Olympiad, Inc. or any state or regional Science Olympiad organization. Whether a paper gives the shift, and how large it can be, is set by each tournament’s own rules.