Encode and decode text with the Caesar cipher using a custom shift value
The Caesar cipher is one of the oldest and simplest encryption techniques. It shifts each letter in the plaintext by a fixed number of positions down the alphabet. With a shift of 3 (Julius Caesar's reported choice): A→D, B→E, C→F, ..., X→A, Y→B, Z→C. The same shift is used for decryption in reverse. Named after Julius Caesar, who reportedly used it to protect military communications around 58 BC, it predates modern cryptography by nearly two millennia.
The Caesar cipher is a monoalphabetic substitution cipher — each letter always maps to the same cipher letter for a given key. This makes it completely vulnerable to frequency analysis: in English ciphertext with shift 3, the most common letter is H (because E, the most common letter, maps to H). Trying all 25 possible shifts (brute force) takes seconds. Despite zero security value, the Caesar cipher remains important as the foundational concept behind more secure ciphers including Vigenère and ROT13.
Only 25 meaningful keys (shifts 1–25). Shift 0 is identity (no encryption); shift 26 is the same as shift 0. An attacker can try all 25 possibilities in seconds by hand, or instantly with a computer — making brute force completely trivial.
Caesar uses a single shift value (key) applied uniformly to all letters. Vigenère uses a keyword where each letter of the keyword specifies a different shift for the corresponding plaintext letter. "KEY" as a keyword means position 1 uses shift 10 (K), position 2 uses shift 4 (E), position 3 uses shift 24 (Y), then repeats. Vigenère resists simple frequency analysis but is still broken by Kasiski examination.
Frequency analysis exploits the fact that letters appear with predictable frequency in natural language. In English: E≈12.7%, T≈9.1%, A≈8.2%. In Caesar-encrypted English text with shift 3, H (≈12.7%) is the most common — immediately identifying the shift. The attacker finds the most common ciphertext letter and computes shift = (ciphertext_freq_letter − "E") mod 26.
Only educational. ROT13 (Caesar with shift 13) is used to hide spoilers in online forums — but that's obscuration, not security. In computing education, implementing Caesar cipher is a classic first programming exercise for string manipulation, modular arithmetic, and an introduction to cryptographic principles. No system should rely on Caesar cipher for actual security.
Password Strength Checker · ROT13 Cipher · Base32 Encoder / Decoder · Hex Encoder / Decoder · Vigenère Cipher · Atbash Cipher