🔐 Caesar Cipher

Encode and decode Caesar cipher and ROT13 online. Choose any shift from 1 to 25, or crack unknown text: all 25 shifts ranked by English letter frequency.

✓ Free✓ No Signup Required✓ Browser-Based
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
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
Encoded
Phhw ph dw wkh rog rdn wuhh dw qrrq.

What Caesar Cipher Does

This Caesar cipher tool encodes and decodes text with any shift from 1 to 25, including ROT13, and shows the alphabet mapping as you move the slider — useful for learning how the cipher works or checking a puzzle by hand. Capital letters, lowercase letters, spaces and punctuation are preserved, and there is an option to rotate digits as well.

If you have a message but not the key, choose Decode: all 25 possible shifts are listed and ranked by how closely each result matches the letter frequencies of normal English. For anything a sentence or longer, the correct message is almost always at the top; click it to adopt that shift.

How to Use Caesar Cipher

  1. Choose Encode or Decode, or press ROT13
  2. Type or paste your text
  3. Set the shift with the slider and check the alphabet mapping
  4. Copy the result
  5. To crack unknown text, use Decode and pick the top-ranked shift

Formula Used by Caesar Cipher

Encoding and decoding

Encode: C = (P + k) mod 26 · Decode: P = (C − k) mod 26

P, C
Plain and cipher letters as numbers, A = 0 … Z = 25
k
The shift (key)

Worked example

“HELLO” with a shift of 3.

  1. H (7) → 10 = K
  2. E (4) → 7 = H
  3. L (11) → 14 = O
  4. O (14) → 17 = R

Result: “KHOOR”.

Ranking the 25 candidates

χ² = Σ (observed − expected)² ÷ expected, over the 26 letters

Worked example

A candidate decryption with 100 letters.

  1. Expected E count = 12.7, T = 9.1, A = 8.2 …
  2. Compare with the letters actually present

Result: The lowest χ² is the most English-like — usually the real message.

Letter Frequencies in English

LetterFrequencyLetterFrequency
E12.7%N6.7%
T9.1%S6.3%
A8.2%H6.1%
O7.5%R6.0%
I7.0%D4.3%

How to Read Your Result

A classroom favorite

The Caesar cipher is a gentle introduction to cryptography: it shows what a key is, why a small key space is weak, and how frequency analysis — first described by the Arab scholar al-Kindi in the 9th century — breaks substitution ciphers. It also turns up in escape rooms, geocaching puzzles and scavenger hunts.

Stronger relatives

The Vigenère cipher uses a different Caesar shift for each letter, following a keyword, which defeats simple frequency analysis. Modern encryption such as AES is in a different league entirely and should be used for anything that must stay secret.

Limitations & Accuracy Notes

  • Only the 26 letters of the basic Latin alphabet are shifted; accented letters are left unchanged.
  • Frequency ranking needs enough text; with a few words, check the top several candidates.
  • Not secure encryption.

Frequently Asked Questions

What is a Caesar cipher?
One of the oldest known ciphers: each letter is replaced by the letter a fixed number of places further along the alphabet. With a shift of 3, A becomes D, B becomes E, and Z wraps round to C. It is named after Julius Caesar, who is said to have used a shift of 3.
How do I decode a Caesar cipher?
Shift each letter back by the same amount. If you do not know the shift, choose Decode: all 25 possible shifts are listed, ranked by how closely each result’s letter frequencies match English, so the real message is usually at the top.
What is ROT13?
A Caesar cipher with a shift of 13. Because the alphabet has 26 letters, applying ROT13 twice returns the original text, so the same operation encodes and decodes. It is often used to hide spoilers and puzzle answers.
Is the Caesar cipher secure?
No. There are only 25 possible shifts, so anyone can try them all in seconds, as this page does. Use it for puzzles, escape rooms, classroom lessons and fun — never to protect real secrets.
What happens to numbers, spaces and punctuation?
They are left as they are, and capital and lowercase letters keep their case. Tick “Shift digits too” to rotate 0–9 as well, which some puzzles use.
How does frequency analysis crack it?
In English, E, T, A and O are the most common letters. For each shift, the tool compares the result’s letter counts with normal English using a chi-squared score; the shift with the closest match is almost always the answer for text of a sentence or more.

References & Further Reading

By OnlineToolHubs Team • Updated September 2026