The Gronsfeld cipher repeats a digit key over your message. Each digit shifts the letter beneath it by 0 to 9 places. Keep the key exactly as written: 031 and 31 repeat in different patterns and produce different results.
Keep leading zeroes in the key
- Enter a key containing 1 to 64 digits.
- Keep any leading zeroes. A zero leaves its message letter unchanged.
- Repeat the digits over A–Z letters. Spaces and punctuation do not move the key forward.
- To encode, add each digit and wrap around after Z. To decode, subtract it.
A leading zero changes the alignment
HELLO WORLDNumeric key 031; preserve nonlettersHHMLR XOUMD| Letter | Digit | Index calculation | Output |
|---|---|---|---|
| H | 0 | 7 + 0 = 7 | H |
| E | 3 | 4 + 3 = 7 | H |
| L | 1 | 11 + 1 = 12 | M |
| L | 0 | 11 + 0 = 11 | L |
| O | 3 | 14 + 3 = 17 | R |
After HELLO, W uses digit 1. The space does not take a digit or restart the key. To decode HHMLR XOUMD, keep the key as 031 and subtract the same sequence of shifts.
Try one yourself
Encode ZOO using key 20. Which position wraps past Z?