Encryption2026-06-20

What Is a Caesar Cipher? (with Decoder Examples)

A Caesar cipher shifts each letter by a fixed number of places. Learn how it works, how to encode and decode it, why ROT13 is a special case, and why it's easy to break.

ciphercaesar-cipherrot13cryptographyencoding

What Is a Caesar Cipher? (with Decoder Examples)

A Caesar cipher is a substitution cipher that shifts every letter in a message by a fixed number of positions in the alphabet. With a shift of 3, A becomes D and B becomes E. It's named after Julius Caesar, who used it for military messages, and it's one of the simplest encryption methods ever devised. ROT13 is just a Caesar cipher with a shift of 13.

It's easy to break, but it's the perfect first step into cryptography. Here's how it works.

How the Shift Works

Pick a shift number (the key) and move each letter forward by that amount, wrapping around from Z back to A:

Shift = 3
Plain:  H E L L O
Cipher: K H O O R

So "HELLO" with a shift of 3 becomes "KHOOR." Non-letters (spaces, numbers, punctuation) are usually left unchanged.

Plain A B C ... X Y Z
Shift 3 D E F ... A B C

Encoding vs Decoding

  • Encode: shift each letter forward by the key.
  • Decode: shift each letter backward by the same key (or forward by 26 − key).
Decode "KHOOR" with shift 3 → "HELLO"

Because there are only 25 possible shifts, you can decode a Caesar cipher even without the key by trying them all — more on that below.

ROT13: The Famous Shift-13 Variant

ROT13 ("rotate by 13") is a Caesar cipher with a shift of exactly 13. Because the alphabet has 26 letters, applying ROT13 twice returns the original text — encoding and decoding are the same operation:

ROT13("Hello") = "Uryyb"
ROT13("Uryyb") = "Hello"

ROT13 is widely used online to hide spoilers, punchlines, and puzzle answers — not for security, but to prevent accidental reading. Try it instantly in our ROT13 tool.

Why the Caesar Cipher Is Trivial to Break

The Caesar cipher offers essentially no security today, for two reasons:

  1. Brute force: there are only 25 non-trivial shifts. Try them all and the readable result is the answer — seconds of work.
  2. Frequency analysis: letter frequencies are preserved, just shifted. In English, the most common ciphertext letter is probably a shifted "E," instantly revealing the key.

This is why real encryption uses ciphers with astronomically large key spaces (see What Is a Cipher?).

Try It Yourself

Experiment with shifting text using our ROT13 tool for the classic shift-13, or use Text Encrypt/Decrypt for real encryption when you actually need security. For other letter/number transformations, see the ASCII Encoder/Decoder.

Frequently Asked Questions

What is a Caesar cipher? A substitution cipher that shifts every letter by a fixed number of positions in the alphabet, wrapping from Z back to A.

How does a Caesar cipher work? You choose a shift (the key) and move each letter forward by that amount to encode, and backward by the same amount to decode.

How do you decode a Caesar cipher? Shift each letter backward by the key. Without the key, just try all 25 shifts and pick the readable result.

What is ROT13? A Caesar cipher with a shift of 13. Applying it twice restores the original, so the same operation both encodes and decodes.

Is the Caesar cipher secure? No. With only 25 possible shifts, it falls instantly to brute force or frequency analysis. It's for fun and learning, not security.

Related Reading

The Caesar cipher won't protect anything from a motivated attacker, but it perfectly illustrates the core idea behind all encryption: a reversible transformation controlled by a key.