Caesar Cipher Calculator

The Caesar cipher shifts every letter a fixed number of places along the alphabet, wrapping around from Z to A. It is one of the simplest ciphers and a classic introduction to cryptography, but with only 25 keys it offers no real security. Enter your text, choose a shift from 0 to 25, and select encode or decode. The calculator preserves letter case and leaves digits, spaces and punctuation untouched, and it reports how many letters were shifted. Set the shift to 13 for ROT13.

-
0
0

Caesar cipher formula

for each letter c with 0-based index i in A..Z:
encode: i' = (i + shift) mod 26
decode: i' = (i - shift + 26) mod 26
non-letters pass through unchanged; case preserved

The shift is taken modulo 26, so a shift of 29 behaves like 3. Encoding and decoding are inverse operations with the same key. ROT13 uses shift 13 and is its own inverse.

Caesar cipher context

  • Only 25 useful keys exist, so brute force breaks it instantly.
  • Letter-frequency analysis reveals the shift on ordinary text.
  • It is a substitution cipher: each plaintext letter maps to one ciphertext letter.
  • ROT13 (shift 13) is symmetric: applying it twice restores the original.
  • For real confidentiality, use a modern standard such as AES, never a Caesar cipher.

Caesar cipher: frequently asked questions

What is the Caesar cipher?

The Caesar cipher is a substitution cipher that shifts each letter a fixed number of places along the alphabet, wrapping from Z back to A. A shift of 3 turns A into D, B into E, and so on. It is named after Julius Caesar and is one of the oldest known ciphers.

How do I decode a Caesar cipher?

Decoding shifts in the opposite direction by the same amount. If text was encoded with shift 3, decode with shift 23 (which is 26 minus 3), or simply select decode mode and enter the same shift. This calculator handles both directions.

Is the Caesar cipher secure?

No. With only 25 possible shifts, an attacker can try every key in seconds (a brute-force attack), and letter-frequency analysis breaks it instantly on normal text. It is a teaching example, never a real security tool. Use modern algorithms like AES for real protection.

Does it change numbers, spaces and punctuation?

No. Only the 26 letters A to Z are shifted; digits, spaces and punctuation pass through unchanged. Letter case is preserved, so uppercase stays uppercase and lowercase stays lowercase.

What is ROT13?

ROT13 is the Caesar cipher with a shift of 13. Because 13 is half of 26, applying ROT13 twice returns the original text, so the same operation both encodes and decodes. Set the shift to 13 here to use ROT13.

Official sources

Reviewed by the CalculatorHub team, edited by James Graham, 17 June 2026. See our methodology.