Caesar cipher, ROT13 and Atbash: how they work and break
Reviewed 23 November 2026 · 7 min read · Written and maintained by Toolnexo
A Caesar cipher is the simplest classic cipher: every letter moves a fixed number of places along the alphabet. It protects nothing against a determined reader, but it is a perfect way to learn how ciphers and code-breaking work, and its relatives turn up in puzzles and games. This guide explains the shift, ROT13 and Atbash, then shows two ways to break a message. The figures come from the Caesar cipher tool on this site, which runs in your browser, so nothing you type is uploaded.
How the shift works
Number the letters A to Z as 0 to 25. To encode with a shift of 3, add 3 to each letter position, and wrap round from Z to A. So A becomes D, B becomes E and X becomes A. To decode, subtract the shift. Julius Caesar is reported to have used a shift of 3 for private messages, which is where the name comes from.
Hello, World! with a shift of 3 becomes Khoor, Zruog!, and ATTACK AT DAWN becomes DWWDFN DW GDZQ. Only letters change. Spaces, digits and punctuation stay as they are, and upper and lower case are kept.
ROT13
ROT13 is a Caesar shift of 13. The alphabet has 26 letters, so shifting by 13 twice returns every letter to where it started. That means the same operation encodes and decodes, with no separate decode step. Hello becomes Uryyb, and applying ROT13 to Uryyb gives Hello again. ROT13 is a long-standing way to hide spoilers and puzzle answers, such as the hints in geocaching, where the reader has to choose to decode it.
Atbash
Atbash mirrors the alphabet instead of shifting it: A becomes Z, B becomes Y, C becomes X and so on. Hello becomes Svool. Like ROT13 it undoes itself when applied twice, and it has no key, so there is nothing to guess.
Breaking it, way one: try every shift
A shift of 26 returns the original text, so only the shifts 1 to 25 change anything. That leaves 25 keys, and a person can simply read the text at each one. The tool lists every decoding in a table when you turn on Show all 25 shifts, and the right one is the line that reads as words. The method fails only when a text is so short that several shifts give real words. For example, the word cheer with a shift of 7 becomes jolly, so a lone five-letter word could be either.
Breaking it, way two: letter frequencies
Letters in English are not equally common. E is about 12.7 percent of letters, T 9.1, A 8.2 and O 7.5, while Z and Q are well under 1. A Caesar shift moves every letter by the same amount, so the pattern survives: the most common letters of the ciphertext are just the common English letters moved along.
Try it on Meet me at the old stone bridge at noon and bring the map with you, shifted by 3: Phhw ph dw wkh rog vwrqh eulgjh dw qrrq dqg eulqj wkh pds zlwk brx. It has 52 letters. The most common are h and w, tied at 7 each, then r and q with 5. If h stands for e, the shift is 3. If w stood for e instead the shift would be 18, and that gives gibberish. A tie like this shows why one letter is not enough.
The tool compares the whole letter distribution with English using a chi-squared distance, where lower means closer to English. For this text the correct shift scores about 14, and the next best candidate scores about 103. It names the likely shift only when there are at least 25 letters, because shorter texts do not have enough letters to count.
Why it is not secure
With 25 keys the cipher falls in seconds. Even a general substitution cipher, which assigns any letter to any other, has 26 factorial keys, about 4.0 × 10 to the power 26, and still falls to the frequency method above. Later ciphers such as the Vigenère cipher use several shifts in turn to flatten the frequencies, and modern encryption works on an entirely different principle. Use a Caesar cipher for puzzles, classroom exercises and games. Use real encryption for anything private.
Using the tool
- Choose Caesar shift, ROT13 or Atbash. For a Caesar shift, pick Encode or Decode and set the shift with the slider, or press the 3 or 13 chip.
- Type or paste text. The result updates as you type, and Use output as input chains one operation after another.
- To crack a message, paste it, turn on Show all 25 shifts and press Use on the line that reads sensibly.
Put it into practice
Caesar Cipher Encoder and Decoder
Encode and decode text with a Caesar shift, ROT13 or Atbash, and read a coded message at all 25 shifts to find the one that makes sense.
Runs in your browserMorse Code Translator
Translate text to Morse code and Morse back to text, with letters, digits and punctuation, and play the message as sound at a speed you c…
Runs in your browserText to Binary Converter
Convert text to binary, hexadecimal, octal or decimal bytes and decode bytes back to text, using UTF-8 so accents and emoji round-trip co…
Runs in your browserBase64 Converter
Encode text to Base64 or decode Base64 back to text with full UTF-8 support: processed locally, safe for tokens and API keys in payloads.
Runs in your browserHow this guide is maintained
This page is reviewed when the related tools change. It describes what the published tools actually do: the tools run in your browser tab, so your files stay on your device. If you find something inaccurate, email [email protected] and it will be corrected.
Other guides
- How to merge PDFs without uploading them6 min · 17 November 2026
- OCR a scanned PDF: accuracy, limits and privacy7 min · 17 November 2026
- Compress a PDF without destroying readability6 min · 17 November 2026