Caesar Cipher Encoder & Decoder
Encode and decode text with the Caesar cipher online. Choose any shift 1–25. Free Caesar cipher encoder/decoder, no signup required.
Three steps to get started
Choose encode or decode
Select "Encode" to encrypt plaintext or "Decode" to decrypt a Caesar-encoded message.
Set the shift
Use the shift slider to choose a value from 1 to 25. Shift 13 is ROT13, the most common variant.
Paste and copy
Paste your text into the input and copy the result. Use the same shift value for encoding and decoding.
The Caesar cipher: history and how it works
The Caesar cipher is a monoalphabetic substitution cipher that encrypts a message by replacing each letter with the letter a fixed number of positions further along the alphabet. That fixed number is the key, and because the English alphabet has 26 letters there are only 25 useful keys - a shift of 0 or 26 leaves the text unchanged.
The name comes from Suetonius, who recorded in The Twelve Caesars around 121 AD that Julius Caesar protected his military correspondence by writing D for A, E for B, and so on: a right shift of 3. His nephew Augustus reportedly used a shift of 1. Mathematically the operation is simply modular addition, usually written E(x) = (x + n) mod 26 for encryption and D(x) = (x − n) mod 26 for decryption, where letters are numbered A=0 through Z=25.
The algorithm works by treating the alphabet as a circular ring. With a shift of 3, the mapping becomes:
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
To decrypt, simply shift in the opposite direction by the same amount - or equivalently, shift forward by 26 − n.
Modern uses
- Puzzles and escape rooms - Caesar ciphers are a staple of puzzle hunts
- ROT13 on forums - shift 13 hides spoilers on Reddit and old Usenet posts
- Cryptography education - the simplest cipher to understand and implement
- CTF challenges - beginner capture-the-flag competitions frequently include Caesar-encoded flags
How it is broken
Two attacks defeat it, and both are trivial. Brute force simply tries all 25 shifts and reads whichever output is English - the keyspace is so small that a person can do it by hand in a few minutes. Frequency analysis, first described by the ninth-century Arab polymath al-Kindi, needs only the ciphertext: since every A becomes the same letter every time, the letter distribution is preserved and merely rotated. E is about 12.7% of English text and T about 9.1%, so finding the most common ciphertext letter and measuring its distance from E usually reveals the key from a single sentence.
It helps to know what the Caesar cipher is not. Unlike the Vigenère cipher, which uses a repeating keyword so the same plaintext letter can encrypt differently in different positions, Caesar applies one shift everywhere - it is the degenerate case of Vigenère with a one-letter key. Unlike a general substitution cipher with an arbitrary 26-letter mapping and its 26! possible keys, Caesar allows only rotations. And unlike Base64 or ROT13, which are encodings anyone can reverse without a secret, Caesar at least has a key, even if a useless one.
Treat it as a teaching tool and a puzzle mechanic, never as protection. Encoding and decoding both run in JavaScript on this page, so no message you paste is uploaded or stored - though if a message genuinely needs to stay secret, reach for modern authenticated encryption such as AES-GCM instead.