twoodo
/

Home/Tools/Encoding & ciphers

Caesar Cipher

Every shift is tried below, ranked by how English it looks.

The oldest cipher there is

Suetonius records that Julius Caesar shifted each letter three places to protect his military correspondence. That is the entire method: choose a number, move every letter along by it, wrap around at Z.

It worked in the first century BC because most of his enemies could not read at all, and those who could had no reason to suspect the text was encoded rather than simply foreign.

Why it fails immediately

There are only 25 useful keys. You could break it by hand in a couple of minutes just by trying them all, and a computer does it instantly.

But you do not even need to try them all. The panel above ranks every shift by chi-squared frequency analysis: it counts how often each letter appears in each candidate and compares that to the known distribution of English, where E is about 12.7 % of letters, T about 9 %, and Z about 0.07 %.

The plaintext matches English; the other 24 candidates do not. With more than a sentence or two of text, the top-ranked answer is essentially always correct — and you can watch that happen above by pasting the encoded sample in.

Al-Kindi worked this out in the ninth century

Frequency analysis is not a modern invention. The Arab polymath al-Kindi described it in Baghdad around 850 AD, in what is the earliest known work on cryptanalysis. He was studying the Qur'an linguistically and noticed that letters appear at characteristic rates — and that this makes any substitution cipher breakable.

His insight killed the entire family of simple substitution ciphers, roughly seven hundred years before European cryptographers caught up.

ROT13 is a Caesar cipher

It is simply the shift of 13, chosen because it is its own inverse. Set the shift above to 13 and you have it.

What came next

The response to frequency analysis was the Vigenère cipher, which uses a different shift for each position and so flattens the letter distribution. It held out for three centuries before that too was broken.

Common uses

  • Puzzle hunts and escape rooms.
  • Teaching cryptography, where it is almost always the first example.
  • Breaking a shift cipher you have been handed.
  • Children's codes and secret messages, which is an honourable use.

Questions people ask

What shift did Caesar use?

Three, according to Suetonius. Each letter moved three places forward, wrapping around at Z.

How do you break a Caesar cipher?

Frequency analysis. Compare each candidate's letter distribution against English — the real plaintext matches and the other 24 do not. The panel on this page does it live.

How many possible keys are there?

Twenty-five useful ones. A shift of 0 or 26 leaves the text unchanged.

Is ROT13 a Caesar cipher?

Yes, with a shift of 13 — chosen because it is its own inverse.

Who first broke substitution ciphers?

Al-Kindi, in Baghdad around 850 AD. His description of frequency analysis is the earliest known work on cryptanalysis.

None of this is security

The ciphers on this site are historical. Every one of them was broken centuries ago, and a modern computer breaks them in microseconds — the Caesar page shows the break happening rather than just describing it.

They are worth knowing for puzzles, for teaching, for reading old texts and for understanding where cryptography came from. They are not worth using to protect anything. If you need something kept secret, you need modern encryption with a properly managed key, and you should not be building it yourself.

The encodings — Morse, binary, hex, NATO — make no secrecy claim at all. They exist to move information over a channel, and anyone can read them.

Your text stays in the page

Everything runs in your browser. Nothing you type is transmitted, logged or stored, and this site has no server that could receive it. The about page lists every request the site makes.