EthicalFusion

Caesar Cipher

Encrypt or decrypt text with a Caesar shift cipher.

Was this tool helpful?

Thanks for the feedback!

The Caesar Cipher tool shifts every letter of your message a fixed number of places along the alphabet. Put the number in the Shift box (3 by default), paste your text, and press Apply cipher. A negative shift moves letters backwards, which is how you decrypt a message that was encrypted with a positive one.

The shift, written as a formula

Number the letters A = 0 to Z = 25. Encryption with key k is E(x) = (x + k) mod 26 and decryption is D(x) = (x − k) mod 26. The "mod 26" part makes the alphabet wrap around, so with a shift of 3, X becomes A, Y becomes B and Z becomes C. The tool normalises the key the same way: a shift of 29 behaves like 3, a shift of −3 behaves like 23, and 26 leaves the text unchanged.

PlainA B C … W X Y Z
Shift 3D E F … Z A B C

A worked example

With a shift of 3, the sentence "Meet me at India Gate at 7 PM" becomes:

Phhw ph dw Lqgld Jdwh dw 7 SP

Notice what stays the same: capital letters remain capitals, lowercase stays lowercase, and the space, the digit 7 and any punctuation pass through untouched. Only the 26 English letters move; accented letters and non-Latin scripts such as Devanagari are left as they are. Paste the encrypted line back in with a shift of −3 and the original sentence returns.

Why the Caesar cipher is easy to break

The Roman historian Suetonius wrote that Julius Caesar used a shift of three for private letters. Against anyone today it offers no protection, for two reasons:

  1. Only 25 useful keys. An attacker can try every shift from 1 to 25 in a minute and stop at the one that produces readable words. You can do the same with this tool by changing the Shift value.
  2. Letter frequencies survive. E is the most common letter in English text. If the ciphertext is long and H appears most often, the shift is probably 3, because E + 3 = H.

Short words give it away too: a lone encrypted letter is almost always "a" or "I" in the original.

Good uses for it

  • Teaching modular arithmetic and the idea of a key in maths or computer science lessons.
  • Treasure hunts, escape rooms and puzzle clues where the solver is meant to crack it.
  • Checking the output of your own Caesar program when practising Python, Java or C.
  • Hiding spoilers or answers casually, the way a shift of 13 is used online; the ROT13 Encoder does that fixed shift in one click.

For anything that must actually stay secret, use real encryption, and for strong random secrets use the Password Generator rather than a shifted word.

Frequently asked questions

How do I decrypt a Caesar cipher message?
Enter the same number with a minus sign in the Shift box, for example -3 if it was encrypted with 3. Shifting forward by 26 minus the key, here 23, gives the same result.
What shift did Julius Caesar use?
According to Suetonius, a shift of three, so A was written as D.
Does the cipher change numbers and punctuation?
No. Only the letters A to Z are shifted, with their case kept. Digits, spaces, symbols and non-English characters stay exactly as typed.
How can I crack a Caesar cipher if I don't know the key?
Try each shift from 1 to 25 and look for readable words, or find the most common letter and assume it stands for E.
Is a shift of 13 the same as ROT13?
Yes. ROT13 is simply a Caesar cipher with a shift of 13, and applying it twice returns the original text.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.