Zipf's Law Word Frequency Calculator

Statistics

Predicted frequency8,774 occurrences
Share of all tokens0.877 %
Harmonic sum H11.397
Frequency of the top word87,742 occurrences
How this was calculated
  1. Generalized harmonic sum over the 50,000-word vocabulary: H = 11.397.
  2. Rank factor: 10^-1.0 = 0.1000.
  3. Share of tokens: 0.1000 / 11.397 = 0.877 %.
  4. Predicted frequency: 0.877 % of 1,000,000 tokens = 8,774 occurrences.

Open any large text collection and count the words, and a startling pattern appears: the second most common word occurs about half as often as the first, the tenth about a tenth as often, the hundredth about a hundredth. That is Zipf's law - frequency falls as the inverse of rank - and it holds, approximately, for every natural language ever measured, as well as for city sizes, incomes and a zoo of other ranked lists.

Turning the law into numbers for a real corpus needs one more ingredient: the shares must sum to one across the whole vocabulary, which is done by dividing by the generalized harmonic sum H over all ranks. This calculator performs that normalisation exactly - summing r^-s over the full vocabulary rather than approximating - and returns the predicted count and token share of the word at any rank, for your corpus size, vocabulary and exponent.

Worked examples

Rank 10, 8,774 occurrences

(10 · 1 · 1000000 · 50000)

Predicted frequency8,774 occurrences
Share of all tokens0.877 %
Harmonic sum H11.397
Frequency of the top word87,742 occurrences

Rank 2, 5,109 occurrences

(2 · 1 · 100000 · 10000)

Predicted frequency5,109 occurrences
Share of all tokens5.109 %
Harmonic sum H9.788
Frequency of the top word10,217 occurrences

Rank 100, 4,250 occurrences

(100 · 1.1 · 5000000 · 100000)

Predicted frequency4,250 occurrences
Share of all tokens0.085 %
Harmonic sum H7.422
Frequency of the top word673,657 occurrences

Zipf's law and the harmonic sum

In symbols: the share of the rank-r word is (1 / r^s) / H, where H = sum over k = 1..N of k^-s and N is the vocabulary size. At the classic exponent s = 1, H is the ordinary harmonic number: 11.397 for a 50,000-word vocabulary, 9.788 for 10,000 words. H grows only logarithmically, which is why the top word's share shrinks slowly as vocabularies grow - the language spreads itself over more words, but the champion keeps a healthy slice.

The exponent s is the law's one free parameter. English text usually fits s close to 1; larger s concentrates frequency in the top ranks (the 1.1 example's H over 100,000 words is only 7.422, and its top word takes a much larger share), while smaller s flattens the distribution. Specialised corpora - legal contracts, source code, children's books - each have their own characteristic s, and fitting it is the first step of any serious Zipf analysis.

  • Share of rank r: (r^-s) / H, with H = sum of k^-s over the vocabulary
  • Count = share x corpus tokens
  • At s = 1, H(50,000) = 11.397 and H(10,000) = 9.788
  • Larger s concentrates frequency in the top ranks

Worked examples: three corpus sizes

The reference corpus: 1,000,000 tokens, 50,000 words of vocabulary, s = 1. The rank-10 word is predicted 8,774 times - 0.877 % of all tokens - and the top word 87,742 times, exactly ten times the rank-10 count, as the 1/r pattern demands. In an English-like corpus that top word is 'the', and its roughly 8.8 % share is in the family of what real corpora show.

Scale down to 100,000 tokens with 10,000 words of vocabulary and the rank-2 word takes 5,109 occurrences, a 5.109 % share - the runner-up always holds about half the champion's share at s = 1. Scale up instead to 5,000,000 tokens, 100,000 words and s = 1.1, and the rank-100 word is predicted 4,250 times (0.085 %) while the top word swells to 673,657 - the steeper exponent handing the head of the distribution a much larger prize.

A concrete feel for the head of the distribution helps: in the reference corpus the top ten ranks - ten word types out of 50,000 - account for the champion's 87,742 plus the descending shares of ranks 2 to 10, together well over a fifth of all tokens. Half the vocabulary, by contrast, appears once or twice. Any system that processes text - a search index, a spell checker, a language model - lives on this asymmetry: optimise for the head, because the head is where the tokens are, and handle the tail cheaply, because the tail is where the types are.

Corpus tokensVocabularysHRankPredicted count
1,000,00050,000111.397108,774
100,00010,00019.78825,109
5,000,000100,0001.17.4221004,250

Choosing the exponent s

Fitting s is an empirical exercise: plot log frequency against log rank for your corpus and the slope of the straight middle section is -s. Real corpora bend at both ends - the very top words are function words obeying grammar more than statistics, and the tail is full of words seen once (hapax legomena) whose counts cannot fall below one - so the fit is taken over the middle ranks. The calculator's default of s = 1 is the right starting point for general text; try 1.1 for a sense of how much the head of the distribution moves.

Vocabulary size matters through H and is the input users most often guess. A million-token English corpus typically shows 30,000-60,000 distinct word forms depending on tokenisation - whether 'run', 'runs' and 'running' count as one word or three changes N severalfold. Use the vocabulary your own tokeniser reports; the law cannot rescue an inconsistent count.

Estimating the vocabulary input from a sample is its own small science. A corpus of 1,000,000 tokens showing 50,000 types will show far more types at 5,000,000 tokens - vocabulary grows with corpus size roughly as a power law (Heaps' law), which is why the large example pairs 5,000,000 tokens with 100,000 words rather than the same 50,000. When you scale a corpus up, scale the vocabulary input too, or H will be understated and every predicted count overstated. The two laws, Zipf for frequency and Heaps for vocabulary growth, are really one phenomenon seen from two sides.

Where Zipf's law shows up

Linguistics is the home turf - the law predicts that a tiny vocabulary covers most of any text, which is why language courses teach the top few thousand words first: at s = 1 the top 10 words of the reference corpus already cover a large share of all tokens. Information retrieval uses the same shape to size inverted indexes and to understand why stop-word removal works. Search engines, cache designers (request frequencies are Zipf-like, which is why caching works at all) and network engineers all plan against this curve.

Beyond language: city populations, firm sizes, website visits, earthquake energies' cousins in the Gutenberg-Richter family, and the citation counts of papers all show power-law rank patterns in the Zipf family. The calculator is built for words, but the arithmetic - rank, exponent, harmonic normalisation - is the shared skeleton of all of them.

Limits of the law at the tail

Zipf's law is an empirical regularity, not a theorem, and it frays exactly where counts get small. The predicted count for a high rank in a modest corpus quickly falls below one occurrence - a statement about expectation across many corpora, not about your text, where the word appears a whole number of times or not at all. Treat tail predictions as orders of magnitude. The head and middle - ranks up to a few thousand in a million-token corpus - are where the law earns its reputation, and where the examples on this page live.

The law also says nothing about which word sits at a rank, only how frequent it should be. Content words move ranks between topics - 'photosynthesis' outranks 'democracy' in a biology corpus - while the shape of the curve persists. That separation between shape and occupant is what makes the law at once universal and, for any specific word, only a prior.

Why the law holds at all is still argued about. Zipf himself blamed a principle of least effort balancing speaker and hearer; later accounts derive the curve from random typing with a space character, from preferential attachment, or from the statistics of topics mixing. For the calculator's purposes the mechanism does not matter: the empirical curve, its exponent and the harmonic normalisation are what you fit to a corpus, and the worked examples show the fit is good enough to plan storage, teaching lists and index sizes around.

For practitioners, the most common use is expectation-setting: before counting a corpus, you can predict roughly how many distinct words will pass a frequency threshold, how large a vocabulary a language course must teach to cover 90 % of text, or how skewed a request stream a cache will face. The predictions will not be exact - the law is a regularity, not a contract - but they are rarely off by enough to change a design decision, and they cost thirty seconds.

Sanity anchor: at s = 1 the rank-r word should occur about (top word count) / r times - 87,742 / 10 = 8,774 in the reference corpus, matching the calculator's normalised result.

FAQs

In a 1,000,000-token corpus with 50,000 words, how often does the rank-10 word appear?

8,774 times: its share is 0.877 % after normalising by H = 11.397.

How often does the most frequent word appear in that corpus?

87,742 times - ten times the rank-10 word, exactly the 1/r pattern at s = 1.

The rank-2 word in a 100,000-token corpus with 10,000 words?

5,109 occurrences, a 5.109 % share, with H = 9.788.

What changes when the exponent rises to 1.1?

Frequencies concentrate: H drops to 7.422 over 100,000 words and the top word of the 5,000,000-token corpus reaches 673,657.

How often is the rank-100 word predicted in that large corpus?

4,250 times - a 0.085 % share.

Why does vocabulary size enter the calculation at all?

Because the shares must sum to one across the vocabulary: the harmonic sum H (11.397 for 50,000 words) is the normaliser.

Sources

Related calculators

Benford's Law Calculator
Expected frequency of each leading digit under Benford's law, with the expected count in your dataset and a deviation check value.
Percentile Rank Calculator
Where a score stands in its group, with the standard half-credit for ties.
Farey Sequence Calculator
The Farey sequence of any order: how many reduced fractions it holds, and the rank, predecessor and successor of a chosen fraction, using the determinant identity between neighbours.