Caesar Cipher

Encode and decode Caesar cipher messages, or crack them.

Caesar Cipher tool

About the Caesar Cipher

The Caesar cipher replaces each letter with one a fixed number of places along the alphabet, and it remains a favorite for teaching cryptography and setting puzzles. This tool encrypts and decrypts with any shift from 1 to 25 while keeping capital letters, spaces and punctuation in place: with a shift of 3, HELLO becomes KHOOR. To break an unknown message, it lists all 25 possible shifts so the readable one stands out. It is for learning and fun, not real security.

Encrypting moves each letter forward by the shift, wrapping from Z back to A; decrypting moves it back by the same amount, which is the same as shifting forward by 26 minus the shift. Because there are only 25 useful keys, a Caesar cipher offers no real security: anyone can try them all, as the brute-force table does, and pick the line that reads as English. ROT13 is simply the Caesar cipher with a shift of 13.

Example: with a shift of 3, Hello, World! becomes Khoor, Zruog!, and decoding Khoor, Zruog! with shift 3 gives Hello, World! again. In the table of all shifts, the readable line appears at shift 3.

For a stronger classical cipher, try the Vigenère cipher, which uses a keyword. The ROT13 tool covers the shift-13 special case, the Atbash cipher reverses the alphabet, and for real secrecy use text encryption with AES.

How to use the Caesar Cipher

  1. Choose encode or decodeEncrypt plain text, or decrypt a Caesar message.
  2. Set the shiftFrom 1 to 25; Caesar's own shift was 3.
  3. Type or paste the textCase, digits and punctuation are kept.
  4. Crack unknown shiftsRead the table of all 25 shifts and find the readable one.

Caesar Cipher features

  • Any shift from 1 to 25
  • Encrypt and decrypt
  • Keeps upper and lower case
  • Leaves digits, spaces and punctuation
  • All 25 shifts for brute force
  • Swap direction in one click
  • Instant results

Common uses

  • Puzzles, escape rooms and geocaching
  • Teaching cryptography basics
  • Secret notes for fun
  • Solving cipher challenges
  • History of codes lessons

The Caesar cipher in practice: a treasure hunt clue, the arithmetic behind it, frequency analysis, a programming exercise and its place in history

By the FreeToolsWorld editorial team · Updated November 2026 · How we write and check our guides

The Caesar cipher is the classic first cipher: simple enough to do on paper, weak enough to break in minutes and rich enough to teach modular arithmetic, programming and the basic idea of cryptanalysis. This guide encrypts a treasure hunt clue, explains the arithmetic, shows how frequency analysis breaks the cipher without trying every key, sets out a programming exercise and places the cipher in its history.

A worked example: a treasure hunt clue

A teacher organising a school treasure hunt writes the clue MEET AT LIBERTY CHOWK and encrypts it with a shift of 7, producing TLLA HA SPILYAF JOVDR. Teams receive the ciphertext and a hint that the shift equals the number of days in a week. Decrypting with shift 7, or encrypting with shift 19, which is 26 minus 7, restores the clue.

The arithmetic

Number the letters from A as 0 to Z as 25. Encryption adds the shift and wraps around using remainders after dividing by 26: P is 15, plus 7 is 22, which is W. For Y, 24 plus 7 is 31, and 31 minus 26 is 5, which is F. Decryption subtracts the shift instead. This wrapping arithmetic, called modular arithmetic, is the same idea used in clocks and in modern cryptography.

Frequency analysis

Instead of trying every shift, a codebreaker can count letters. In English text, E is the most common letter, followed by T and A. In a long Caesar ciphertext, the most frequent letter is probably E shifted, so if L appears most often, the shift is likely 7. This technique was first described in the ninth century by the Arab scholar Al-Kindi, centuries before it became standard in Europe.

A programming exercise

Writing a Caesar cipher program is a favourite beginner exercise. The core loop converts each letter to its position, adds the shift, takes the remainder after dividing by 26 and converts back, keeping upper and lower case separate and leaving other characters unchanged. Good tests include a shift of 26, which should change nothing, a negative shift, which should decrypt, and text with punctuation and digits.

Variations for puzzles

Puzzle makers vary the cipher to keep it interesting: shifting by a different amount for each word, using the date as the shift or combining a shift with reversing the text. Each variation teaches a little more about how ciphers are built and broken, while remaining solvable by hand.

A little history

The Roman historian Suetonius recorded that Julius Caesar shifted letters by three, and that Augustus used a shift of one. The method protected messages mainly because few people could read at all, let alone suspect a cipher. Once literacy and mathematics spread, simple shifts offered almost no protection.

Other alphabets

The same idea works with any alphabet, including Urdu letters, as long as both sides agree on the order of the letters. With a longer alphabet there are more possible shifts, but frequency analysis still breaks the cipher easily, because letter frequencies in any language are uneven.

Why it is not for secrets

With only 25 useful shifts and obvious letter patterns, the cipher can be broken by anyone in minutes. Use it for games, lessons and puzzles, and use proper encryption, such as AES with a strong passphrase, for anything that must stay private.

Common mistakes

  • Forgetting to wrap from Z back to A.
  • Shifting digits and punctuation that should stay unchanged.
  • Using the Caesar cipher for real secrets.
  • Giving teams no hint about the shift in a timed game.

Related tools

To see the letter codes behind the arithmetic, use Text to ASCII Converter. To count letters for frequency analysis, try Character Counter, and for real protection, Encrypt Text Online.

A paper cipher wheel

Two paper circles of different sizes, each marked with the alphabet around the edge and pinned at the centre, make a cipher wheel. Turning the inner circle sets the shift, and reading across the two rings encrypts or decrypts any letter. Building one is a popular classroom activity that makes the wrap-around from Z to A obvious.

Two shifts are no better than one

Encrypting with a shift of 3 and then again with a shift of 5 gives exactly the same result as a single shift of 8. Combining Caesar ciphers therefore adds no security at all, which is a useful first lesson in why stacking weak methods does not create a strong one.

Very short messages

Frequency analysis needs enough text to reveal patterns. A message of a few letters may produce several readable results under different shifts, such as short words that happen to make sense either way. Puzzle makers should use longer messages, or give a hint, so there is only one sensible answer.

Privacy

Encryption and decryption run in your browser. Your text is not uploaded or stored.

Frequently asked questions

How does the Caesar cipher work?

Each letter is shifted a fixed number of places along the alphabet. With a shift of 3, A becomes D, B becomes E and Z wraps around to C. To decrypt, shift back by the same number.

What shift did Julius Caesar use?

According to the Roman historian Suetonius, a shift of 3: he replaced each letter with the one three places later. His successor Augustus reportedly used a shift of 1.

Is the Caesar cipher secure?

No. With only 25 possible keys it can be broken in seconds by trying them all, and letter frequencies also give it away. Use it for fun and teaching, not for secrets.

Does it change numbers and punctuation?

No. Only the letters A to Z are shifted, in upper or lower case. Digits, spaces, punctuation and accented letters stay exactly as they are.

What is the difference between Caesar and ROT13?

ROT13 is a Caesar cipher with a shift of 13. Because 13 is half of 26, applying it twice gives back the original, so the same operation encodes and decodes.

What is a shift of 26?

A shift of 26 brings every letter back to itself, so it does nothing. That is why only shifts 1 to 25 are useful, and why a shift of 23 decodes a shift of 3.

How is the Caesar cipher used today?

Mainly in puzzles, games, geocaches and teaching. It is a classic first example in cryptography courses, showing why keys must be hard to guess. ROT13, a Caesar shift of 13, still hides spoilers and puzzle answers online.

Can a Caesar cipher be broken without the key?

Yes, easily. There are only 25 possible shifts, so you can simply try them all, and this tool lists every shift below the result. Frequency analysis works too, because the most common letter in the ciphertext usually stands for E.