EN
My tools

Substitution Cipher Solver & Encoder

Break a simple substitution cipher automatically with quadgram hill-climbing, or encode and decode with a 26-letter key or keyword alphabet. Hints and seed options.

A keyword (ZEBRAS → ZEBRASCDFGH…) or a full 26-letter cipher alphabet for A–Z.
More restarts find the best key more reliably but take longer.
The same seed always gives the same result; change it to try again.
My tools →
Advertisement

In a simple substitution cipher every letter is replaced by another fixed letter, like the cryptograms in newspapers. With 26! possible keys it cannot be brute-forced, but it can be solved by search: this tool starts from many keys and keeps swapping letters while the result looks more like English, judged by how common its four-letter groups (quadgrams) are. It also encodes and decodes with a known keyword or cipher alphabet.

How to use this tool

  1. Paste the ciphertext; at least 80 letters works best.
  2. Leave the mode on Solve and press Calculate (it takes about a second).
  3. If a few letters look wrong, add them as hints such as Q=E and solve again, or try another seed.
  4. To encode or decode with a known key, switch the mode and enter the keyword or full alphabet.

Formula

score(key) = Σ log₁₀ P(quadgram) over every four-letter window of the decrypted text

The first start matches letters by frequency (the commonest cipher letter becomes E, and so on); later starts make five random swaps in the best key so far, and every sixth start is fully random. Two letters are swapped at a time and the swap is kept if the score rises; after 1,500 swaps without improvement every pair is tried once more until none helps. The highest-scoring key over all starts wins. Probabilities come from about 1.2 million letters of modern English web prose; the 3,000 most common quadgrams are stored, and others get a low floor value.

Example

The default ciphertext begins "Vtvzb lozcys nwv zctvz…". With 30 restarts and seed 1 the solver recovers "Every spring the river behind our village rises above its banks…" — all 305 letters — and the key A→Q, B→K, C→U … that was used to make it. With the keyword ZEBRAS, "FLEE AT ONCE. WE ARE DISCOVERED!" encodes to SIAA ZQ LKBA. VA ZOA RFPBLUAOAR!

Frequently asked questions

Why are some letters still wrong?

Below roughly 60–80 letters several keys produce English-looking text, and the search may settle on the wrong one. Even long texts can come out with two or three letters swapped (for example "pas" for "was"), especially old or literary prose, because the statistics come from modern web writing. Fix them by adding the letters you are sure of as hints (cipher=plain), or try more restarts or another seed.

Does it work for Caesar, Atbash or affine ciphers?

Yes, those are special cases of substitution, so the solver finds them too; the dedicated Caesar and affine tools are faster for them. It does not solve Vigenère or other polyalphabetic ciphers.

What does "Starts that agree" mean?

How many random starts ended at the best key. If several agree, the answer is very likely right; if only one did, try more restarts or another seed.

Is a substitution cipher safe to use?

No. As this page shows, a few hundred letters are enough to recover the key automatically. Use a modern cipher such as AES for anything private.

Last updated:

Cite or embed this tool
APA

kakaoCalc. (2026, November 8). Substitution Cipher Solver & Encoder. https://kakao.mobile/tools/substitution-cipher-solver/

MLA

“Substitution Cipher Solver & Encoder.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/substitution-cipher-solver/.

Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms

Advertisement