Caesar Cipher Tool
Encrypt and decrypt text with the Caesar cipher. Adjust shift values, brute-force all rotations, and analyze letter frequency.
About
The Caesar cipher is one of the earliest known substitution ciphers, attributed to Julius Caesar for military correspondence. Each letter in the plaintext is shifted by a fixed number k positions along the alphabet. With only 25 possible keys, the cipher is trivially breakable by brute force or frequency analysis. It offers zero cryptographic security by modern standards. This tool performs real-time encryption and decryption, generates all 25 rotations for brute-force analysis, and computes letter frequency distributions against the standard English corpus. It handles mixed-case text, preserving capitalization while passing digits, punctuation, and whitespace through unmodified.
Note: this tool approximates classical Caesar behavior on the 26-letter Latin alphabet only. Characters outside A - Z are not shifted. For languages with extended alphabets (e.g., German Γ, Scandinavian Γ₯Àâ), those characters pass through unchanged. ROT13 is the special case where k = 13, making encryption and decryption identical operations.
Formulas
The Caesar cipher operates on modular arithmetic over the integer ring Z26. Each letter is mapped to its zero-indexed position (A = 0, B = 1, β¦, Z = 25).
Encryption function:
E(x) = (x + k) mod 26Decryption function:
D(x) = (x β k) mod 26Where x is the zero-indexed position of the input character, k is the shift key (0 β€ k β€ 25), and mod denotes the modulo operation ensuring wrap-around. The frequency analysis chi-squared statistic is computed as:
Where Oi is the observed count of the i-th letter and Ei is the expected count based on standard English letter frequencies (e.g., E ≈ 12.7%, T ≈ 9.1%). The shift yielding the lowest Ο2 is the most probable key.
Reference Data
| Shift (k) | Name / Alias | "HELLO" Encrypted | Historical Use |
|---|---|---|---|
| 0 | Identity (no cipher) | HELLO | Plaintext reference |
| 1 | Caesar +1 | IFMMP | Basic educational example |
| 3 | Classical Caesar | KHOOR | Used by Julius Caesar (Suetonius, Vita Divi Julii Β§56) |
| 4 | Caesar +4 | LIPPS | Variant reported in some historical analyses |
| 5 | Caesar +5 | MJQQT | Common puzzle shift |
| 7 | Caesar +7 | OLSSV | Used in some geocaching puzzles |
| 10 | Avocat cipher | ROVVY | French legal document obfuscation (apocryphal) |
| 13 | ROT13 | URYYB | Usenet spoiler protection (RFC 4880 armor) |
| 14 | Caesar +14 | VSZZC | Equivalent to ROT13 + ROT1 |
| 19 | Caesar +19 | AXEEH | Crossword cipher variant |
| 21 | Augustus cipher | CZGGJ | Used by Emperor Augustus (shift of +1 was his variant, debated) |
| 23 | Caesar β3 | EBIIL | Equivalent to decrypting with k = 3 |
| 25 | Atbash-adjacent | GDKKN | Maximum shift; reverse-neighbor substitution |