1001Ferramentas
📐 Security

Index of Coincidence Calculator

Compute Index of Coincidence (IC) of ciphertext to distinguish mono/polyalphabetic ciphers — classic cryptanalysis tool.

Telling monoalphabetic from polyalphabetic ciphertext

You have a block of ciphertext and no idea where to start. Caesar? Simple substitution? Vigenere with a five-letter key? Brute-forcing every option wastes hours, and the index of coincidence exists for exactly that first triage: a single number derived from letter counts that separates single-alphabet ciphers from ones that rotate through several alphabets.

IC is the probability that two letters drawn from the text without replacement are identical: the sum of nᵢ(nᵢ−1) divided by N(N−1). Monoalphabetic substitution only relabels letters and preserves the distribution, so it keeps the language IC, near 0.072 for Portuguese and 0.067 for English. A polyalphabetic key flattens frequencies and drags the value toward 1/26, that is 0.0385. The sample text loaded on the page scores 0.0675 across 79 letters.

IC needs volume: below about a hundred letters it swings too much to support any conclusion, and the ranges the page prints are guidance rather than a verdict. The tool computes one IC for the whole text; it does not test periods or estimate key length. To do that, slice the ciphertext into columns for candidate periods 2, 3, 4 and run each column through here: when the columns start reading near 0.07, you have found the period. Accented letters and the cedilla are discarded before counting, not folded.

Frequently asked questions

How much ciphertext do I need?
Around a hundred letters upward the figure becomes informative. Under fifty it is statistical noise and will not support any claim about the cipher type.
I got 0.045. What does that mean?
It suggests a polyalphabetic cipher with a short key, Vigenere-style. Next step is period testing: split the text into columns per candidate period and compute the IC of each column.
Does it work on Portuguese text with accents?
Yes, but accented letters and the cedilla are removed before counting rather than normalized. The IC is computed over the plain A-Z alphabet, which slightly reduces N.

Related Tools