Productivity and Utilities

Kasiski and Index of Coincidence Analyzer

Paste ciphertext from a Vigenere cipher to look for the key length.

Your numbers

Only the letters A to Z are used. Up to 100,000 letters. Nothing is uploaded. Example text.

Trigrams are 3. Use 3 to 6.

Up to 30.

Result

Key length with the highest IC

5

Average IC 0.0878 for that length

Index of coincidence, whole text
0.0407
Repeats found
20
Most common factor of the gaps
5
Letters used
137

Index of coincidence by key length

Key lengthAverage IC
10.0407
20.0403
30.0350
40.0404
50.0878
60.0309
70.0307
80.0398
90.0370
100.0806
110.0323
120.0237

Repeated sequences (Kasiski)

RepeatPositionsGaps
XTS6, 71, 101, 12165, 30, 20
TSB7, 72, 12265, 50
SBW8, 73, 12365, 50
BWH9, 74, 12465, 50
WHY10, 75, 12565, 50
HYW11, 76, 12665, 50
YWY12, 77, 12765, 50
WYW13, 78, 12865, 50
LXF0, 115115
XFO1, 116115
FOP2, 117115
OPV3, 118115
PVX4, 119115
VXT5, 120115
YWE14, 129115
WEF15, 130115
EFR16, 131115
FRN17, 132115
RNH18, 133115
NHR19, 134115

Factors of the gaps

FactorGaps it divides
529
29
109
138
31
41
61
151
201
How this was calculated
  1. Kasiski: a sequence repeated in the ciphertext is often the same plain text under the same part of the key, so the gap between repeats is a multiple of the key length. Factors of the gaps point at likely lengths.
  2. Index of coincidence IC = sum of n(n - 1) over the letters / (N (N - 1)). English text is near 0.066 and random letters near 0.038.
  3. For each key length k the text is split into k columns, and the IC of each column is averaged. The right length gives columns that look like English, so a high average.
  • These are clues and not proof. Short texts give noisy results, and the reference IC values are for English. This is a teaching and puzzle tool.

Calculated using SumPanda.com · https://sumpanda.com/kasiski-and-index-of-coincidence-analyzer/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the kasiski and index of coincidence analyzer

  1. Paste the ciphertext. Only the letters A to Z are used.
  2. Set the length of repeats to search for and the longest key length to try.
  3. Read the key length with the highest index of coincidence and the whole-text index.
  4. Use the repeat table to see the gaps and which key lengths divide them.

Formula

Index of coincidence IC = sum of n(i) x (n(i) - 1) / (N x (N - 1)) over the 26 letters

For a key length k, split the text into k columns and average the IC of the columns

Kasiski: find repeated groups of letters, take the gaps between repeats and count the common factors

English text has an IC near 0.067. Random letters have an IC near 0.038, which is 1/26.

A short message with the key LEMON

The sample is a real Vigenere ciphertext made with the key LEMON, which has 5 letters. The whole-text IC is 0.0407, close to random, which suggests more than one alphabet is in use. Splitting the text into 5 columns raises the average IC to 0.0878, the highest of any length tried, so the key length is 5.

The tool also found 20 repeats of 3 letters. The first, XTS, appears at positions 6, 71, 101 and 121, with gaps of 65, 30 and 20. All of these are multiples of 5, and 5 is the most common factor among the gaps.

Two ways to find the key length

A Vigenere cipher shifts each letter by a letter of a repeating key. If the same piece of text lines up with the same part of the key, it gives the same ciphertext. The distance between two such repeats must then be a multiple of the key length, which is the Kasiski test. The index of coincidence takes a different view. When the text is split by the correct key length, each column has been shifted by a single letter and behaves like plain language, so its IC rises toward 0.067.

The two methods support each other. When both point to the same length, the key is probably that long and each column can be solved like a simple shift cipher.

Limits

Short messages give noisy results, and some repeats are chance. A key that is almost as long as the message hides the pattern. This tool finds a length and does not recover the key. To encrypt and decrypt with a known key use the Vigenere Cipher Tool, and for the same idea with bytes the Repeating Key XOR Tool. The Word Frequency Counter and the Shannon Entropy Calculator give other views of text statistics.

Assumptions and limits

  • The text is a polyalphabetic cipher with a repeating key, written in 26 letters.
  • Spaces, digits and punctuation are ignored.
  • The sample is an example. Use your own ciphertext.
  • Everything is calculated in your browser and nothing is uploaded.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What IC value should I expect?

About 0.067 for English text, 0.038 for random letters. The value for a good key length falls between those.

Why try a range of key lengths?

Multiples of the true length also score high, so the tool lists the average IC for each length and you pick the smallest that stands out.

Does it work on a simple shift cipher?

A single shift keeps the IC of the language, near 0.067, so the whole-text value alone shows that it is not polyalphabetic.

Does the tool find the key?

No. It estimates the key length. Once you have that, each column can be attacked with letter frequencies.