Home Text ToolsCaesar Cipher

Caesar Cipher

Encode or decode text with a Caesar shift cipher.

Khoor Zruog
ResultKhoor Zruog
Shift used3

The Caesar cipher shifts each letter a fixed number of places in the alphabet — one of the oldest known ciphers. Choose a shift to encode; to decode, use 26 minus that shift. Great for puzzles and learning how substitution ciphers work.

Formula / method

shift each letter by N positions (wraps around the alphabet)

Examples

Hello, shift 3
Khoor
Khoor, shift 23
Hello

The shift cipher explained

A Caesar cipher replaces each letter with one a fixed number of places later in the alphabet. With a shift of 3, A becomes D and Z wraps around to C. To decode, you shift back by the same amount, so encoding with shift 3 and decoding with shift 23 give the same result because the alphabet has 26 letters. This tool leaves spaces, digits, and punctuation untouched and preserves upper and lower case.

A shift of 13 is the well-known ROT13: applying it twice returns the original text, which is why the same button both scrambles and unscrambles it.

Fun, not security

Because there are only 25 useful shifts, a Caesar cipher is trivial to break by trying each one, so never use it to protect real secrets. It is best for puzzles, classroom demos of how substitution ciphers work, lightly hiding spoilers, or generating ROT13 forum posts.

If you need to obscure text for transport rather than to puzzle a reader, an encoding like Base64 is a better fit, and for genuine confidentiality you need modern encryption, which no client-side toy cipher can provide.

Where it's used

  • Solving or setting puzzle and escape-room clues
  • Teaching how substitution ciphers work in a classroom
  • Generating ROT13 text to hide spoilers or answers
  • Lightly obscuring a forum post's punchline
  • Homework and capture-the-flag (CTF) exercises on classic ciphers

Real-world examples

  • "Hello" with a shift of 3 becomes "Khoor"; shifting the result by 23 restores "Hello".
  • ROT13 (shift 13) turns "Spoiler" into "Fcbvyre"; running ROT13 again turns it back.
  • A shift of 3 on the word "FOX" gives "IRA", and reversing the shift recovers "FOX".

A bit of history

The cipher is named after Julius Caesar, who according to the Roman historian Suetonius used it with a shift of three — writing D for A, E for B, and so on — to protect his military correspondence.

Did you know?

A shift of 13, known as ROT13, is its own inverse: applying it twice returns the original text, which made it a popular way to hide spoilers and punchlines on early Usenet newsgroups.

FAQ

How do I decrypt a message?

Apply the cipher again with the opposite shift. If it was encoded with shift 3, decode with shift 23 (26 − 3). ROT13 is just a Caesar cipher with shift 13.

Related tools