Caesar Cipher Encoder and Decoder

Shift the letters of a message forward to encode a Caesar cipher or back to decode it, then use Show all 25 shifts to read a message when you do not know the key. The tool is free and runs in your browser.

Caesar Cipher Encoder and DecoderPrivate · runs on your device
Input
Words 0Characters 0Lines 0
Result

Example: Hello → Khoor

How to use the Caesar cipher tool

The result updates as you type, so you can adjust the key and watch the text change.

  1. Type or paste your message into the Input box.
  2. Set Shift to a number from 1 to 25. The default is 3, the value traditionally linked to Julius Caesar.
  3. Set Mode to Encode to move letters forward, or Decode to move them back by the same amount.
  4. Tick Show all 25 shifts when you have a message but not the key. The output lists Shift 1: to Shift 25:, each line being your input decoded with that shift. This view ignores the Mode and Shift settings.
  5. Copy the result, download it, or press Use as input.

Only the letters A to Z and a to z move, and each keeps its case. Spaces, digits, punctuation and accented letters pass through unchanged.

The method, with a worked example

Number the letters A = 0 to Z = 25. Encoding adds the shift and wraps round modulo 26; decoding subtracts it. With a shift of 3 the alphabet lines up like this:

PlainABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherDEFGHIJKLMNOPQRSTUVWXYZABC

So Hello becomes Khoor, with H moving to K and o moving to r. Decoding Khoor, Zruog 123 with shift 3 gives Hello, World 123. Wrapping matters near the end of the alphabet: XYZ becomes ABC, and Attack at dawn with shift 5 becomes Fyyfhp fy ifbs. Decoding with shift k is the same as encoding with 26 minus k, so Decode with 3 matches Encode with 23, and a shift of 13 is ROT13, covered by the ROT13 tool.

Reading a message when the key is unknown

With only 25 possible keys the quickest attack is to try them all, which is what Show all 25 shifts does. Paste Khoor and one line reads Shift 3: Hello while the rest are nonsense. Longer messages make the right line obvious. Very short ones can produce more than one plausible word, so look at the context.

A fuller example: paste Wkh txlfn eurzq ira, tick the box, and the line Shift 3: The quick brown fox is the only readable one. The number in that line is the decode shift, so you can switch the box off, set Shift to 3 and Mode to Decode to get the same text on its own.

When no tool is at hand, count letters. In English the commonest letter is E, so the most frequent letter in a long ciphertext probably stands for E, and the distance between them is the shift. One-letter words are nearly always A or I, and a three-letter word that keeps recurring is often THE. Frequency analysis was described by Arab scholars in the ninth century, so this cipher has been breakable for over a thousand years. Treat it as a puzzle or teaching device, never as protection for anything that matters.

Limits and where to go next

The tool works on the 26 English letters only. Greek, Cyrillic and accented letters are left alone, and leaving spaces and punctuation visible gives a cracker extra clues. It does not support a keyword, so there is no Vigenere cipher, and it cannot apply different shifts to different words.

One more detail: the tool shifts by whole letters, so the result never lengthens or shortens the message, and word lengths survive. That is convenient for puzzles but is also a weakness, since a cracker can use word shapes.

You can also do the cipher without any tool. Write the alphabet on two strips of paper and slide the lower strip three places to the left; each top letter now sits above its cipher letter. That picture explains why the whole key is a single number, the offset between the strips.

Caesar shifts suit classroom exercises, escape-room clues, geocaching hints and tests for a programming assignment. For a different look, the Morse code translator turns text into dots and dashes, and the binary translator shows the same text as bytes.

Quick answers

Frequently asked questions

The questions people ask most, answered in plain words.

How do I decode a Caesar cipher without knowing the shift?

Tick Show all 25 shifts. The tool lists your text decoded with every shift from 1 to 25, and the correct one will be the only line that reads as normal language. Alternatively, assume the most common ciphertext letter stands for E to estimate the shift.

What shift did Julius Caesar use?

According to the Roman historian Suetonius, Caesar shifted each letter three places, so A became D. That is the tool default. Any shift from 1 to 25 is called a Caesar cipher today, and a shift of 13 is the special case known as ROT13.

Is the Caesar cipher secure?

No. There are only 25 possible keys, so anyone can try them all in seconds, and frequency analysis breaks it even faster on longer texts. It suits puzzles and teaching. Never use it to protect passwords, personal details or anything else you need to keep private.

What happens to numbers and punctuation in a Caesar cipher?

This tool leaves them unchanged. Only the letters A to Z and a to z are shifted, and each keeps its original case. Spaces, digits, punctuation, symbols and accented letters pass straight through, so the structure of the message stays visible.

What is the difference between a Caesar cipher and ROT13?

ROT13 is a Caesar cipher with the shift fixed at 13. Because 13 is half of 26, applying it twice returns the original, so one operation both encodes and decodes. A general Caesar shift needs the opposite direction to decode.