Converters & translators

Substitution Cipher Decoder & Cryptogram Solver

Encode and decode with any cipher alphabet or keyword, or paste a cryptogram and let the solver crack it; then fix any letter yourself.

Updated · Free, no sign-up

Encoded
Itssg Vgksr

Share this tool

Know someone who’d love it?

What is a substitution cipher?

In a simple substitution cipher every letter of the alphabet is swapped for another letter, and the swap never changes: if A becomes Q once, it becomes Q every time. The key is the scrambled alphabet itself, the cipher alphabet, written under the normal one. Because one fixed alphabet is used for the whole message, it is also called a monoalphabetic substitution cipher. A puzzle that hides a quotation this way is a cryptogram.

The Caesar cipher, Atbash and the affine cipher are all substitution ciphers whose alphabet follows a simple rule. A general substitution cipher can use any order of the 26 letters, which gives an enormous number of keys, and yet a few sentences of code are usually enough to solve it by hand.

How to use the substitution cipher decoder and encoder

  1. Choose Encode or Decode.
  2. Enter the cipher alphabet: all 26 letters, each once. The first letter is what A becomes, the second is what B becomes, and so on. You can also type a keyword in Or build it from a keyword, or press Random alphabet for a fresh scrambled key.
  3. Type or paste the message. Case, spaces, digits and punctuation are kept.
  4. Copy the result. To share the key, copy the cipher alphabet from the key box.

Substitution cipher chart

A keyword alphabet, and the letter counts and word clues that crack a cryptogram.

Cryptogram solver: decode without the key

Paste a coded message and open Cryptogram solver: I don’t know the key, then press Solve. The solver makes a first guess by pairing the most common code letters with the most common English letters, then keeps swapping pairs of letters whenever the text reads more like English. It judges that with letter patterns counted from our dictionary (three-letter sequences such as THE and ING score well) and with how many of the words are real words. When it gets stuck it restarts from a shaken-up guess, and it stops after a few seconds or once nothing improves.

The table of letters under the solution is yours to edit: if you can see that a word should be garden and not harden, type the right letter under its code letter. Your letters are pinned (shown highlighted), and Solve again with my letters works around them. Use as the key copies the finished cipher alphabet into the key box, so you can decode more messages or write a reply in the same code.

The solver also cracks Caesar, Atbash, affine and keyword ciphers, since they are all simple substitutions. It works best on at least a sentence or two with the spaces kept; without spaces it needs a longer text. If a message will not solve at all, it may use a different kind of cipher: open Which cipher is this? below the tool for a guess.

A cryptogram solved step by step

Here is a 101-letter cryptogram made with a keyword alphabet we did not give the solver:

YTYPX QMPEKB RCY LHD AWPJYP MHWKRQ W HLKB PLU LA QSKAHLUYPQ IYQEDY RCY PLWD, WKD YTYPX WSRSJK RCY IEPDQ NLJY RL YWR RCY QYYDQ.

  1. Count the letters. The most common code letters are Y (16), P (9), L (8), Q (8), R (8). In English the most common are E, I, A, N, T, R, so Y is a good candidate for E.
  2. Look at short words. A three-letter word that repeats is very likely THE or AND. One-letter words are A or I.
  3. Use word shapes. A word with a double letter or a repeated letter in a fixed place has only a few possible answers (see the pattern table below).
  4. Fill in and test. Every letter you place appears all over the message, so a wrong guess shows up quickly as nonsense, and a right one makes new words appear.

The tool’s solver went through the same kind of search on its own and returned the message exactly:

EVERY SPRING THE OLD FARMER PLANTS A LONG ROW OF SUNFLOWERS BESIDE THE ROAD, AND EVERY AUTUMN THE BIRDS COME TO EAT THE SEEDS.

So Y did stand for E, and P for R. The key was a keyword alphabet built from WINDY: WINDYABCEFGHJKLMOPQRSTUVXZ.

How to solve a substitution cipher by hand

1. Letter frequency

Some letters are far more common than others, and a substitution cipher keeps those counts; it only changes the letters’ names. These are the English letters from most to least common, counted from the 21,435 most common words in our dictionary (the tool’s Letter frequencies section draws your message’s counts next to them):

LettersShare of letters
E I A N T R11.9%, 8.8%, 7.6%, 7.6%, 7.4%, 7.2%
O S L C D U6.1%, 6.1%, 5.5%, 4.4%, 4.2%, 3.4%
G P M H Y B3.1%, 3.0%, 2.6%, 2.1%, 2.0%, 1.6%
F V W K X Z Q J1.6%, 1.2%, 0.9%, 0.8%, 0.3%, 0.2%, 0.2%, 0.1%

A word list counts each word once, while real text repeats “the”, “that” and “this” constantly, so in a normal paragraph T and H rank higher than they do here. Treat the table as a guide to the top group and the bottom group, not an exact order: in a short message the order of the middle letters changes a lot.

2. Short words

  • One-letter words are almost always A or I.
  • The most common two-letter words include of, to, in, it, is, be, as, at, so, we, he, by, or, on, do, if, me, my, up, an, go and no.
  • The most common three-letter words are the and and; others to try are for, are, but, not, you, all, was.
  • An apostrophe followed by one letter is usually ’s or ’t; followed by two, ’ll, ’re or ’ve.

3. Word patterns

Write each code word as a pattern: the first new letter is A, the second new letter B and so on, so a word whose first and last letters match, such as THAT, is ABCA. The pattern stays the same after encoding, which narrows the choices a lot. Some patterns and everyday words that fit them, from our dictionary:

PatternEveryday wordsExamples
ABA3did, eye, pop
ABBC29been, book, boot, deem, deep, door, feed
ABCC28ball, bill, call, cell, fall, fell, fill
ABCA9area, ease, edge, else, high, onto, test
ABCDA18dated, going, knock, label, legal, local, river
ABCAD10ahead, alias, areas, catch, check, clock, eaten
ABCDD16agree, class, cross, glass, gross, guess, press

4. Common letter pairs

Double letters in English are most often LL, EE, SS, OO, TT and FF; a doubled code letter is almost never a vowel other than E or O. Q is nearly always followed by U. Combine these clues with the frequencies and short words, and the rest of the alphabet falls into place one letter at a time.

Keyword alphabets (keyword ciphers)

A random alphabet is hard to remember, so people often build one from a keyword: write the keyword without repeated letters, then the rest of the alphabet in order. This is also called a keyword cipher. Type a keyword into the tool and it builds the alphabet for you. Some examples:

KeywordCipher alphabet (A to Z become)Unchanged letters
ZEBRASZEBRASCDFGHIJKLMNOPQTUVWXYnone
KEYWORDKEYWORDABCFGHIJLMNPQSTUVXZZ
LANTERNLANTERBCDFGHIJKMOPQSUVWXYZE U V W X Y Z
MOUNTAINMOUNTAIBCDEFGHJKLPQRSVWXYZV W X Y Z

Notice that the end of a keyword alphabet keeps the normal order, and letters near the end of the alphabet can even stay themselves: with LANTERN, E, U, V, W, X, Y, Z are not encoded at all. That is a known weakness. Choose a keyword that uses some late letters (Y, Z, W, X), or shift the finished alphabet a few places as well, which is what a keyed Caesar cipher does.

Example: encoding with a substitution cipher

The tool starts with this cipher alphabet, made from the top row of a keyboard read left to right:

PlainABCDEFGHIJKLM
CipherQWERTYUIOPASD
PlainNOPQRSTUVWXYZ
CipherFGHJKLZXCVBNM

With it, HIDE THE KEY UNDER THE MAT becomes IORT ZIT ATN XFRTK ZIT DQZ. To decode, look each code letter up in the Cipher rows and read the plain letter above it.

When the solver gets stuck

A computer solver is only as good as the clues in the text. These situations make any cryptogram harder, for people and programs alike:

  • Very short messages. With fewer than about 40 letters, several different keys can each give words that look real. Fix the letters you are sure of and solve again.
  • Names, numbers spelled oddly, and rare words. The solver prefers common words, so it may turn an unusual name into an everyday word. Pin the letters of the name yourself.
  • Unusual letter counts. A sentence written to avoid the letter E, or packed with Z’s and X’s, fools frequency counts. Word patterns still work, so lean on those.
  • Not a substitution at all. If the letter counts look exactly like English but nothing solves, the letters were probably moved around rather than replaced, as in the rail fence cipher. If the counts look flat and even, it is probably a keyword cipher such as Vigenère.

Substitution vs. transposition

There are two basic ways to hide letters. A substitution cipher replaces each letter but leaves it in its place; a transposition cipher keeps every letter but changes the order. You can tell them apart with a letter count: after a transposition, E, T and A are still the most common letters, while after a substitution some other letters take their place. Classic field ciphers often used both, one after the other, so that neither method alone could break the message.

Types of substitution cipher

  • Monoalphabetic (this tool): one cipher alphabet for the whole message. Caesar, Atbash, affine and keyword ciphers are special cases.
  • Polyalphabetic: the cipher alphabet changes from letter to letter, following a key. The best known is the Vigenère cipher, which flattens the letter counts that make a cryptogram solvable.
  • Homophonic: common letters get several different symbols, so E might be written in four different ways, which hides the frequencies.
  • Symbol and number substitution: the letters are replaced by symbols or numbers instead of other letters. If each letter is simply its place in the alphabet, it is A1Z26; any other set of symbols is solved exactly like a cryptogram once you give each symbol a letter.

History of the substitution cipher

Substitution is among the oldest ways of hiding a message, and frequency analysis, the method that breaks it, is old too: the earliest known description is by the Arab scholar al-Kindi in the ninth century. In 1586 messages written by Mary, Queen of Scots, in a cipher that combined substituted letters with symbols for common words were read by the code breaker Thomas Phelippes, and they were used as evidence at her trial. In fiction, Edgar Allan Poe’s 1843 story “The Gold-Bug” walks the reader through solving a substitution cipher by letter counts, and it did a lot to make cryptograms a popular pastime.

Tips for making a good cryptogram

  • Make sure no letter stays itself. Solvers expect every letter to change, and a letter that maps to itself can feel like a mistake. The tool’s Random alphabet button never leaves a letter as itself.
  • Keep the spaces for beginners and remove them (or write groups of five) for experts.
  • One or two sentences is the sweet spot: long enough to be fair, short enough to stay a challenge.
  • Offer a starting letter as a hint, such as “X = E”, if your solvers are new to cryptograms.

Free and private

The substitution cipher tool and the cryptogram solver run entirely in your browser: free, with no sign-up, and nothing you type is uploaded or stored.

For teachers, bloggers & clubs

Put the Substitution Cipher on your website

Give your readers this tool right on your page. Copy the code, paste it into your site, done: no sign-up, no account.

  • Free for any website
  • No ads, no cookies
  • Fits phones and sidebars
  • Always up to date
See it live ↗

Please keep the small credit line under the tool; you may add rel="nofollow" to its link. How it works & the rules

› Show the code

Frequently asked questions

What is a substitution cipher?
A cipher that replaces every letter with another letter according to a fixed cipher alphabet. If A becomes Q once, it becomes Q everywhere in the message.
How do I decode a substitution cipher without the key?
Paste the message, open the Cryptogram solver and press Solve. It pairs common code letters with common English letters, then keeps swapping letters while the text reads more like English. You can type corrections under any code letter and solve again.
How do you solve a cryptogram by hand?
Count the letters (the most common is often E), look at one-letter words (A or I) and repeated three-letter words (THE, AND), and use word shapes such as double letters. Each correct letter you place reveals more words.
How many keys does a substitution cipher have?
Any order of the 26 letters can be a key, which gives 26 factorial, about 4 x 10^26, possible alphabets. Even so, frequency analysis breaks it because each letter keeps its own pattern.
What is a keyword cipher?
A substitution cipher whose alphabet is built from a keyword: the keyword's letters without repeats, followed by the rest of the alphabet in order. Type a keyword into the tool and it builds that alphabet for you.
What is the difference between monoalphabetic and polyalphabetic substitution?
A monoalphabetic cipher uses one cipher alphabet for the whole message, so letter counts survive. A polyalphabetic cipher, such as Vigenère, switches between several alphabets, which flattens the counts and makes it much harder to solve.
Is the Caesar cipher a substitution cipher?
Yes. Caesar, Atbash and the affine cipher are substitution ciphers whose alphabet follows a simple rule, so the cryptogram solver cracks them too.
How long does a message need to be for the solver to work?
A sentence or two with the spaces kept is usually enough. Under about 40 letters, or without spaces, several answers can look right, so pin the letters you are sure of and solve again.
Is my text private?
Yes. Encoding, decoding and solving all happen in your browser, and nothing you type is uploaded or stored.

About this page

The Substitution Cipher is a free tool from Linguaholic, made by Marcel Iseli. It runs in your browser, with no sign-up. Last updated .

The code breaker's English letter frequencies and word checks come from Linguaholic’s English dictionary, built from the open ENABLE and SCOWL word lists. Licenses and notices.

Keep exploring

Browse all 99 tools