๐ Caesar Cipher
Khoor, Zruog!
Try out the Caesar cipher, an ancient Roman encryption technique that shifts each letter of the alphabet by a fixed number of positions. Uppercase and lowercase are preserved, and non-alphabetic characters (numbers, symbols, non-Latin text) pass through unchanged. Useful as a teaching tool for how ciphers work, or just for fun with text.
How to use
- Choose "Encode" or "Decode" mode.
- Enter the text you want to convert.
- Adjust the shift amount with the slider โ the converted result is shown automatically.
How the calculation works
The Caesar cipher, one of the oldest ciphers, shifts every letter of the alphabet by a fixed number. Julius Caesar is said to have used a shift of three in his letters. Encrypt: cipher letter = (plain letter position + shift) mod 26 Decrypt: plain letter = (cipher letter position โ shift) mod 26 Letters AโZ are numbered 0โ25 and wrap around after Z. Upper and lower case are preserved, and digits, symbols, spaces and non-Latin text are left unchanged. A shift of 13 is ROT13, where encrypting and decrypting are the same operation.
Worked example
Plaintext: Hello, World! Shift: 3 Ciphertext: Khoor, Zruog! H (7) + 3 = K (10) W (22) + 3 = Z (25) o (14) + 3 = r (17) Shift 13 (ROT13): Hello โ Uryyb, and again โ Hello
Things to be aware of
- With only 25 possible shifts, trying them all breaks it instantly. It cannot protect real secrets.
- Letter frequency analysis (E is the most common letter in English) also breaks it easily.
- It is used for puzzles, learning about cryptography and hiding spoilers (ROT13).
FAQ
How secure is the Caesar cipher?
By modern standards, not secure at all โ there are only 25 possible shifts, so it can be broken instantly by brute force. It's purely a teaching tool for understanding the history and mechanics of ciphers.
Does this work with non-English text?
Non-Latin characters (like Japanese kana or kanji) aren't letters of the alphabet, so they pass through unshifted โ only the Latin letters get encoded.
How do I decode a message?
Switch to "Decode" mode and enter the same shift amount that was used to encode it โ that restores the original text.