Skip to content
MoneyDeck

Caesar Cipher Encoder/Decoder

Encode, decode and crack Caesar shift ciphers and ROT13 instantly

Updated · Free, no signup

Number of places each letter moves. Julius Caesar used 3.

Result

Phhw ph dw wkh rog rdn wuhh dw qrrq.

Shift applied (forward)

3

Letters shifted

27

  • To reverse this, apply a shift of 23 — or switch to Decode with the same key.

Brute force: the input under every decoding key

KeyChi-squared (lower = more English)Decoded text
1559.20Ldds ld zs sgd nkc nzj sqdd zs mnnm.
2131.60Kccr kc yr rfc mjb myi rpcc yr lmml.
31,392.40Jbbq jb xq qeb lia lxh qobb xq kllk.
4281.10Iaap ia wp pda khz kwg pnaa wp jkkj.
52,221.30Hzzo hz vo ocz jgy jvf omzz vo ijji.
6114.70Gyyn gy un nby ifx iue nlyy un hiih.
7935.80Fxxm fx tm max hew htd mkxx tm ghhg.
8175.20Ewwl ew sl lzw gdv gsc ljww sl fggf.
9273.70Dvvk dv rk kyv fcu frb kivv rk effe.
101,019.50Cuuj cu qj jxu ebt eqa jhuu qj deed.
11102Btti bt pi iwt das dpz igtt pi cddc.
12104.70Assh as oh hvs czr coy hfss oh bccb.
13355.10Zrrg zr ng gur byq bnx gerr ng abba.
141,676.30Yqqf yq mf ftq axp amw fdqq mf zaaz.
15972.50Xppe xp le esp zwo zlv ecpp le yzzy.

About the Caesar Cipher Encoder/Decoder

This Caesar cipher tool encodes and decodes messages that use a simple letter shift. Each letter is moved a fixed number of places along the alphabet — with a shift of 3, A becomes D, B becomes E and Z wraps around to C — while numbers, spaces and punctuation stay as they are and upper- and lowercase are preserved. ROT13, the shift of 13 popular for hiding spoilers and puzzle answers, is built in.

It is made for students learning classical cryptography, puzzle and geocache solvers, escape-room designers and teachers. If you do not know the key, the brute-force table shows the message under all 25 possible shifts, and the tool scores each one against normal English letter frequencies to pick the most likely plaintext automatically.

A Caesar cipher offers no real security: there are only 25 keys, so anyone can try them all in seconds, exactly as this page does. Use it for fun, teaching and puzzles, never for passwords or private information.

How to use the caesar cipher encoder/decoder

  1. 1Type or paste your message.
  2. 2Choose Encode, Decode, ROT13 or Crack automatically.
  3. 3For encode or decode, set the shift key (3 is the classic Caesar shift).
  4. 4Copy the result, or scan the brute-force table to read every possible decoding.

Formula and method

Encode: E(x) = (x + k) mod 26 · Decode: D(x) = (x − k) mod 26 · χ² = Σ (Oᵢ − Eᵢ)² ÷ Eᵢ

Each letter is numbered A = 0 to Z = 25. Encoding adds the key k and wraps around with modulo 26, so with k = 3, X (23) becomes (23 + 3) mod 26 = 0 = A. Decoding subtracts the key, which is the same as encoding with 26 − k. ROT13 uses k = 13, which is its own inverse: applying it twice returns the original text. Case is kept and non-letters are left untouched.

To crack an unknown key, the tool decodes the text with all 25 keys and compares the letter counts of each attempt (Oᵢ) with the counts expected from typical English letter frequencies (Eᵢ = letters × frequency of letter i). The attempt with the smallest chi-squared statistic is the most English-like and is reported as the best guess. This works well on a sentence or more, but can misfire on a handful of letters.

x
Letter position, A = 0 … Z = 25
k
Shift key, 1–25
Oᵢ, Eᵢ
Observed and expected count of letter i

Worked examples

Classic shift of 3

Each letter moves three places forward: H→K, e→h, l→o, o→r, W→Z, r→u, d→g. The comma, space and exclamation mark are unchanged and capitals stay capitals, giving "Khoor, Zruog!".

ROT13 a spoiler

ROT13 shifts every letter by 13, half the alphabet, so W→J, h→u, y→l and so on. Running the result through ROT13 again moves each letter another 13 places, back to the original question.

Cracking an unknown key

The tool decodes the message with all 25 keys and scores each attempt with a chi-squared test against English letter frequencies. Shifting back by 3 (forward by 23) gives the lowest score, revealing the pangram "The quick brown fox jumps over the lazy dog".

Frequently asked questions

How does a Caesar cipher work?+

Every letter is replaced by the letter a fixed number of places further along the alphabet, wrapping from Z back to A. With a shift of 3, "ABC" becomes "DEF" and "XYZ" becomes "ABC". The recipient shifts back by the same amount.

What is ROT13?+

ROT13 is a Caesar cipher with a shift of 13. Because the alphabet has 26 letters, applying ROT13 twice gives back the original, so the same operation both encodes and decodes. It is used to hide spoilers and puzzle answers, not to keep secrets.

How do you decode a Caesar cipher without the key?+

Try all 25 shifts and look for readable text, or use frequency analysis: in English, E, T and A are the most common letters. This tool does both, ranking every shift by how closely its letter counts match English.

Is the Caesar cipher secure?+

No. There are only 25 possible keys, so it can be broken by hand in minutes and by a computer instantly. Modern encryption such as AES uses keys with 2^128 or more possibilities.

What shift did Julius Caesar use?+

According to the Roman historian Suetonius, Julius Caesar shifted letters three places, writing D for A. Suetonius also reports that Augustus used a shift of one, writing B for A.

Related tools