Free Caesar Cipher Encoder & Decoder
Encode and decode messages with the classic Caesar shift cipher right in your browser. Choose any shift from 0 to 25, flip on the ROT13 preset, and the result updates live with case preserved and punctuation untouched.
Mapping (encode, shift 3):
Quick answer
A Caesar cipher shifts every letter a fixed number of places down the alphabet. To encode, move each letter forward by the shift (so with shift 3, A becomes D); to decode, move each letter back by the same amount. This tool does both: type your text, set a shift of 0-25 (or click ROT13 for shift 13), and it transforms the text instantly while leaving spaces, digits, and punctuation unchanged.
Formula & method
Each letter is converted to its position in the alphabet (A=0 ... Z=25). For encoding, the tool adds the chosen shift and wraps around using modulo 26, so Z + 1 returns to A. For decoding it subtracts the shift instead. Uppercase and lowercase letters are shifted within their own range so case is preserved, and any character that is not an A-Z letter (spaces, numbers, punctuation, symbols) is copied through unchanged. ROT13 is simply a Caesar cipher with a shift of 13; because 13 is half of 26, applying it twice returns the original text, which is why the same operation both scrambles and unscrambles.
Examples
- Input
- Text: ABC, Mode: Encode, Shift: 3
- Result
- DEF
- Why
- A→D, B→E, C→F. Each letter moves three places forward, the textbook Caesar shift Julius Caesar reportedly used.
- Input
- Text: KHOOR, Mode: Decode, Shift: 3
- Result
- HELLO
- Why
- Decoding subtracts the shift: K→H, H→E, O→L, O→L, R→O, recovering the original word HELLO.
- Input
- Text: Hello, Mode: Encode, Shift: 13 (ROT13)
- Result
- Uryyb
- Why
- With shift 13, H→U, e→r, l→y, l→y, o→b. Note the case is kept; running ROT13 again on "Uryyb" returns "Hello".
- Input
- Text: Attack at dawn!, Mode: Encode, Shift: 5
- Result
- Fyyfhp fy ifbs!
- Why
- Letters shift by 5 while the space and the exclamation mark pass through unchanged, and lowercase stays lowercase.
- Input
- Text: Zebra, Mode: Encode, Shift: 1
- Result
- Afcsb
- Why
- Z is the last letter, so a shift of 1 wraps it back to A. The rest follow normally: e→f, b→c, r→s, a→b.
When to use this tool
- Solving or creating puzzle and escape-room clues, where a simple letter shift is the intended challenge.
- Teaching or learning the basics of cryptography, modular arithmetic, and how substitution ciphers work.
- Quickly reading or writing ROT13 text used on forums and in tech culture to hide spoilers, punchlines, or answers.
- Lightly obfuscating non-sensitive text such as a hint or trivia answer you do not want read at a glance.
- Checking homework or CTF (capture-the-flag) challenges that involve a classic shift cipher.
Common mistakes
- Forgetting that case and non-letters are preserved. The cipher only moves A-Z letters, so spaces, digits, and punctuation stay exactly where they are and uppercase stays uppercase.
- Using the wrong direction. Encoding with shift 3 and then decoding with shift 3 (not shift 23) reverses it. If you accidentally encode twice instead of decoding, the text gets shifted further, not restored.
- Expecting real security. A Caesar cipher has only 25 possible keys, so anyone can break it by trying every shift. It is great for puzzles and learning but should never protect sensitive data.
- Confusing ROT13 with a separate algorithm. ROT13 is just a Caesar cipher with shift 13; you decode it by applying ROT13 again, not by switching to a different mode.
- Assuming a shift of 26 (or 0) changes the text. A shift of 0 or any multiple of 26 maps every letter to itself, so the output equals the input.
Frequently asked questions
What is a Caesar cipher?
It is one of the oldest known encryption methods, named after Julius Caesar, who used it to protect military messages. Each letter in the text is replaced by a letter a fixed number of positions later in the alphabet. The fixed number is the key, also called the shift.
How do I decode a Caesar cipher if I do not know the shift?
Because there are only 25 possible shifts, you can brute-force it: try each shift from 1 to 25 and see which one produces readable text. Set this tool to Decode and step the shift through every value, or watch the alphabet-mapping preview until the output makes sense.
What is ROT13 and how is it related?
ROT13 is a Caesar cipher with a shift of exactly 13. Since the alphabet has 26 letters, shifting by 13 twice brings every letter back to where it started, so the same operation both encodes and decodes. Click the ROT13 preset to set shift 13 instantly.
Does the tool keep uppercase, lowercase, and punctuation?
Yes. Uppercase letters stay uppercase and lowercase stay lowercase because each is shifted within its own range. Spaces, numbers, and punctuation are not letters, so they are passed through unchanged.
Is the Caesar cipher secure?
No. With only 25 keys it can be broken instantly by trying every shift, and longer texts can be cracked by frequency analysis. Use it for puzzles, education, and casual obfuscation, never for passwords or confidential information.
Is my text sent to a server?
No. The entire encoding and decoding runs locally in your browser using JavaScript. Your text never leaves your device, so it is safe to use offline and with private content for puzzle purposes.
What shift did Julius Caesar actually use?
According to the Roman historian Suetonius, Caesar shifted letters by three places, which is why a shift of 3 is often called the classic Caesar cipher. You can reproduce it with the "Classic (3)" preset.
Sources & references
External references open in a new tab. We are independent and not affiliated with these organizations.
- ✓ Free to use
- ✓ No sign-up required
- ✓ Runs entirely in your browser — nothing is uploaded.
- ✓ Formula and method shown above
Provided “as is” for general information only — results may be inaccurate, so verify before you rely on them. No warranty; use at your own risk.
Built and reviewed by HIFreeTools against the formula shown above and any authoritative references cited on this page. See our methodology and editorial standards.
Related tools
- Text Case ConverterText
- Base64 Encoder & DecoderDeveloper
- URL Encoder & DecoderDeveloper
- Password GeneratorSecurity
- Word CounterText
- Character CounterText
Embed this tool on your site
Free to embed, no sign-up. Paste this code where you want the caesar cipher encoder/decoder to appear: