gizmobench

Cipher Identifier

Paste a ciphertext and this page measures it: letter counts against English, the index of coincidence, chi-squared, repeated trigrams with their Kasiski spacings, the index at each key length up to 20, and eleven character-set tests. Each statistic is shown with its formula. It then ranks 17 families of classical ciphers and encodings, from Caesar and keyword substitution to Vigenère, Playfair, transposition, Morse and Base64, by how well those numbers fit, and lists every test each family passed or failed, with a note on what the numbers cannot tell apart. With fewer than 100 letters (100 characters for digit or symbol text) it reports insufficient evidence instead of a guess, and a fit is always a possibility, never an identification.

alphabetA to Z, case folded
spaceskept as word breaks, 74 words
ignored73 spaces and line breaks, 6 other characters
commonest8 of 23 letters used
E46S30L26K24C22J21P19D17
possibilitiesranked by fit, not certain
index of coincidence
0.0654
English letter table
0.0655
letters at random
1/26 = 0.0385

Possible: Monoalphabetic substitution. It is the family these statistics fit best, not an identification.

  1. 1 fits bestMonoalphabetic substitution

    shift (Caesar), Atbash, affine, keyword or mixed alphabet

    Index 0.0654 in the English range, but the letters are not in English proportions (chi-squared 1,646.1 against a limit of 220.5). No shift, Atbash or affine key brings chi-squared inside the limit (closest: affine a = 25, b = 22, 457.3), so a keyword or mixed alphabet fits better than a shift. SCE is a whole word 10 times.

  2. 2 fits lessTransposition

    rail fence, columnar, route, scytale

    2 of 3 tests pass. Against it: Letters are not in English proportions: chi-squared 1,646.1 against a limit of 220.5.

not covered modern encryption such as AES, hidden messages, and plain text in languages other than English

repeats SCE 12 times, DJB 4 times, ETS 3 times, 28 more trigrams at least twice

Open Classical Cipher Workbench (new tab)
Letters
321
Index of coincidence
0.0654
Different letters
23 of 26
Best fit, not certain
Monoalphabetic substitution
Alphabet
Spaces

A to Z counts letters in either case and ignores everything else. Custom counts your own symbols, folding case unless the alphabet holds both cases of a letter; the English tests (chi-squared, letter order, the shift and affine keys, Playfair's shape) need A to Z. Word breaks reads the spaces as the original spacing; Ignore reads a stream of letters.

Letter counts

Each letter's count O beside E, the count English would give: E = N x the letter's share of the English table. Chi-squared adds (O - E)^2 / E over the 26 letters; the thin mark on each bar is the English share.

321 letters, 23 different
LetterCount OShareChartEnglishE(O - E)^2 / E
E4614.3%12.7%40.770.67
S309.3%6.3%20.314.62
L268.1%4.0%12.9213.24
K247.5%0.8%2.48186.91
C226.9%2.8%8.9319.13
J216.5%0.2%0.49856.41
P195.9%1.9%6.1926.49
D175.3%4.3%13.650.82
T175.3%9.1%29.075.01
H154.7%6.1%19.561.06
Q123.7%0.1%0.30448.51
W113.4%2.4%7.581.55
N103.1%6.7%21.666.28
B92.8%1.5%4.793.70
U72.2%2.8%8.850.39
A61.9%8.2%26.2215.59
I61.9%7.0%22.3611.97
R61.9%6.0%19.229.09
Y61.9%2.0%6.340.02
G51.6%2.0%6.470.33
V30.9%1.0%3.140.01
M20.6%2.4%7.724.24
O10.3%7.5%24.1022.14
F00.0%2.2%7.157.15
X00.0%0.2%0.480.48
Z00.0%0.1%0.240.24
All321chi-squared = 1,646.1; English proportions at or under N/2 + 60 = 220.51,646.1

Each of the 312 affine keys (a x + b mod 26, which include the 26 shifts and Atbash) undone on these counts: the closest to English is affine a = 25, b = 22 (A becomes W), chi-squared 457.3, outside the limit of 220.5.

Letter order: 10 of 320 adjacent pairs (3.1%) are one of TH HE IN ER AN RE ON AT EN ND. English order gives at least 12.0% on this test; English letters in random order give about 6.3%, the sum of each pair's two letter shares multiplied.

Index of coincidence

The chance that two letters picked from different places in the text are the same letter. One alphabet swapped for another keeps it; a repeating key pulls it toward random.

IC = sum of n(n - 1) / (N(N - 1))
= 6,714 / (321 x 320) = 0.0654
English letter table, the sum of squared shares: 0.0655
Letters at random, 1/26: 0.0385
English range used by the tests: 0.0560 to 0.0952; near random: up to 0.0452
Friedman key length estimate, (0.0655 - 0.0385) / (IC - 0.0385): 1.0

Index by key length

For each key length L, the letters are split into L columns (every Lth letter) and the columns' indexes averaged. Under a repeating key of length L, each column is one alphabet and reads near English. Tried up to 16: longer keys would leave a column under 20 letters. A possible key length is the smallest whose columns read in the English range and come within 0.005 of the best average, while the whole text reads below it.

Key lengthAverage ICChart
10.0654
20.0650
30.0659
40.0622
50.0640
60.0649
70.0652
80.0628
90.0621
100.0606
110.0661
120.0590
130.0649
140.0619
150.0577
160.0644

The thin mark is the start of the English range, 0.0560.

Repeats and Kasiski spacings

For every three-letter sequence, the distance from each occurrence to the next. Under a repeating key, a repeat that lines up with the key gives a distance the key length divides; by chance, a length L divides about 1 in L.

Repeated trigrams (31 in all, the commonest 10 shown): SCE 12 times, DJB 4 times, ETS 3 times, SEP 3 times, JBS 3 times, BSC 3 times, CEP 3 times, CER 2 times, SSC 2 times, AKU 2 times

48 spacings
Length LSpacings L dividesShareBy chanceChart
22041.7%50.0%
31429.2%33.3%
4816.7%25.0%
5816.7%20.0%
6612.5%16.7%
71225.0%14.3%
848.3%12.5%
924.2%11.1%
1000.0%10.0%
11714.6%9.1%
1224.2%8.3%
1336.3%7.7%
14612.5%7.1%
1536.3%6.7%
1624.2%6.3%
1724.2%5.9%
1812.1%5.6%
1924.2%5.3%
2000.0%5.0%

Words, reading the spaces as word breaks

Words
74, 4.3 letters on average
One-letter words
L (4 times); English has two, A and I
Repeated words
SCE 10 times, LJT 2 times, CLT 2 times, WLQ 2 times

Character set

Tests on every non-space character, whatever the alphabet setting.

    • passMostly letters A to Z. 321 of 327 non-space characters are letters A to Z (98.2%); at least half is the test.
    • failMorse code characters. Not only dots, dashes and slashes, or not both dots and dashes.
    • failOnly 0 and 1. Characters other than 0 and 1 appear.
    • failOnly digits and separators. Letters or other characters appear beside the digits, or there are no digits.
    • failEvery number from 1 to 26. Not digit text, or a number falls outside 1 to 26.
    • failDigits of a Polybius square. Not digit text, fewer than 3 different digits, or digits outside one square's 1 to 6 or 0 to 5.
    • failEvery number from 22 to 110. Not digit text, or a number falls outside 22 to 110.
    • failOnly two different letters. The text uses 23 different letters, or characters besides letters.
    • failOnly the letters A D F G V X. Letters outside A D F G V X appear, or fewer than 4 of them are used.
    • failOnly hexadecimal digits. Characters outside 0 to 9 and A to F appear, or it lacks either digits or letters.
    • failThe Base64 alphabet. Characters outside the Base64 alphabet appear, = is not only at the end, or one case is missing.

Every family, and why

A family fits when every test it has passes, and fits less when its first test passes and at least half pass. Families from the letter statistics need 100 letters; families from the character set need 100 non-space characters. A fit is a possibility, not an identification.

  1. 1. Monoalphabetic substitutionfits best

    shift (Caesar), Atbash, affine, keyword or mixed alphabet

    • passIndex of coincidence 0.0654 is in the English range, 0.0560 to 0.0952
    • passLetters are replaced: not in English proportions (chi-squared 1,646.1 against a limit of 220.5)
    • passOne-letter words use 1 different symbol (L); English has two, A and I

    Unsure: Counts cannot tell a keyword alphabet from a random mixed alphabet, and a short or unusual text can move chi-squared either way.

    Classical Cipher Workbench (new tab)

  2. 2. Transpositionfits less

    rail fence, columnar, route, scytale

    • passIndex of coincidence 0.0654 is in the English range, 0.0560 to 0.0952
    • failLetters are not in English proportions: chi-squared 1,646.1 against a limit of 220.5
    • pass3.1% of adjacent pairs are common English pairs such as TH and HE (English order: at least 12.0%; shuffled English letters: about 6.3%)

    Unsure: Counts cannot say which transposition or which key; they show only that the letters are English and their order is not.

    Scytale Cipher (new tab)

  3. 3. Not enciphered, or a light transpositiondoes not fit

    English letters still in English order

    • passIndex of coincidence 0.0654 is in the English range, 0.0560 to 0.0952
    • failLetters are not in English proportions: chi-squared 1,646.1 against a limit of 220.5
    • fail3.1% of adjacent pairs are common English pairs such as TH and HE (English order: at least 12.0%; shuffled English letters: about 6.3%)

    Unsure: Letter counts cannot tell English that was never enciphered from a transposition that moved only a few letters.

  4. 4. Playfair or another digraphic cipherdoes not fit

    letters enciphered two at a time

    • failIndex 0.0654 is not between random (up to 0.0452) and English (from 0.0560)
    • fail321 letters: an odd count
    • fail3 pairs of the same letter among the 160 letter pairs
    • pass23 different letters; never used: F, X, Z

    Unsure: Other digraphic ciphers, and some Vigenère texts, can pass the same tests; the missing letter is often J but can be any letter.

    Playfair Cipher (new tab)

  5. 5. Polyalphabetic with a short repeating keydoes not fit

    Vigenère, Beaufort, Gronsfeld

    • failIndex 0.0654 is not below the English range, 0.0560 to 0.0952
    • not testedKey lengths not tried: the index is already in the English range

    Unsure: A multiple of the key length also reads near English, and Vigenère, Beaufort and Gronsfeld give the same counts.

    Vigenère Cipher (new tab)

  6. 6. Long key or random lettersdoes not fit

    autokey, running key, a long repeating key, a one-time pad, or random letters

    • failIndex 0.0654 is above the near-random line of 0.0452
    • not testedKey lengths not tried: the index is not below the English range

    Unsure: An autokey, a running key, a long key, a one-time pad and random letters all look like this, and a true one-time pad cannot be read from the text alone.

Three checks of the arithmetic

Each row is worked by the same code as the stage. Load puts it in the box.

  • AAAA4 letters, all the same
    index of coincidence 1, from 12 / (4 x 3); insufficient evidence: 4 letters, fewer than 100, so no family is ranked
  • ABCD4 letters, all different
    index of coincidence 0, from 0 / (4 x 3); insufficient evidence: 4 letters, fewer than 100, so no family is ranked
  • Empty, or fewer than 100 lettersfor example XQZ
    index of coincidence 0, from 0 / (3 x 2); insufficient evidence: 3 letters, fewer than 100, so no family is ranked
Possibilities, not identifications. Different ciphers can leave the same statistics, and a short or unusual text can move any of them. The ranking says which classical families these numbers fit and why; it never decrypts the text, and it cannot recognise modern encryption, which is built to look like random bytes.
Accuracy. A heuristic, educational reading of the text: letter counts, the index of coincidence, chi-squared against English letter frequencies, repeated trigrams and their Kasiski spacings are computed exactly as their formulas state, and classical cipher families are ranked by how well those numbers fit, assuming the hidden text is English. It cannot reliably identify arbitrary encryption and does not decrypt anything; below 100 letters (100 characters for text made of digits or symbols) it reports insufficient evidence, and even the best fit is a possibility, not an identification.

Common questions

How does this cipher identifier decide?
It computes the statistics first and ranks second. Each of its 17 families of classical ciphers and encodings has a short list of tests on those statistics, such as an index of coincidence in the English range, letters in English proportions, or only the digits of a Polybius square. A family fits when every test it has passes, and fits less when its first test passes and at least half pass. Families from the letter statistics need 100 letters and families from the character set need 100 non-space characters; below that the page reports insufficient evidence. The best fit is labelled a possibility, and every test is listed with its numbers so you can check the reasoning.
What is the index of coincidence?
The chance that two letters taken from different places in the text are the same letter: IC = sum of n(n - 1) / (N(N - 1)), where n is each letter's count and N the letter total. AAAA gives 12 / (4 x 3) = 1 and ABCD gives 0 / (4 x 3) = 0. The English letter table gives 0.0655 and letters at random give 1/26 = 0.0385. Swapping one alphabet for another leaves the index unchanged, which is why a substitution keeps an English index, while a repeating key pulls it toward 0.0385. The tests count 0.0560 to 0.0952 as the English range and up to 0.0452 as near random.
How can I tell a Vigenère cipher from a substitution cipher?
A substitution keeps the English index of coincidence but moves the letters, so chi-squared against English is high. A Vigenère key lowers the index. The page then splits the letters into L columns, every Lth letter, for each key length L up to 20 while a column keeps 20 letters, and averages the columns' index: at the key length, each column is a single alphabet and reads in the English range again. It names as a possible key length the smallest one whose columns read in the English range and come within 0.005 of the best column average, checks it against the Kasiski spacings between repeated trigrams (a length L divides about 1 in L of them by chance), and shows Friedman's estimate of the key length as well.
Why does it say insufficient evidence?
With fewer than 100 letters, one unusual word can move every statistic enough to change the ranking, so no family is ranked. The counts, the index of coincidence and the character-set tests are still shown: AAAA has an index of 1 and ABCD an index of 0, but neither is enough text to say anything about a cipher. Text made only of digits, dots and dashes or other symbols needs 100 non-space characters for its character-set families.
How does it tell a transposition from a substitution?
A transposition keeps the plain letters and only moves them, so the letter counts stay in English proportions: chi-squared against English at or under half the letter count plus 60. It then looks at the order: the share of adjacent pairs that are one of TH, HE, IN, ER, AN, RE, ON, AT, EN and ND. The page reads 12% or more as English order, and shuffled English letters give about 6.3%, so a low share with English counts reads as a possible transposition, and a high share as text that may not be enciphered at all.
Can it decrypt my message or identify any cipher?
No. It does not decrypt anything and cannot reliably identify arbitrary encryption. For a substitution it reports which of the 312 affine keys, including the 26 shifts and Atbash, brings the letter counts closest to English, and where this site has a tool that works the best-fitting cipher, such as the Classical Cipher Workbench or the Vigenère cipher page, it links to it. Modern encryption usually arrives as Base64 or hexadecimal, which this page can name only as an encoding, and a one-time pad looks like random letters.
What do the Alphabet and Spaces settings change?
A to Z counts the 26 letters in either case and ignores everything else. Custom counts your own symbols, up to 256, each typed once, folding case unless the alphabet holds both cases of a letter; Fill from the text collects every different non-space symbol in the box. The English tests (chi-squared, letter order, the affine keys and Playfair's shape) need A to Z, the family tests need at least 26 symbols, and more than 26 symbols in use with a low index suggests homophonic substitution as possible. Word breaks reads spaces as the original spacing and adds word counts and a one-letter-word test, since English has two, A and I; groups of equal length are read as a grouping instead. Ignore reads one stream.
Is my ciphertext uploaded or saved?
The analysis runs in your browser and the text is not sent anywhere. The page reads up to 100 KB (102,400 bytes) at once and refuses a longer paste with a message instead of slowing down. Only the Alphabet and Spaces settings are kept in this browser's local storage, after you change one; the ciphertext is never stored. Copy report and .txt give the statistics and the possibilities without the ciphertext itself.

A heuristic, educational reading of the text: letter counts, the index of coincidence, chi-squared against English letter frequencies, repeated trigrams and their Kasiski spacings are computed exactly as their formulas state, and classical cipher families are ranked by how well those numbers fit, assuming the hidden text is English. It cannot reliably identify arbitrary encryption and does not decrypt anything; below 100 letters (100 characters for text made of digits or symbols) it reports insufficient evidence, and even the best fit is a possibility, not an identification.