How to use the Gronsfeld cipher tool
- Choose the Direction: Encrypt or Decrypt.
- Enter the Digit key, for example a date, a PIN-like number or the default 31415.
- Type into Your text.
- Copy the Result. To decrypt, use the same digits and switch the direction.
What it does and when to use it
The Gronsfeld cipher, named after a 17th-century Count Gronsfeld, is a version of the Vigenère cipher where the keyword is replaced by a string of digits. A digit key is easy to remember and to hide: a phone extension, a year or the first digits of pi. That makes it popular in geocaching puzzles and escape rooms, where a number found in one clue unlocks the next.
Like every classical cipher it is for fun and learning, not security. If you want letter keys, compare the Beaufort cipher or the autokey Vigenère cipher. With a key of a single digit, Gronsfeld is the same as the Caesar cipher with a shift of 0 to 9.
How it works
Number the letters A = 0 to Z = 25. The key digits repeat along the letters of the message:
Encrypt: C = (P + d) mod 26
Decrypt: P = (C − d) mod 26
Here d is the key digit for that letter. With key 31415, H (7) moves 3 places to K, E moves 1 to F, L moves 4 to P, the next L moves 1 to M and O moves 5 to T: HELLO becomes KFPMT.
The tool keeps each letter’s case and skips anything that is not A to Z or a to z, without using a digit for it. Letters near the end of the alphabet wrap around, so Z shifted by 9 becomes I. The whole process runs in your browser.
Worked examples
Results from the tool:
HELLO key 31415 → KFPMT
Attack at dawn key 31415 → Duxbhn bx efzo
Duxbhn bx efzo key 31415, Decrypt → Attack at dawn
Zoo 24/7 key 9-0-1 → Iop 24/7
In the second line the key runs 3, 1, 4, 1, 5 across “Attack”, then restarts at 3 for the final k and continues through “at dawn”, ignoring the spaces. The last line shows wrap-around (Z to I), a 0 that leaves the o alone, and the 24/7 staying exactly as written.
Limits and tips
- A key the same length as the message, used once, is much stronger than a short repeating one, but this is still not modern encryption.
- Agree whether spaces and punctuation stay in the message. This tool keeps them, which reveals word lengths.
- Accented letters are not shifted. Write them as plain letters first if needed.
Frequently asked questions
Can the key contain letters or dashes?
What does a 0 in the key do?
Are the digits in my message encrypted?
How is Gronsfeld weaker than Vigenère?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.