handy.moe

All tools / Hacker kit

A digital stamp on a phone

Substitution cipher solver

Paste a cryptogram where every letter stands for another, and press Solve. It climbs towards the most English-looking key in a few seconds. Pin letters you're sure of and it keeps them, or solve it yourself in the key grid.

Runs in your browser. Nothing you type is sent anywhere.

How to use it

  1. Paste the ciphertext. The example is the opening of Pride and Prejudice, encrypted.
  2. Press Solve. The key and the plaintext update while it works.
  3. Fix any letter by typing into the key; it's pinned, and Solve keeps it next time.
  4. To make a puzzle, open Make a substitution puzzle and encrypt your own text.

How the solver works

It scores any guess at the key by how English the result looks, using how often each four-letter sequence appears in English. We counted those from 4.3 million letters of public-domain books. It starts from letter frequency, then keeps swapping pairs of letters whenever that makes the text read better, and shakes the key and climbs again when it gets stuck. On our tests it solved 700- and 300-letter cryptograms perfectly and a 200-letter one with one letter wrong.

Questions

How long does the text need to be?

100 letters or more works well, and 200+ is very reliable. Short puzzles (one sentence) may need a few pinned letters or several tries.

Does it work without word spaces?

Yes. It scores letter sequences, so text written in five-letter groups (a patristocrat) solves too.

Does it work for other languages?

Its statistics are English. Other languages using A–Z will often half-solve, then you can pin letters by hand.