Nihilist Cipher
Encode and decode the Nihilist cipher, the numeric cipher of the 19th-century Russian revolutionaries. Each letter is first turned into its two-digit coordinate on a Polybius square, then a repeating keyword — turned into numbers the same way — is added underneath, so the cipher is a stream of numbers. Mix the square, set the additive keyword, follow the live coordinate-addition breakdown, and copy, download, or share the result. Everything runs in your browser.
Square key
Additive key
The square key mixes the Polybius square that gives each letter its coordinate; the additive key is turned into numbers on that same square and added under the message, repeating as needed. Both sides must use the same square and keys. Leave the additive key blank to see the plain coordinates.
Enter text above to see the result here.
Polybius square
1
2
3
4
5
1
2
3
4
5
How to use Nihilist Cipher
- 1
Choose encode or decode and a square
Pick Encode to turn plain text into Nihilist cipher numbers, or Decode to turn numbers back. Choose the 5×5 square for letters or the 6×6 square to also carry digits.
- 2
Set the two keywords
Optionally enter a square keyword to mix the Polybius square, and an additive keyword that is added over the message. Both sides must use the same square and keys. Leave the additive key blank to see the plain coordinates.
- 3
Type or paste your text
Enter your message and it is converted as you type. The steps panel shows each letter over its coordinate, the cycling key number added beneath, and the resulting cipher number.
- 4
Read the square
Open the Polybius square to see every letter with its row and column numbers, and any keyword cells highlighted.
- 5
Copy, download, or share
Copy the result, download it as a text file, or share a link that reopens the tool with your exact text, square, and keywords ready to go.
Understanding the Nihilist Cipher
What is the Nihilist cipher?
The Nihilist cipher is a hand cipher from the 1880s, named after the Russian Nihilist movement — revolutionaries who opposed the Tsarist regime and needed a way to pass secret messages. It is built from two simple ideas stacked together: a Polybius square, which turns every letter into a pair of digits, and a repeating numeric key that is added on top. Neither idea is new on its own, but combining a coordinate substitution with a periodic addition makes the Nihilist cipher noticeably stronger than either part alone, and it became the ancestor of a whole family of Russian and Soviet numeric ciphers that followed.
Because the output is a stream of numbers rather than letters, the Nihilist cipher looks quite different from classical letter ciphers like Caesar or Vigenère. Under the surface, though, it is closely related: the Polybius step is the same coordinate substitution used by the Bifid and ADFGX ciphers, and the key-addition step is Vigenère's repeating-key idea carried out in arithmetic instead of letters. Studying it is a clear way to see how cryptographers built bigger ciphers by layering small, well-understood pieces.
How the Nihilist cipher works
Start with a Polybius square: a 5×5 grid holding the alphabet (with I and J sharing a cell), with the rows and columns numbered 1 to 5. Every letter then has a two-digit coordinate — its row digit followed by its column digit. The message is turned into a list of these coordinate numbers. So far this is exactly the Polybius cipher.
Now take a keyword and turn each of its letters into a coordinate on the same square, giving a short list of key numbers. Write the message numbers in a row and repeat the key numbers underneath them, cycling back to the start of the key whenever you run out. Finally, add each message number to the key number beneath it as an ordinary decimal sum. The resulting numbers — usually two or three digits each — are the cipher text, written out separated by spaces. Decoding simply subtracts the same repeating key numbers and reads the recovered coordinates off the square.
The square and the two keywords
The Nihilist cipher uses two independent secrets. The first is the square itself. This tool builds the square from an optional square keyword, exactly as a keyed Polybius or Playfair square is made: the keyword's unique letters are written in first, in order and without repeats, and the rest of the alphabet follows. The live square below highlights the keyword cells so you can watch the mixing; leaving the square keyword blank uses the plain alphabetical square.
The second secret is the additive keyword. Its letters are looked up on the very same square to become the key numbers that are added to the message. The two keys do different jobs — the square key decides what coordinate each letter has, the additive key decides what gets added on top — and both sender and receiver must share both. In this tool you can leave the additive key blank to watch the plain coordinates appear with nothing added, which is a helpful way to see the Polybius step on its own before the addition is layered in.
Choosing the 5×5 or 6×6 square
The classic Nihilist cipher uses a 5×5 square of 25 cells. Because the Latin alphabet has 26 letters, I and J share a cell, so a decoded J reads back as I — the standard Polybius compromise. The coordinates run from 11 to 55, and a cipher number (coordinate plus key) lands somewhere between 22 and 110.
This tool also offers a 6×6 square of 36 cells, which holds all 26 letters separately plus the ten digits 0 to 9. That lets the cipher carry numbers — useful for dates, map references, and amounts — without spelling them out, at the cost of slightly larger coordinates (11 to 66) and cipher numbers (up to 132). Pick the square with the toggle above; the live reference grid renumbers itself to match, and both sides must agree on which square they are using.
A worked Nihilist example
Take the word ATTACK with the square keyword ZEBRAS and the additive keyword RUSSIAN. With ZEBRAS filled in first, the square reads Z E B R A on the top row, then S C D F G, then H I K L M, then N O P Q T, then U V W X Y. Reading coordinates off it, ATTACK becomes 15 45 45 15 22 33, and the keyword RUSSIAN becomes 14 51 21 21 32 15 41.
Now write the key numbers under the message numbers, repeating as needed, and add: 15+14 = 29, 45+51 = 96, 45+21 = 66, 15+21 = 36, 22+32 = 54, 33+15 = 48. So ATTACK encrypts to 29 96 66 36 54 48. To decode, subtract the same key numbers — 29−14 = 15, 96−51 = 45, and so on — and read 15 45 45 15 22 33 back off the square as ATTACK. Changing either keyword changes every cipher number while still decrypting correctly.
Decoding a Nihilist message
Decoding reverses the steps. Split the cipher text into its numbers, write the additive keyword's numbers underneath them in the same repeating cycle, and subtract. Each result is a two-digit coordinate; split it into a row digit and a column digit and look the cell up on the square to recover the letter. This tool does all of that for you when you choose Decode and enter the same square, square keyword, and additive keyword that were used to encode.
If a number is garbled, or the wrong key or square is used, a subtraction can land outside the grid — for instance a row or column digit of 0, or larger than the square. When that happens the tool shows a "?" for that position rather than guessing. Because only letters live in the 5×5 square (and letters and digits in the 6×6 square), any spaces and punctuation in the original message were dropped during encoding and will not reappear.
History and security
The Nihilist cipher was used by Russian revolutionaries in the 1870s and 1880s and gave its name to the whole approach of adding a key to Polybius coordinates. Its real historical importance is as a starting point: cryptographers improved it step by step into stronger systems, including the Soviet VIC cipher used by the spy Reino Häyhänen in the 1950s, which kept the Polybius-and-addition core but wrapped it in extra transposition and a complex key schedule. The ADFGVX cipher of the First World War shares the same coordinate-substitution idea.
By modern standards the basic Nihilist cipher is weak. The key repeats with a short period, so once an attacker guesses the key length the cipher falls to the same kind of analysis that breaks the Vigenère cipher, and the Polybius substitution adds confusion but little real strength. Reusing a key across messages makes it weaker still. Its value today is educational — it is a vivid demonstration of how layering a coordinate square with a repeating key builds toward serious cryptography. For protecting real information, always use a modern, peer-reviewed algorithm such as AES, and keep the Nihilist cipher for history, puzzles, and capture-the-flag challenges.
Frequently asked questions
What is the Nihilist cipher?
How does the Nihilist cipher work?
What are the two keywords for?
Can you show a worked Nihilist example?
How do you decode a Nihilist cipher?
Why is the cipher text made of numbers?
What is the difference between the 5×5 and 6×6 square?
Does the Nihilist square have to use a keyword?
What happens to spaces, punctuation, and J?
How is the Nihilist cipher related to other ciphers?
How secure is the Nihilist cipher?
Is my text uploaded to a server?
Related tools
Keep going with these handy tools