Caesar Cipher
Shift-cipher with adjustable rotation
A Caesar cipher shifts every letter a fixed number of places along the alphabet. With a shift of three, A becomes D and Z wraps around to C; non-letters are left alone. Named after the substitution Suetonius describes Julius Caesar using for his correspondence, it is the simplest substitution cipher there is, and the one every introduction to cryptography starts with.
Its weakness is also what makes it useful for teaching: there are only twenty-five distinct shifts, so trying all of them takes no time at all. That is exactly what the brute-force view here does — it prints every rotation at once so you can pick out the readable one. ROT13, the shift of thirteen used on old forums to hide spoilers, is its own inverse: applying it twice returns the original text.
How to use it
- Paste your messageLetters are shifted and their case is preserved; digits, spaces and punctuation pass through untouched.
- Set the shiftChoose any rotation from 1 to 25, or jump straight to 13 for ROT13. Encoding with a shift of n and decoding with a shift of 26 minus n are the same operation.
- Or brute-force itIf you are trying to read something and do not know the key, the brute-force view lists all twenty-five candidate plaintexts at once. The right one is normally obvious at a glance.
Frequently asked questions
Is a Caesar cipher secure?
Not in any meaningful sense. Twenty-five possible keys can be tried by hand in under a minute, and frequency analysis breaks it even faster on a longer message. Treat it as a puzzle, a teaching example or a way to lightly obscure a spoiler — never as protection for anything that matters.
What is ROT13 and why is it special?
ROT13 is a Caesar cipher with a shift of thirteen. Because thirteen is exactly half of twenty-six, encoding and decoding are the same operation: run ROT13 on ROT13 output and you get your original text back. That symmetry is why it became the convention for hiding punchlines and spoilers in plain text.
How do I decode a message when I do not know the shift?
Use the brute-force view. Twenty-five rotations is a small enough space that scanning the list for a line of readable English is faster than any cleverer approach. For longer texts, letter frequency gives it away too — E is the most common letter in English, so whichever shift maps the most frequent ciphertext letter onto E is usually correct.
What happens to numbers and punctuation?
They are left exactly as they are. The classic cipher is defined only over the twenty-six letters, so shifting digits would be an invention rather than the algorithm. That does leak information — sentence shape and number placement survive the encryption — which is another reason it offers no real secrecy.
How is this different from a substitution cipher in general?
A Caesar cipher is a substitution cipher with a very particular restriction: the mapping must be a rotation, so one number describes it completely. A general monoalphabetic substitution can map each letter to any other, giving a vastly larger key space — though frequency analysis still breaks it on enough text.