Cipher solver

Paste a coded message and the cipher solver cracks it without the key: substitution ciphers, Vigenère and Atbash, with a first guess at which cipher it is. For a plain shift the Caesar cipher decoder is quicker, and for newspaper puzzles with word breaks use the cryptogram solver.

Key: cipher letter → plain letter (edit any letter; edited letters are kept when you solve again)

Don't know the shift? Every shift, best guess first

How to use the cipher solver

Paste the ciphertext into the box. Under it, the cipher solver gives a first hint about the type of cipher, based on how the letters are spread. Then pick a tab:

  • Substitution / cryptogram: every letter stands for one other letter, the same all the way through. Press Solve cryptogram. The key appears letter by letter and you can change any of it; letters you type are locked, and Solve again finds the best key around them.
  • Caesar / ROT: every letter is moved the same number of places along the alphabet. Decode with a shift you know, or read all 25 shifts listed at once, the one that reads most like English first. Shift 13 is ROT13. The Caesar cipher decoder has a full shift table.
  • Vigenère: the shift changes letter by letter following a keyword. Leave the key blank to find it, or type a key you know to decrypt or encrypt.
  • Atbash: the alphabet reversed, A for Z, B for Y.

Spaces, punctuation and capitals are kept where they were, so the answer lines up with your puzzle.

How the solver recognizes English

The solver does not look words up one by one. It scores text by how common its four-letter sequences are in English: THER, TION and INGT are very common, QZXJ never appears. We built these statistics ourselves from about 5.1 million letters of public-domain novels on Project Gutenberg, and only the counts are shipped with the page. Readable English scores far above random letters, so the solver can tell a correct key from a wrong one without knowing what the message says.

How each cipher is cracked

Caesar has only 25 possible keys, so the solver tries them all and ranks them by score.

Substitution has more keys than there are grains of sand on Earth, so trying them all is impossible. The solver starts from a guess based on letter frequencies (the most common cipher letter is probably E), then improves the key by swapping two letters at a time whenever that makes the text more English. When no swap helps, it shakes the key with a few random swaps and climbs again, and it repeats from fresh starting points for about a second and a half. For cryptograms that keep their spaces, it also gives credit for decoded words that are common English words, which helps a lot on short messages.

Vigenère is cracked in three steps: find the key length (with the index of coincidence: for the right length, every column of letters behaves like plain English shifted, and the Kasiski test on repeated letter groups as a second opinion), find each key letter by matching letter frequencies, then fine-tune the whole key with the four-letter statistics.

How reliable is it?

We tested the solver on passages from a novel that was not used to build the statistics. Every Caesar shift was ranked first, and every Vigenère key from 3 to 8 letters was recovered exactly on messages of 160 letters or more. Substitution messages of a couple of hundred letters came out fully correct; short ones (60 to 100 letters) usually come out readable with a few letters wrong, which you can then fix in the key. The shorter the message, the more possible keys give text that looks like English, so very short cryptograms may need your help.

Worked example

The substitution example begins Tctkn hxmmst iql q atn. In the solved key, zit, which appears four times, becomes THE, and the single letter q becomes A; the rest follows: Every puzzle has a key. Try it with the Example button, then change a letter in the key to see how the text updates.

Tips for solving cryptograms by hand

  • The most common letters in English are E, T, A, O, I and N.
  • One-letter words are almost always A or I. The most common three-letter word is THE.
  • Look for doubled letters (LL, EE, SS, OO) and apostrophes: a letter after an apostrophe is usually S, T or D.
  • Fill in the letters you are sure of and let the solver do the rest.

This page solves what you type. It does not publish answers to any newspaper or app puzzle.

Solver tested . Found a problem? Tell us.

Questions

Can the solver crack a cipher without the key?

Yes, for Caesar, Atbash, Vigenère and simple substitution ciphers. It searches for the key that makes the message read most like English. It needs enough text: about 20 letters for Caesar, 60 or more for a cryptogram, and roughly 25 letters per key letter for Vigenère.

What is the difference between a substitution cipher and a Caesar cipher?

A Caesar cipher moves every letter the same number of places (A to D, B to E). A substitution cipher can map each letter to any other letter, so there is no pattern to the key. Every Caesar cipher is a substitution cipher, but not the other way round.

What is ROT13?

A Caesar shift of 13. Because the alphabet has 26 letters, applying it twice gives back the original, so the same step encodes and decodes. It is listed as shift 13 in the Caesar tab.

Why are a few letters still wrong in my cryptogram?

Short messages do not contain enough text to pin down every letter, and rare letters such as J, Q, X and Z may not appear at all. Type the letters you are sure of into the key; they are locked, and Solve again rebuilds the rest around them.

Does it work for messages in other languages?

The scoring is built from English text, so it works best on English. Caesar and Atbash still show every option, so you can spot another language by eye.

Is my message sent anywhere?

No. All decoding runs in your browser; nothing you paste leaves your device.