RevealTheme logo

Caesar Cipher Encoder & Decoder

Encode or decode text with a Caesar cipher by shifting each A-Z letter a fixed number of positions. Only English letters are transformed; everything else passes through untouched.

How to use this tool

  1. 1

    Type or paste your message into the text area.

  2. 2

    Drag the Shift slider to pick a key from -25 to +25; the default is 3.

  3. 3

    Read the transformed text in the gray output box, which updates instantly as you type or move the slider.

  4. 4

    To decode a message, set the shift to the negative of the value used to encode it (for example, use -3 to undo a +3 shift).

What is a Caesar cipher and how does this tool shift letters?

The Caesar cipher is a substitution cipher named after Julius Caesar, who reportedly used it for military messages around 50 BC. Each letter moves a fixed number of positions through the 26-letter English alphabet, wrapping around from Z back to A. This tool implements exactly that with a regular expression that matches only [a-zA-Z]. Uppercase and lowercase are handled separately so case is always preserved, and the math uses modular arithmetic — ((code + shift) mod 26) — that correctly wraps in both directions, so a negative shift simply decodes. Because the pattern only touches ASCII letters A through Z, digits, spaces, punctuation, emoji, and accented or non-Latin characters (such as é, ñ, or Cyrillic) pass straight through unchanged. There is no separate encrypt or decrypt button: encoding with shift n and decoding with shift -n are the same operation. Note that this is a teaching and puzzle tool, not real security. With only 25 distinct keys, a Caesar cipher is broken in seconds by trying every shift (brute force) or by frequency analysis, so never use it to protect anything sensitive.

Common use cases

  • Teaching cryptography basics in a classroom by letting students watch each letter shift in real time.

  • Solving or creating Caesar-cipher puzzles in escape rooms, ARGs, and CTF challenges.

  • Decoding ROT13 text from forums or email by setting the shift to 13 or -13.

  • Brute-forcing an unknown shift: scrub the slider through all 25 values until readable text appears.

  • Generating lightly obfuscated spoiler text or hint answers that readers must shift back to reveal.

  • Prototyping and debugging encode/decode logic before wiring up a stronger cipher in your own code.

Frequently asked questions

What is a shift of 13?
A shift of 13 is ROT13, a self-inverse special case: because 13 is exactly half of 26, applying the same shift of 13 a second time returns the original text. That is why ROT13 is often used to hide spoilers.
How do I decode a message?
Set the shift to the negative of the value used to encode it. If a message was encoded with +5, drag the slider to -5. The modular arithmetic wraps correctly, so a shift of +21 produces the same result as -5.
Why are my numbers, spaces, and symbols unchanged?
The tool only transforms English letters A-Z (matched by the regex [a-zA-Z]). Digits, punctuation, whitespace, emoji, and accented or non-Latin characters like é, ñ, or Cyrillic are deliberately left as-is, which keeps the text readable and reversible.
Is the Caesar cipher secure?
No. With only 25 possible keys it offers essentially zero security and is trivially broken by brute force or letter-frequency analysis. Treat it as a learning aid or puzzle tool, not encryption. For real protection use a modern algorithm such as AES.
Does case get preserved?
Yes. Uppercase and lowercase letters are shifted on their own ranges, so 'Hi' with a shift of 1 becomes 'Ij' — the capital stays capital and the lowercase stays lowercase.
Is my text uploaded anywhere?
No. All shifting happens locally in your browser using JavaScript. Your input is never sent to a server, so you can use the tool offline and with private text.
What is the maximum shift, and what about shifts over 25?
The slider ranges from -25 to +25. Because the alphabet has 26 letters, a shift of 26 would map every letter back to itself, so 25 in either direction covers every distinct Caesar key.

Related tools