codebreaking spy
counton.org
codebreaking logo

Substitution Ciphers

Frequency Analysis Tools

Both the pigpen and the Caesar cipher are types of monoalphabetic cipher. This means that each plaintext letter is encoded to the same cipher letter or symbol. For example, in the Caesar cipher, each ‘a’ becomes a ‘d’, and each ‘d’ becomes a ‘g’, and so on.

The main weakness of monoalphabetic ciphers is that although the letters themselves change, their frequency does not. So, any enthusiastic cryptographer could crack the code using frequency analysis tables of the original plaintext language. This method was first documented by an Arabic mathematician Abu al-Kindi in the 9th century.

Here are the percentages that the letters of the alphabet appear in English:

A B C D E F G H I J K L M
8.2 1.5 2.8 4.3 12.7 2.2 2.0 6.1 7.0 0.2 0.8 4.0 2.4
N O P Q R S T U V W X Y Z
6.7 7.5 1.9 0.1 6.0 6.3 9.1 2.8 1.0 2.4 0.2 2.0 0.1

If we put them in order of most frequent letter, it is easy to see that ‘e’ is the most common letter, followed by the letter ‘t’:

E T A O I N S H R D L U C
12.7 9.1 8.2 7.5 7.0 6.7 6.3 6.1 6.0 4.3 4.0 2.8 2.8
M W F Y G P B V K X J Q Z
2.4 2.4 2.2 2.0 2.0 1.9 1.5 1.0 0.8 0.2 0.2 0.1 0.1

In addition to this, English also has a number of common letter patterns that we can also use to help decrypt monoalphabetic ciphers:

Common pairs TH, EA, OF, TO, IN, IT, IS, BE, AS, AT, SO, WE, HE, BY, OR, ON, DO, IF, ME, MY, UP
Common repeated letters SS, EE, TT, FF, LL, MM and OO
Common triplets THE, EST, FOR, AND, HIS, ENT or THA

The method of decryption using frequency analysis has two stages:

  1. Work out the frequencies of letters or symbols in the ciphertext and compare the results to the letter frequencies in the language – e.g., we know ‘e’ is the most common letter in English, and ‘the’ is the most frequent word.
  2. Make intelligent guesses for words or letters – e.g., a lone letter in English will be ‘I’ or ‘A’. This method is time consuming, and is less accurate for short messages, but is a valuable aid to the cryptographer.



Text: Enter or paste some text below:


A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Other Substitution Ciphers

Caesar Cipher

Pigpen Cipher