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

InputHELLO WORLD
SettingsNumeric key 031; preserve nonletters
Expected resultHHMLR XOUMD
Try this method
LetterDigitIndex calculationOutput
H07 + 0 = 7H
E34 + 3 = 7H
L111 + 1 = 12M
L011 + 0 = 11L
O314 + 3 = 17R

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?

Keep exploring

Vigenère cipher toolHow modulo 26 wraps around the alphabetHow text conversion and preparation work