Nihilist Cipher Decoder & Encoder
Enter the square keyword and the key word to turn numbers into text, or text into numbers. No key? Paste the numbers and open the Analyze tab to see which key lengths are still possible.
By Hommer Zhao · Updated
What the Nihilist cipher is
Short answer: the Nihilist cipher writes each letter as its row-column number in a keyworded 5×5 Polybius square, then adds the number of the next letter of a repeating key word. The output is a list of two- and three-digit numbers. Decrypting subtracts the same key numbers and looks the result up in the square.
Sender and receiver share two secrets: the square keyword, which arranges the alphabet, and the key word, whose coordinates are added. I and J share one cell because the square has 25 cells. The addition is ordinary decimal addition, so 55 + 55 is 110.
How the Nihilist cipher works, step by step
1. Build the keyword square
The square keyword controls where letters sit. Start with ZEBRA, keep each letter only on its first appearance, then append the unused alphabet letters in order. Fill rows from left to right, starting at the top. The tool uppercases the keyword, changes J to I, and removes characters outside A–Z before removing duplicates. The resulting alphabet has 25 letters because I and J share a cell. Here is the complete ZEBRA square:
| Row / column | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| 1 | Z | E | B | R | A |
| 2 | C | D | F | G | H |
| 3 | I/J | K | L | M | N |
| 4 | O | P | Q | S | T |
| 5 | U | V | W | X | Y |
2. Turn plaintext into coordinates
Read each letter as a row digit followed by a column digit. S is in row 4, column 4, so its coordinate is 44. T is 45, A is 15, and Y is 55. These are ordinary two-digit numbers for the next calculation. Do not reverse the digits: the row tells you which horizontal line to use, and the column selects the letter within that line.
3. Convert and repeat the key word
Use the same square for the second key, entered in the Numeric Key Word field. KEY becomes 32, 12, 55. Repeat those three coordinates until every plaintext letter has a partner. This keyword supplies the numbers to add; it does not rearrange the square. Unlike the square keyword, repeated letters in this key are retained. Spaces between words do not restart the sequence or consume a key letter.
4. Add each pair of numbers
Add the full plaintext coordinate to the full key coordinate. For the first S with key letter K, that is 44 + 32 = 76. Carry normally between decimal places. There is no modulo operation, no alphabet wrap, and no rule to drop a leading digit. A sum can therefore have three digits. Keep separators between sums so the receiver can tell where one ciphertext number ends and the next begins.
Worked example: STAY BY
Use plaintext STAY BY, square keyword ZEBRA, and key word KEY. The six message letters line up with KEYKEY. The space after STAY marks a word boundary, but B still uses the next key letter, E. The table shows every addition, including a three-digit result at the end.
| Plaintext letter | Plaintext coordinate | Key letter | Key coordinate | Sum |
|---|---|---|---|---|
| S | 44 | K | 32 | 76 |
| T | 45 | E | 12 | 57 |
| A | 15 | Y | 55 | 70 |
| Y | 55 | K | 32 | 87 |
| B | 13 | E | 12 | 25 |
| Y | 55 | Y | 55 | 110 |
Final ciphertext: 76 57 70 87 / 25 110. An independent calculation and the converter give this same output. Notice that the two occurrences of Y produce different sums because their key letters differ. Also, 70 is a valid ciphertext sum even though it is not a valid square coordinate.
Decrypt by hand
Recreate the square before doing any subtraction. Convert KEY into 32, 12, 55 and repeat it under the ciphertext, starting at the first number. Subtract one complete key coordinate from each complete sum, then read the remaining pair as row followed by column. Here is the first word of the worked example in reverse:
| Ciphertext | Subtract key | Square coordinate | Letter |
|---|---|---|---|
| 76 | 32 | 44 | S |
| 57 | 12 | 45 | T |
| 70 | 55 | 15 | A |
| 87 | 32 | 55 | Y |
Continue across the slash without resetting KEY: 25 − 12 = 13 gives B, and 110 − 55 = 55 gives Y. The recovered text is STAY BY. A result outside the square is a reason to check the key, square, and number boundaries. This tool displays a question mark for such a result. A wrong key can also produce valid coordinates, so the absence of question marks does not prove that a decryption is correct.
How to recognize a Nihilist cipher
Each digit of a sum adds a row (or column) digit of the letter to the same digit of the key letter. Both are 1 to 5, so each digit of the sum is 2 to 10. That leaves a fingerprint you can check in seconds:
| Test | What you see | Why |
|---|---|---|
| Range | Every number is between 22 and 110 | 11 + 11 = 22 and 55 + 55 = 110 |
| Last digit | No number ends in 1 | The column digits add to 2–10, and 10 carries into the tens |
| Distinct values | At most 81 different numbers appear | 9 possible row sums × 9 possible column sums |
| Over 100 | Only 102 to 110 | Both the letter and the key letter are in row 5 |
| Repeats | Hint only: equal numbers often sit a fixed distance apart | The key repeats, so the same letter meets the same key letter again |
A number such as 21, 41 or 115 rules out the standard cipher (or means a number was split or merged while copying). Passing the tests does not prove a Nihilist cipher, but plain Polybius numbers usually fail them quickly: every letter in the first column gives a number ending in 1, and they never go above 55. The Analyze tab checks the range and the last digit for you; the other rows are quick manual checks.
How to decrypt a Nihilist cipher without the key: measured results
The attack needs no guessing of words at first. Pick a key length L, split the numbers into L groups by position, and for each group keep only the key coordinates k for which every number minus k is a valid square coordinate (both digits 1 to 5). If some group keeps nothing, L is wrong. With enough ciphertext the shortest L that survives is the key length (unless the key word itself repeats, like ABAB); its multiples survive too.
We measured how fast this narrows the key. Plaintext: the first 20, 50, 100 and 200 letters of the Declaration of Independence (letters only, J counted as I). Square keyword ZEBRA, four key words, encrypted with this page's own engine. The table shows how many key combinations are left after the digit test; "all possible keys" is 25 to the power of the key length.
| Key word (length) | All possible keys | 20 letters | 50 letters | 100 letters | 200 letters |
|---|---|---|---|---|---|
| KEY (3) | 15,625 | 2 | 1 | 1 | 1 |
| CIPHER (6) | 244,140,625 | 3,456 | 16 | 1 | 1 |
| NIHILIST (8) | 152,587,890,625 | 165,888 | 576 | 4 | 1 |
| REVOLUTION (10) | 95,367,431,640,625 | 37,324,800 | 648 | 48 | 2 |
- In all 16 runs the shortest surviving length was the true key length, and the true key was never ruled out.
- A 3-letter key was fully determined from 50 letters. An 8-letter key needed 200; a 10-letter key still left 2 candidates at 200 letters.
- What you recover is the key's coordinates (for example 32 12 55), not its letters. Subtracting them gives the plaintext coordinates, which still need the square.
Try it on our 100-letter sample (key length 8): load the sample into the Analyze tab. The tool runs the same test for lengths 1 up to 12 and lists the candidates at each key position. The table is computed by the same code at build time, and unit tests check the figures quoted in the text.
Decrypting without the Polybius square
Once the key coordinates are subtracted, every number is a plain square coordinate such as 44 or 15. Without the square keyword you do not know which letter is in which cell, but the same letter always gives the same coordinate. What is left is a simple substitution of 25 symbols.
- Count each coordinate. In English the most common one is usually E, then T, A, O.
- Look for short repeated groups that could be THE, AND or ING.
- Use the layout: a keyword square puts the unused letters in alphabetical order, so the last rows often read like the end of the alphabet (in ZEBRA's square: …O P Q S T / U V W X Y).
- Once a few letters are placed, guess the square keyword from the first row and test it in the tool.
If you know or can guess the square keyword (puzzles often reuse a theme word), enter it in the tool together with the recovered key letters and decrypt directly.
What the tool does
- Letter normalization: plaintext and both keywords are uppercased, J becomes I, and characters outside A–Z are removed. Decoding returns uppercase letters with I, so original capitalization and the distinction between I and J cannot be recovered.
- Word boundaries: encryption splits plaintext on whitespace before removing nonletters. Surviving words are joined with
/, and numbers within a word are separated by single spaces. Repeated spaces, tabs, and newlines are collapsed; chunks containing no letters disappear. Punctuation is discarded, so STAY-BY becomes one encoded word, while STAY BY produces two. - Key handling: enter letters in Numeric Key Word despite the word “numeric” in its label. Numbers come from those letters through the square. Digits and punctuation in the key are ignored. A nonempty message with no usable key letters returns “Enter at least one letter in the numeric key.” Blank message input returns an empty output. An empty square keyword uses the alphabet in order with J omitted.
- Decrypt input: slashes separate words. Within each slash-delimited group, the decoder reads consecutive digit runs as numbers; other characters separate or surround those runs. Use spaces between sums for clarity: joining them into one long digit string makes one number, not several letter codes. The key advances for every number, even one that produces a question mark.
- Output limits: the tool uses full integer sums, including values above 100. Decryption joins slash-delimited groups with spaces and does not restore removed punctuation. Copy and Download use the displayed output. The decoder needs both keywords. Without them, the Analyze tab tests key lengths 1 up to 12 and lists the possible key coordinates, but it does not guess the square or print plaintext.
Why the Nihilist cipher is weak
A repeating key makes the same addition recur at regularly spaced positions. If the key has three letters, positions one, four, seven, and so on all use the same key coordinate. Within that group, equal plaintext letters always produce equal sums. Their frequency pattern survives, shifted by a constant number. A short key gives an analyst more samples per key position in a message of a given length.
One attack is to try candidate key lengths, divide the numbers into groups by key position, and test possible coordinate offsets. Subtracting the correct offset leaves only valid square coordinates. Wrong offsets may produce impossible pairs, while letter frequencies and likely words help assess the remaining candidates. If the square is unknown, assigning letters to those coordinates is an additional problem. Short messages can remain ambiguous; there is no promise that every puzzle has a unique or instantly recoverable solution. The measured results above show how many letters that takes.
Ordinary addition also exposes magnitude. Any sum greater than 100 requires both coordinates to come from the fifth row: a coordinate outside that row is at most 45, and even 45 + 55 only reaches 100. Thus the final 110 in our example reveals more than just an arbitrary ciphertext symbol. These leaks follow from the square and the arithmetic, not from a particular historical codebreaking event. Separately, the slashes this tool writes between words reveal word boundaries; remove them before sending a puzzle.
For comparison, a basic Polybius square stops at coordinate substitution. The Vigenère cipher shares the repeated-key weakness but works with alphabet shifts, while Gronsfeld uses digit-based shifts. Adding a second keyword makes Nihilist interesting to explore, but does not make it safe for private information. Use it for puzzles and learning, and use modern, vetted encryption for actual confidentiality.
History and variants of the Nihilist cipher
The cipher is named after the Russian Nihilists, revolutionary groups who, according to Wikipedia, used it in the 1880s for secret messages against the tsarist government. It needs only pencil and paper: a letter square for the coordinates and repeated additions. See the Nihilist cipher article on Wikipedia for a summary and sources.
Its best-known descendant is the VIC cipher, used by the Soviet agent Reino Häyhänen in the 1950s. It replaced the square with a straddling checkerboard (common letters get one digit, others two), combined digits with addition without carrying, and added transpositions, so the digit test above does not work on it.
Today it is used for puzzles and cryptography lessons. For how it compares with Polybius, Vigenère and Gronsfeld, see the section on why it is weak.
Nihilist cipher FAQ
What is the Nihilist cipher?
A hand cipher that turns each letter into its row-column number in a keyworded 5×5 Polybius square, then adds the number of the next letter of a repeating key word. The result is a list of two- and three-digit numbers, such as 76 57 70 87 / 25 110 for STAY BY (square ZEBRA, key KEY).
How do you decrypt a Nihilist cipher by hand?
Rebuild the same Polybius square, convert the key word to coordinates, and repeat those coordinates under the ciphertext numbers. Subtract each key coordinate, then look up the remaining row-column pair. With square keyword ZEBRA and key KEY, 76 minus 32 gives 44, which is S. Keep the key moving across word breaks.
How do you decrypt a Nihilist cipher without the key?
Guess a key length, group the numbers by key position, and keep only key coordinates that leave a valid square coordinate (both digits 1 to 5) for every number in the group. In our tests on the Declaration of Independence, a 3-letter key was fully determined from 50 letters and an 8-letter key from 200 letters. The Analyze tab in the tool runs this test on any numbers you paste.
How can you tell a message is a Nihilist cipher?
Every number lies between 22 and 110 and no number ends in 1, because each digit of the sum adds two digits from 1 to 5 (2 to 10). Numbers above 100 mean both the letter and the key letter sit in row 5. A list of two-digit numbers that breaks either rule is not a standard Nihilist cipher.
Can you decrypt a Nihilist cipher without the Polybius square?
Partly. Removing the key leaves the plaintext coordinates, but without the square keyword you do not know which letter sits in each cell. What is left is a simple substitution of 25 symbols, which letter frequencies and likely words can solve when the message is long enough.
Why does the Nihilist cipher merge I and J?
The usual 5 by 5 Polybius square has 25 cells, so I and J share one cell to fit the 26-letter Latin alphabet. Decrypted text shows I for both.
How long must the Nihilist cipher key be?
This tool needs at least one letter in the Numeric Key Word field; the letters repeat as needed and repeated letters are kept. Longer keys hold out longer: with a 10-letter key, 200 letters of ciphertext still left 2 possible keys in our test, against 1 for a 3-letter key after only 50 letters.
Why are Nihilist cipher results two or three digits long?
Each valid coordinate has a row digit and a column digit from 1 to 5. Adding two coordinates gives sums between 22 and 110. This tool keeps the entire sum: 55 plus 55 is 110, not 10. A sum is not itself a square coordinate; subtract the matching key coordinate before looking it up.
How is the Nihilist cipher different from Polybius and Vigenère?
A basic Polybius cipher replaces each letter with its square coordinate. Nihilist adds a repeating key coordinate to each plaintext coordinate. Vigenère also repeats a letter key, but shifts letters around an alphabet using modular arithmetic. Nihilist adds whole numbers without wrapping, so its output is numbers rather than letters.
When was the Nihilist cipher invented?
It is usually dated to the 1880s, when Russian Nihilist revolutionaries used it against the tsarist government (per Wikipedia). Its best-known descendant is the Soviet VIC cipher of the 1950s, which swapped the square for a straddling checkerboard and added transpositions.
Is the Nihilist cipher secure today?
No. A repeating key and the 1-to-5 digit range let anyone narrow the key from the numbers alone, and in our tests 200 letters narrowed it to one or two candidates. Very short messages can stay ambiguous. Use it for puzzles and learning, not for private information.