Caesar Cipher Shifter
Encrypt and decrypt text using the Caesar cipher with adjustable shift (0-25). Includes brute-force decryption and frequency analysis.
About
The Caesar cipher is a monoalphabetic substitution cipher where each letter in the plaintext is replaced by a letter a fixed number of positions down the alphabet. With a shift of 3, A becomes D, B becomes E, and so on. The method is named after Julius Caesar, who reportedly used a shift of 3 for military correspondence. The cipher operates over a cyclic group of order 26, meaning a shift of 27 is equivalent to a shift of 1. This tool computes the substitution in constant time per character.
The Caesar cipher provides zero cryptographic security against any informed adversary. Its keyspace is only 25 meaningful values, making exhaustive brute-force trivial. The tool includes a brute-force panel that displays all 25 possible decryptions simultaneously, plus a letter frequency histogram on the output. Frequency analysis exploits the fact that English text has a known distribution (the letter E appears roughly 12.7% of the time). Compare the output histogram to standard English frequencies to validate your chosen shift. Note: the cipher preserves case and passes non-alphabetic characters unchanged.
Formulas
The Caesar cipher encryption function maps each alphabetic character to its shifted counterpart within the modular ring Z26.
Where x is the zero-indexed position of the character (A = 0, B = 1, β¦, Z = 25), k is the shift key (0 β€ k β€ 25), E is the encryption function, and D is the decryption function. The addition of 26 in the decryption formula prevents negative modular results. ROT13 is the special case where k = 13, making encryption and decryption identical since 13 + 13 = 26 β‘ 0 (mod 26).
Reference Data
| Shift | Name / Usage | A β | B β | Z β | Example Word |
|---|---|---|---|---|---|
| 0 | Identity (no change) | A | B | Z | HELLO β HELLO |
| 1 | Basic shift | B | C | A | HELLO β IFMMP |
| 3 | Julius Caesarβs original | D | E | C | HELLO β KHOOR |
| 5 | Common exercise shift | F | G | E | HELLO β MJQQT |
| 7 | Alternative cipher | H | I | G | HELLO β OLSSV |
| 10 | Decimal offset | K | L | J | HELLO β ROVVY |
| 13 | ROT13 (self-inverse) | N | O | M | HELLO β URYYB |
| 15 | Mid-range shift | P | Q | O | HELLO β WTAAD |
| 19 | Augustus Caesar variant | T | U | S | HELLO β AXEEH |
| 20 | Near-end shift | U | V | T | HELLO β BYFFI |
| 21 | Affine special case (a=1,b=21) | V | W | U | HELLO β CZGGJ |
| 25 | Atbash-adjacent (reverse +1) | Z | A | Y | HELLO β GDKKN |