Caesar Cipher Encrypt / Decrypt

Encode or decode text using the classic Caesar shift cipher with a custom key.

Input

How It Works

The Caesar cipher is one of the simplest substitution ciphers, named after Julius Caesar who used it for military correspondence. Each letter in the plaintext is shifted a fixed number of positions down the alphabet. The formula is: E(x) = (x + n) mod 26 for encryption, and D(x) = (x − n) mod 26 for decryption, where x is the letter's position (0–25) and n is the shift key. Non-alphabetic characters such as spaces, numbers, and punctuation remain unchanged. The cipher preserves letter case. A shift of 3 (the historical default) turns A→D, B→E, and so on, wrapping Z back to A.

Frequently Asked Questions

What is a Caesar cipher used for?

The Caesar cipher is primarily used for educational purposes and simple puzzles. It introduces fundamental concepts of cryptography like substitution, modular arithmetic, and shift-based encoding. While not secure for modern communication, it remains popular in CTF challenges and recreational cryptography.

How do I decrypt a Caesar cipher without knowing the key?

You can brute-force all 25 possible shifts and visually inspect the results. English text patterns, common words, and letter frequency analysis help identify the correct shift. Tools like frequency analyzers can automate this process by matching the ciphertext's letter distribution against known English letter frequencies.

Does this tool handle uppercase and lowercase letters?

Yes, this tool preserves the original case of each letter. Uppercase letters remain uppercase and lowercase letters remain lowercase after the shift. Numbers, spaces, and special characters pass through unchanged.

Related Tools

Free tools by TUNA — energy supply from vetted manufacturers