Introduction
The keyed Caesar cipher is a monoalphabetic substitution cipher that combines a keyword-based alphabet rearrangement with a standard Caesar shift. It takes two parts to its key: a keyword and a shift value. First, the keyword is written at the beginning of the alphabet with duplicate letters removed, and the remaining letters of the standard alphabet are appended in order. Then the resulting keyword alphabet is rotated by the shift value. This tool encrypts and decrypts keyed Caesar ciphertext with an interactive alphabet visualization. Enter your text, set a keyword and shift, and the result appears instantly. Everything runs in your browser.
What this tool does
- Encrypts plaintext using a keyword alphabet and a Caesar shift, producing ciphertext that requires both the keyword and shift to decode.
- Decrypts ciphertext by reversing the keyword alphabet mapping and the shift, recovering the original plaintext.
- Builds a custom alphabet from any keyword by removing duplicate letters and appending the remaining standard letters in order.
- Visualizes the full alphabet mapping showing the standard alphabet, the keyword alphabet before shifting, and the final shifted alphabet used for substitution.
- Accepts any keyword up to 26 characters and any shift value from 0 to 25, giving 26 times more key space than a plain Caesar cipher.
- Preserves spaces and non-letter characters during encryption and decryption so word boundaries remain visible.
How this tool works
The tool has two modes. Encrypt mode takes plaintext, a keyword, and a shift value, builds the keyword alphabet, applies the shift, and substitutes each letter. Decrypt mode takes ciphertext and reverses the process.
The keyword alphabet is built by writing the keyword with duplicate letters removed, then appending the remaining letters of the standard alphabet in their original order. For example, the keyword "CIPHER" produces the alphabet "CIPHERABDFGJKLMNOQSTUVWXYZ" (C, I, P, H, E, R come first, then the remaining letters in order).
The shift rotates the keyword alphabet left by the specified number of positions. A shift of 3 moves the first three letters to the end. The shifted alphabet is then used as the substitution table: each plaintext letter at position N in the standard alphabet is replaced by the letter at position N in the shifted keyword alphabet.
The alphabet visualization shows three rows: the standard alphabet, the keyword alphabet before shifting, and the final shifted alphabet. This makes it easy to trace exactly which letter maps to which and to verify the result by hand.
How the cipher or encoding works
The keyed Caesar cipher is a monoalphabetic substitution cipher, the same family as the standard Caesar cipher and the Atbash cipher. It adds a keyword to the key, making the substitution alphabet non-standard and harder to guess than a plain shift.
The cipher has two steps. First, build the keyword alphabet. Write the keyword, remove any duplicate letters, and append the remaining letters of the standard A-Z alphabet in their original order. For example, with the keyword "BOXENTRIQ", the keyword alphabet is "BOXENTRIQACDFGHJKLMPSUVWYZ". The letters B, O, X, E, N, T, R, I, Q appear first (in the order they occur in the keyword), then the remaining letters A, C, D, F, G, H, J, K, L, M, P, S, U, V, W, Y, Z follow in alphabetical order.
Second, apply the Caesar shift. Rotate the keyword alphabet left by the shift value. With a shift of 3, the keyword alphabet "BOXENTRIQACDFGHJKLMPSUVWYZ" becomes "ENTRIQACDFGHJKLMPSUVWYZBOX". The first three letters (B, O, X) wrap around to the end.
The substitution then maps each plaintext letter to the letter at the same position in the shifted keyword alphabet. A (position 0 in the standard alphabet) maps to E (position 0 in the shifted keyword alphabet). B maps to N. C maps to T. And so on.
The keyed Caesar cipher is described in various cryptography textbooks and puzzle resources. The Boxentriq implementation popularized the online tool for this cipher. The cipher is sometimes called the "keyword Caesar cipher" or "Caesar cipher with key" to distinguish it from the plain shift cipher.
The cipher is related to the keyword cipher, which uses a keyword alphabet without the additional shift. It is also related to the Vigenere cipher, which uses a keyword to vary the shift per letter rather than to rearrange the alphabet. The keyed Caesar cipher sits between these two: it uses a keyword to build a custom alphabet (like the keyword cipher) and applies a uniform shift (like the Caesar cipher).
The key space of the keyed Caesar cipher is larger than the plain Caesar cipher. The plain Caesar cipher has only 25 possible keys (shifts 1 through 25). The keyed Caesar cipher has 25 shift values times a practically unlimited number of keywords. However, the cipher is still monoalphabetic: each plaintext letter always maps to the same ciphertext letter. This means frequency analysis breaks it just as easily as the plain Caesar cipher, given a sufficiently long ciphertext. The keyword and shift do not change the frequency distribution, they only change which letter maps to which.
How to use this tool
- Enter your text in the input field. Letters A-Z are encrypted; spaces and other characters are preserved.
- Set the keyword. Duplicate letters are removed automatically. Non-letter characters in the keyword are stripped.
- Set the shift value from 0 to 25. This rotates the keyword alphabet left by the specified amount.
- Choose Encrypt or Decrypt mode.
- Review the alphabet mapping to see exactly how each letter is substituted.
- Click Copy to copy the result to your clipboard.
Real-world examples
Encrypting a military message
A puzzle creator wants to encrypt "ATTACK AT DAWN" using the keyed Caesar cipher with keyword "CIPHER" and shift 3. The keyword alphabet is "CIPHERABDFGJKLMNOQSTUVWXYZ". After a left shift of 3, it becomes "HERABDFGJKLMNOQSTUVWXYZCIP". The tool substitutes each letter: A becomes H, T becomes E, T becomes R, A becomes A, C becomes B, K becomes D. The ciphertext is "HERABDEZHERGZPK". The creator shares the ciphertext along with the keyword and shift as the key.
Decrypting with a known keyword and shift
A solver receives the ciphertext "EOEZGP EZ FZPK" and is told the keyword is "CIPHER" with shift 3. They paste the ciphertext into the Decrypt tab, enter the keyword and shift. The tool builds the same shifted keyword alphabet and reverses the mapping: E maps back to A, O maps back to T, and so on. The plaintext "ATTACK AT DAWN" appears in the result field.
Using the cipher in a geocache puzzle
A geocacher hides a cache and wants to encode the coordinates as a puzzle. They use the keyword "GRAVITY" with shift 7 to encrypt "NORTH FORTY WEST". The keyword alphabet is "GRAVITYBCEFHKLMNOPQSUXWZD" (note the second A and T in GRAVITY are removed as duplicates). After shift 7, the alphabet becomes "BCEFHKLMNOPQSUXWZDGRAVITY". The ciphertext is "OBCEP SBCJF ZMPA". They publish the keyword, shift, and ciphertext on the cache page for solvers to decode.
Comparison with similar methods
| Method | Complexity | Typical use |
|---|---|---|
| Keyed Caesar cipher | O(n) with keyword and shift as two-part key | Puzzles, geocaching, educational cryptography |
| Caesar cipher (plain shift) | O(n) with shift value as key (25 possible keys) | Educational, basic obfuscation, puzzles |
| Keyword cipher (no shift) | O(n) with keyword as key, no shift | Puzzles, simple substitution with memorable key |
| Vigenere cipher | O(n) with keyword varying shift per letter | Historical cryptography, polyalphabetic substitution |
Limitations or considerations
The keyed Caesar cipher is a monoalphabetic substitution. Each plaintext letter always maps to the same ciphertext letter, so the frequency distribution of the ciphertext is identical to that of the plaintext. Frequency analysis breaks it easily on longer texts: the most common ciphertext letter corresponds to the most common plaintext letter (E in English), and the rest follows. The keyword and shift increase the key space but do not change the fundamental weakness. The cipher is suitable for puzzles, geocaching, and educational use, not for protecting sensitive information. For a cipher that resists frequency analysis, see the Vigenere cipher or the autokey cipher.
Frequently asked questions
What is the keyed Caesar cipher?
The keyed Caesar cipher is a monoalphabetic substitution cipher that combines a keyword-based alphabet with a Caesar shift. First, a custom alphabet is built by writing the keyword (with duplicates removed) followed by the remaining standard letters. Then the keyword alphabet is rotated by a shift value. Each plaintext letter is replaced by the letter at the same position in the shifted keyword alphabet. The key has two parts: the keyword and the shift.
How is the keyed Caesar different from the plain Caesar cipher?
The plain Caesar cipher uses the standard A-Z alphabet and shifts it by a fixed amount. The keyed Caesar cipher first rearranges the alphabet using a keyword, then applies the shift. This means the substitution table is non-standard and harder to guess. The plain Caesar cipher has 25 possible keys. The keyed Caesar cipher has 25 shift values times any keyword, giving a much larger key space. However, both are monoalphabetic and equally vulnerable to frequency analysis.
How do I build the keyword alphabet?
Write the keyword and remove any duplicate letters, keeping only the first occurrence of each. Then append the remaining letters of the standard A-Z alphabet in their original order. For example, the keyword "CIPHER" produces "CIPHERABDFGJKLMNOQSTUVWXYZ". The letters C, I, P, H, E, R appear first, then A, B, D, F, G, J, K, L, M, N, O, Q, S, T, U, V, W, X, Y, Z follow in alphabetical order.
Is the keyed Caesar cipher secure?
No. The keyed Caesar cipher is a monoalphabetic substitution, so each plaintext letter always maps to the same ciphertext letter. Frequency analysis breaks it easily on longer texts. The keyword and shift increase the key space but do not change the monoalphabetic nature of the cipher. It is suitable for puzzles and education, not for real security. For a cipher that resists frequency analysis, use the Vigenere cipher or the autokey cipher.
What is the difference between the keyed Caesar and the keyword cipher?
The keyword cipher builds a custom alphabet from a keyword but does not apply an additional shift. The keyed Caesar cipher builds the same keyword alphabet and then rotates it by a shift value. The keyed Caesar cipher is a keyword cipher plus a Caesar shift. Without the shift (shift = 0), the keyed Caesar cipher is identical to the keyword cipher.
Conclusion
The keyed Caesar cipher adds a keyword to the classic Caesar shift, making the substitution alphabet non-standard while keeping the workflow simple. For the plain version without a keyword, see the Caesar cipher and the Caesar cipher decoder. For polyalphabetic ciphers that resist frequency analysis, see the Vigenere cipher and the autokey cipher. For another keyed substitution, see the Atbash cipher.