Skip to content
K Knidox Search…
Computer Science · Ciphers

Caesar Cipher

Encode or decode a Caesar shift cipher — including ROT13 — with letters wrapped and everything else left as is.

Direction
Encoded
KHOOR
All 25 shifts

Don’t know the key? Scan the rows below for the one that reads as plain text — that shift is the cipher’s key.

  • 1GDKKN
  • 2FCJJM
  • 3EBIIL
  • 4DAHHK
  • 5CZGGJ
  • 6BYFFI
  • 7AXEEH
  • 8ZWDDG
  • 9YVCCF
  • 10XUBBE
  • 11WTAAD
  • 12VSZZC
  • 13URYYB
  • 14TQXXA
  • 15SPWWZ
  • 16ROVVY
  • 17QNUUX
  • 18PMTTW
  • 19OLSSV
  • 20NKRRU
  • 21MJQQT
  • 22LIPPS
  • 23KHOOR
  • 24JGNNQ
  • 25IFMMP
Try a preset

A Caesar cipher shifts every letter forward by a fixed key from 0 to 25, wrapping A–Z and a–z around and leaving spaces, digits, and punctuation unchanged. With shift 3, HELLO becomes KHOOR; decoding shifts back to recover HELLO. ROT13 is the special case shift 13, which is its own inverse.

What a Caesar cipher is

The Caesar cipher is one of the oldest known substitution ciphers, named after Julius Caesar, who used it to protect military messages. It replaces each letter with the one a fixed number of positions later in the alphabet. That fixed number is the key, or shift. The rule is simply “move each letter forward by n, and wrap from Z back to A” — for example, with a shift of 3, A → D, B → E, and Z → C. Non-letters such as spaces, numbers, and punctuation are copied through untouched, and uppercase and lowercase are shifted within their own ranges.

Encoding and decoding

Encoding adds the shift; decoding subtracts it. To reverse a message encoded with shift n, you can either subtract n or, equivalently, shift forward by 26 − n. So a message encoded with shift 3 is decoded by shifting back 3 (the same as shifting forward 23). Because the alphabet has 26 letters, shifting by 0 or by 26 leaves the text unchanged.

  1. 1
    Choose Encode or Decode. Encode scrambles plain text; Decode reverses a shifted message back to plain text.
  2. 2
    Set the shift (0–25). Pick your key. The classic Caesar cipher uses 3; ROT13 uses 13.
  3. 3
    Type or paste your text. Enter HELLO. Only letters are shifted — spaces and punctuation pass through.
  4. 4
    Read the result. With Encode and shift 3, each letter moves forward three places: H → K, E → H, L → O, L → O, O → R, giving KHOOR.
  5. 5
    Reverse it to check. Switch to Decode with the same shift 3 and paste KHOOR to get HELLO back.

How a shift of 3 maps the alphabet

Each letter moves forward three places and wraps at the end. ROT13 (shift 13) is shown for comparison.

PlainShift 3ROT13 (shift 13)
ADN
BEO
CFP
HKU
XAK
YBL
ZCM

Why it is easy to break

A Caesar cipher has only 25 useful keys (a shift of 0 changes nothing), so an attacker can simply try all of them and read whichever result makes sense — a brute-force attack that takes seconds. Even without trying every key, frequency analysis reveals the shift quickly: because each letter always maps to the same substitute, the most common letter in the ciphertext usually corresponds to E in English. For these reasons the Caesar cipher is a teaching tool and a puzzle, not real security. ROT13, the shift-13 variant, is popular precisely because it is its own inverse — applying it twice returns the original text — so it is used to lightly obscure spoilers and puzzle answers rather than to protect anything.

What is ROT13?
ROT13 is a Caesar cipher with a shift of 13. Because 13 is exactly half of 26, encoding and decoding are the same operation — applying ROT13 twice returns the original text. It is used to hide spoilers and puzzle answers, not to secure data.
Is the Caesar cipher secure?
No. With only 25 possible keys it can be brute-forced in seconds, and frequency analysis exposes the shift almost as fast. Treat it as a learning exercise or a puzzle, never as protection for real secrets.
How do I decode a message if I don’t know the shift?
Try all 25 shifts and pick the one that produces readable text — that is a brute-force attack. Alternatively, use frequency analysis: the most common ciphertext letter is often E, and the gap between them reveals the key.
Does it change numbers, spaces, or punctuation?
No. Only the 26 letters A–Z and a–z are shifted. Digits, spaces, and punctuation pass through unchanged, and uppercase and lowercase are each wrapped within their own range.
Why does HELLO become KHOOR with shift 3?
Each letter moves forward three places in the alphabet: H → K, E → H, L → O, L → O, and O → R. Put together that spells KHOOR. Decoding with shift 3 reverses each step back to HELLO.
What is the difference between the Caesar cipher and the Vigenère cipher?
The Caesar cipher uses a single fixed shift for the whole message, so every letter moves by the same amount. The Vigenère cipher uses a repeating keyword to vary the shift letter by letter, which makes it much harder to break.