# Caesar Cipher and ROT13 - Encode, Decode and Try All 25 Shifts

Page: https://hirantha.me/tools/caesar-cipher
Part of: Hirantha Sandaruwan Lakshan free tools (https://hirantha.me/tools)
Updated: 2026-10-13

Encode or decode a Caesar cipher with any shift from -25 to 25, use ROT13, or try all 25 shifts of an unknown message and see the likeliest marked.

This is a free tool that runs in the browser: open the page to use it. File tools process files on the visitor's own device; files are never uploaded or stored. No account, sign-up, payment or watermark.

The Caesar cipher moves every letter a fixed number of places along the alphabet. Choose a shift from -25 to 25 to encode or decode, press ROT13 for the shift of 13, or paste a message of unknown shift and look at all 25 possibilities at once, with the most English-looking line marked. It runs in your browser and nothing is sent anywhere.

How it works. Each letter moves forward by the shift and wraps from Z back to A. With a shift of 3, A becomes D, B becomes E and Z becomes C, so VENI VIDI VICI becomes YHQL YLGL YLFL. To decode, move back by the same number. ROT13 is the shift of 13; because 13 + 13 = 26, the whole alphabet, doing it twice returns the original, so the same step both encodes and decodes.

What the tool changes. Only the 26 English letters move, and upper and lower case are kept. Digits, spaces, punctuation and letters from other alphabets, such as é, ñ or Sinhala and Tamil letters, are left exactly as they are. A negative shift goes backwards, so -3 is the same as 23. Shifts beyond 25 add nothing, since a shift of 26 is a shift of 0.

Brute force. A Caesar cipher has only 25 useful keys, so the table decodes your text with every shift from 1 to 25. Each line is scored with a chi-squared statistic: for each letter A to Z take (observed count - expected count) squared, divide by the expected count, and add the 26 results. The expected count is the number of letters in the text times that letter's share of English text (E 12.702%, T 9.056%, A 8.167% and so on, from Lewand's table). The smallest total looks most like English and is marked. With under 20 letters the ranking is too weak to trust and the page says so, and a message in another language will not match English frequencies.

History. Suetonius writes in his Life of Julius Caesar (chapter 56) that for confidential letters Caesar wrote in cipher, rearranging the letters so that no word could be made out, and that a reader had to put the fourth letter, D, for A and the rest likewise. That is a shift of 3. In the Life of Augustus (chapter 88) Augustus used a shift of one and wrote AA for X. Frequency analysis, the idea behind the score above, is traced by Wikipedia to the ninth-century scholar al-Kindi.

Security. A Caesar cipher is not encryption you should rely on. With 25 keys it can be broken by hand in minutes and by a computer instantly, and the spaces and punctuation it leaves in place help the attacker. Use it for puzzles, teaching and hiding spoilers. For anything private use a modern, reviewed cipher such as AES (FIPS 197) in a tool built for the purpose.

The alphabet shifted by 3 (Caesar) and by 13 (ROT13):
| Plain letter | Shift of 3 | Shift of 13 (ROT13) |
| --- | --- | --- |
| A | D | N |
| B | E | O |
| C | F | P |
| D | G | Q |
| E | H | R |
| F | I | S |
| G | J | T |
| H | K | U |
| I | L | V |
| J | M | W |
| K | N | X |
| L | O | Y |
| M | P | Z |
| N | Q | A |
| O | R | B |
| P | S | C |
| Q | T | D |
| R | U | E |
| S | V | F |
| T | W | G |
| U | X | H |
| V | Y | I |
| W | Z | J |
| X | A | K |
| Y | B | L |
| Z | C | M |

Q: What shift did Julius Caesar use?
A: A shift of three. Suetonius, in his Life of Julius Caesar (chapter 56), says that to read Caesar's ciphered letters you put the fourth letter of the alphabet, D, for A, and the remaining letters likewise. A to D is a move of three places.

Q: What is ROT13 and why is it its own inverse?
A: ROT13 is the Caesar cipher with a shift of 13. The English alphabet has 26 letters, so shifting by 13 twice moves every letter 26 places, which is all the way round. One operation therefore encodes and decodes. It is used to hide spoilers and punchlines, not to keep secrets.

Q: How do I decode a Caesar cipher when I do not know the shift?
A: Try all 25 shifts and read the results, which the brute-force table does for you. It marks the line whose letter frequencies are closest to English by chi-squared score. For a sentence of about 50 letters or more that is almost always the right line; for under 20 letters the tool says the ranking is weak, so read the 25 lines yourself.

Q: How many possible keys does a Caesar cipher have?
A: Twenty-five that change the text. A shift of 0 leaves it unchanged, and a shift of 26 is the same as 0, so the English alphabet gives shifts 1 to 25. That small number is why the cipher is so easy to break.

Q: Is the Caesar cipher secure?
A: No. Anyone can try all 25 shifts in seconds, and the word lengths and punctuation it keeps give more clues. Treat it as a puzzle or a teaching tool. For real secrecy use a modern cipher such as AES, defined in NIST FIPS 197, through a tool designed for it.

Q: Does it change numbers, punctuation and accented letters?
A: No. Only A to Z and a to z move. Digits, spaces, punctuation and letters outside the English alphabet pass through unchanged. Some other ciphers also rotate digits; this one does not.

Q: Why does the brute-force score need enough text?
A: Chi-squared compares the count of each letter with what English predicts. A handful of letters can match English by luck or fail to, so the tool says the ranking is weak under 20 letters. Longer text gives a clearer result.

Q: Is my text sent anywhere?
A: No. The shifting and the scoring happen in your browser and nothing is uploaded.

Sources: Suetonius, Life of Julius Caesar, chapter 56, Loeb translation (checked 13 October 2026) (https://penelope.uchicago.edu/Thayer/E/Roman/Texts/Suetonius/12Caesars/Julius*.html); Suetonius, Divus Iulius 56, Latin text (checked 13 October 2026) (https://www.thelatinlibrary.com/suetonius/suet.caesar.html); Suetonius, Life of Augustus, chapter 88, Loeb translation (checked 13 October 2026) (https://penelope.uchicago.edu/Thayer/E/Roman/Texts/Suetonius/12Caesars/Augustus*.html); English letter frequencies from Lewand, Cryptological Mathematics (2000), as reproduced by Wellesley College (checked 13 October 2026) (https://cs.wellesley.edu/~fturbak/codman/letterfreq.html); Wikipedia: Caesar cipher (checked 13 October 2026) (https://en.wikipedia.org/wiki/Caesar_cipher); NIST FIPS 197, Advanced Encryption Standard (checked 13 October 2026) (https://csrc.nist.gov/pubs/fips/197/final)

Related tools:

- [Morse code translator](https://hirantha.me/tools/morse-code-translator.md): Translate text to Morse code and Morse back to text with the ITU international characters. Play it as sound and see the timing chart.
- [Text to binary converter](https://hirantha.me/tools/text-to-binary.md): Turn text into binary, hexadecimal, octal or decimal bytes, and bytes back into text. UTF-8 aware, with an ASCII table and clear errors.
- [Base64 encode & decode](https://hirantha.me/tools/base64.md): Convert text to Base64 and back, right in your browser.
- [Hash generator](https://hirantha.me/tools/hash-generator.md): Generate a SHA-1, SHA-256, SHA-384, or SHA-512 hash of text.
- [Case converter](https://hirantha.me/tools/case-converter.md): Convert text to uppercase, lowercase, title case, or camelCase.
