Caesar Cipher

What is the Caesar cipher?

How it is calculated

Each ASCII letter is moved forward in the alphabet by the shift value, wrapping from z back to a. For a letter with alphabet position p (0–25), the output position is (p + shift) mod 26. Upper and lower case are handled separately and keep their case. The shift is reduced modulo 26 first, so 29 behaves like 3 and a negative shift such as -3 moves letters backwards, which is how you decode. Digits, spaces, punctuation and any non-ASCII characters are copied through unchanged. If the shift field is empty, 3 is used. Empty text gives no result.

Worked example

Take the text Hello 2026 with a shift of 3. H becomes K, e becomes h, l becomes o, l becomes o and o becomes r. The space and the digits 2026 are not letters, so they stay as they are. The result is Khoor 2026. To get the original back, run the result again with a shift of -3 (or 23).

Try this example →

Common mistakes

  • Expecting accented or non-English letters to shift: only A–Z and a–z are rotated, so letters like ç, ğ, ö or ü pass through untouched.
  • Decoding with the same positive shift instead of its opposite: if text was encoded with +5, decode with -5 or 21.
  • Entering a shift of 26 (or 0) and wondering why nothing changed: a full 26-letter turn returns every letter to itself.
  • Treating the output as secure: with only 25 usable shifts, the cipher is trivial to break by trying them all.
  • Forgetting that digits are not shifted, so numbers in the message stay readable.

About this calculator

This tool applies the Caesar cipher, one of the oldest known encryption methods (reportedly used by Julius Caesar for military messages), which shifts every letter in the text a fixed number of positions through the alphabet — a shift of 3 turns A into D, B into E, and so on, wrapping back to the start once it passes Z. Entering a negative shift reverses the process, decrypting text that was encrypted with the corresponding positive shift.

It's used today mainly for teaching the basic concepts of cryptography — substitution, key space and how easily a shift cipher can be broken by trying all 25 possible shifts or by frequency analysis — as well as for puzzles, escape rooms, and lightweight obfuscation where real security isn't the goal, since the cipher offers essentially none against a determined attacker.

Was this helpful?

You can pick up to 3 reactions.

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators