Skip to content
Omnikalc

Heaps' law calculator: how many different words appear in a text of a given length?

Enter the constants K and β and the text length to get the expected vocabulary size, the rate of new words and the text length needed for a target vocabulary.

Updated on
Your inputs

Value out of range

Value out of range

Value out of range

Value out of range

Results

Expected vocabulary size (different words)

13,914

New words per 1,000 extra words of text
69.6
Words of text needed for the target vocabulary
206,612
Share of the text that is a different word
13.91 %

Heaps’ law describes how the vocabulary of a text grows as the text gets longer. The Heaps’ law calculator takes the constants K and β, the number of words and a target vocabulary, and gives the expected vocabulary size, the new words per 1,000 extra words, the text length needed for the target vocabulary and the share of the text that is a different word.

How the calculation works

  • Heaps’ law says that the number of different words V grows as a power of the text length N: V = K × N^β.
  • K and β are fitted to a corpus. For English text, K is often between 10 and 100 and β between 0.4 and 0.6.
  • The rate of new words is the derivative, K × β × N^(β − 1) per word, so it falls as the text gets longer. The calculator multiplies it by 1,000.
  • To find the text length needed for a target vocabulary, solve the law for N: N = (V ÷ K)^(1 ÷ β).

Example

With K = 44 and β = 0.5, a text of 100,000 words has about 44 × 316.2 = 13,914 different words, which is 13.9 % of the text. Each extra 1,000 words adds about 69.6 new words. To reach a vocabulary of 20,000 different words, the text must contain (20,000 ÷ 44)² = about 206,612 words.

Why it matters

Anyone who builds a search index, a language course or a text analysis needs to know how fast the vocabulary grows. The law gives a quick way to plan storage, estimate reading volume and compare texts.

Good to know

The law is empirical and fits large natural-language corpora well, but not tiny samples or very repetitive texts. The constants change with the language and the way words are counted. Use values fitted to a corpus like yours, and treat the results as approximate.

The readability calculator scores how easy a text is, and the reading time calculator estimates how long a text takes to read.

Frequently asked questions

What is Heaps' law?

It is an empirical law of linguistics and information retrieval, named after Harold Heaps, which says that the number of different words in a text grows more slowly than the text itself. It follows a power law, so doubling a text does not double its vocabulary, it increases it by a smaller factor.

What values of K and β are typical?

For English corpora, K usually falls between 10 and 100, and β between 0.4 and 0.6. They vary with the language, the genre and the way words are counted. Morphologically rich languages tend to have higher β, since each root appears in many forms.

How can I estimate K and β for my own texts?

Count the vocabulary at several text lengths, for example at 1,000, 10,000 and 100,000 words, and fit a straight line to the logarithms of both. The slope is β and the intercept gives the logarithm of K. More points give a more reliable fit.

What is it used for?

Search engine designers use it to predict the size of an index, linguists compare languages, and teachers estimate how much reading a learner needs to meet a given number of different words. Compression and database planning also use it.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.