Caesar Cipher
Apply a Caesar cipher with a configurable shift. Letters rotate through the alphabet; everything else passes through.
positions (negative to decode)
About Caesar Cipher
The Caesar cipher is the simplest of the classical substitution ciphers: each letter is replaced with the letter that comes a fixed number of positions later in the alphabet. The shift wraps around (Z + 1 = A). Use shift 13 for the special case ROT13. To decode, use the negative shift (or shift 26 − original).
When to use it
- Teaching how substitution ciphers work
- Solving cryptography puzzles or CTF challenges
- Light obfuscation for fun (not security)
- Implementing classic Caesar variants like ROT5 for digits
How it works
Every ASCII letter in the input is shifted by N positions modulo 26. Uppercase and lowercase are preserved. Non-letter characters (digits, punctuation, spaces, non-Latin scripts) are passed through unchanged.
Examples
The classic shift-by-3 used by Julius Caesar
Hello (shift=3)
Khoor
Frequently asked questions
- How do I decode a Caesar-encoded message?
- Use the negative of the original shift, or 26 minus it (they're equivalent). A message encoded with shift 7 is decoded with shift -7 or shift 19.
- Is it secure?
- Not at all. There are only 25 possible shifts; brute-forcing takes seconds. It's a classroom tool, not a security mechanism.
- What's the difference from ROT13?
- ROT13 is the special case of Caesar cipher with shift=13. Because 13+13=26, ROT13 is its own inverse.