Home / Knowledge Base / Glossary / Zipf's Law: Text Analysis and Online Calculator

Zipf's Law: Text Analysis and Online Calculator

Glossary 9 min read Updated 12.10.2026
Where the frequency distribution pattern of words comes from, why it's calculated by SEO tools and AI text detectors, how to read the metric, and what it does not prove.

Zipf's law is an empirical pattern: in natural text, a word's frequency is inversely proportional to its rank in the frequency table. The most common word appears roughly twice as often as the second, three times as often as the third, and so on. Analyzing a text with Zipf's law shows how close its word distribution is to a natural one. You can check your text online for free with the Zipf's law calculator, which plots the log-log chart and calculates the slope, R² and a fit index; the PromoPilot AI Detector also reports a "Zipf's Law" metric among its results. Below: the formula, how to read the results and how to check a text by hand.

The Zipf's law formula

In general form the law is written as f(r) = C / rα, where f is the word's frequency, r is its rank (its position in the list sorted by descending frequency), C is a constant roughly equal to the frequency of the most common word, and the exponent α is close to one for natural language. A simple consequence: rank times frequency, r × f, stays roughly constant.

Word rankExpected frequency at α = 1Rank × frequency
1120120
260120
340120
430120
1012120

Plot it on logarithmic axes — log of rank on the horizontal axis, log of frequency on the vertical — and the points of a natural text fall almost on a straight line with a slope of about −1.

How to check a text against Zipf's law online

Option 1: the Zipf's law calculator

  1. Open the Zipf's law text analyzer. It is free, and the whole calculation runs in your browser.
  2. Paste your text. The minimum is 50 words, but for reliable conclusions use 300 words or more, ideally 1,000+: on short texts a couple of repeats noticeably shift the slope.
  3. If you like, turn on stop-word removal (English, Polish, Ukrainian and Russian lists) to see only content words.
  4. You get a rank–frequency chart on log-log axes with the ideal Zipf line (slope −1), the slope of your text, R² (how well the points fit a straight line) and a Zipf fit index from 0 to 100: 80+ is a close fit, 60–79 moderate, below 60 weak.
  5. Below the chart, a table of the top 30 words compares the actual count with what Zipf's law predicts and flags words that appear noticeably more often than expected — the first candidates for keyword stuffing.

Option 2: the Zipf's law metric in the AI Detector

  1. Open the AI Detector. No sign-up needed.
  2. Paste the text or enter a page URL — the tool will extract the text itself. Use at least 100 words, preferably 200 or more: on a short fragment the metric tells you little.
  3. Choose the language or leave auto-detection on, and click "Check".
  4. In the "Detector Metrics" block, find the "Zipf's Law" row with the hint "Word frequency distribution". If the deviation is noticeable, the "Explanations" block will include a line saying that word frequencies deviate from the natural distribution.

The same metric is available in the advanced version of the detector, where it appears on a radar chart alongside other indicators and a sentence-by-sentence breakdown of the text.

How the AI Detector calculates the metric

  • The text is split into words on spaces, words are lowercased and punctuation is stripped. There is no lemmatization: "link", "links" and "linking" count as different words.
  • Frequencies are sorted in descending order, and for the top 50 ranks the actual frequency is compared with the theoretical f(1) / r. The mean relative deviation is calculated.
  • The "tail" — rare words in the bottom third of the list — is scored separately: a tail that is too uniform also counts as a deviation.
  • Both scores are weighted equally. If the text has fewer than 50 words, the metric returns a neutral 50%; it reaches full strength at 200 words and above, and at in-between lengths the result is pulled toward 50%.

How to read the result

ValueBar colorWhat it means
up to 40%greenThe frequency distribution is close to natural
40–70%yellowA noticeable deviation; on texts under 200 words often just because of length
over 70%redA strong deviation: keyword stuffing, templated writing or a monotonous vocabulary

The higher the percentage, the further the text is from the Zipf curve. That said, the metric carries little weight in the final AI-generation probability — about 3%: it is unreliable on short texts, and the detector relies mainly on other signals. How to read the full report is covered in the article on checking text for AI.

Checking by hand: a word frequency list and a log-log plot

If you want to see the curve itself rather than a single number, it is easy to build on your own.

  1. Clean the text: lowercase, no punctuation or digits. Results are more accurate if you reduce words to their base form (lemmatize) — this matters most for heavily inflected languages, but even in English "link" and "links" would otherwise be counted separately.
  2. Count how many times each word occurs and sort the list in descending order. The row number is the rank.
  3. Add two columns: =LOG10(rank) and =LOG10(frequency).
  4. Build a scatter chart from those columns and calculate the slope: in Excel and Google Sheets, use the SLOPE function.

The same thing in Python:

import re, math
from collections import Counter

text = open("text.txt", encoding="utf-8").read().lower()
words = re.findall(r"[а-яёa-z]+", text)
freqs = sorted(Counter(words).values(), reverse=True)

xs = [math.log10(r) for r in range(1, len(freqs) + 1)]
ys = [math.log10(f) for f in freqs]
n = len(xs); mx = sum(xs) / n; my = sum(ys) / n
slope = sum((x - mx) * (y - my) for x, y in zip(xs, ys)) / sum((x - mx) ** 2 for x in xs)
print("slope:", round(slope, 2))  # about -1 for natural text

Example: a normal text vs a keyword-stuffed one

An illustrative example based on a roughly 600-word article about laptop repair. In the normal version, the top of the frequency list looks like this: "the", "and", "to", "of", "laptop" — function words at the top, the topical word in fifth place, frequencies falling off smoothly. In the stuffed version, where the author crammed "laptop repair" into every sentence, the picture is different:

RankNormal textKeyword-stuffed text
1the — 31laptop — 34
2and — 17repair — 33
3to — 11the — 29
4of — 8and — 15
5laptop — 6to — 10

In the first column, frequencies behave like 31 / r; in the second, the first two ranks are almost equal — that is the deviation from Zipf's law, visible without any tools. The detector catches it automatically, and on a log-log chart such words show up as a "shelf" at the start of the curve.

How to interpret deviations

What you see on the chartPossible cause
A topical word sits in the top three next to articles and prepositionsKeyword stuffing — check the keyword density
The slope is noticeably steeper than −1A narrow vocabulary, lots of repetition of the same words
The slope is noticeably shallower than −1Lists of terms, tables, lists of names
A long flat tail of words that appear onceA short text — this is normal, not a sign of a problem

Why Zipf's law matters for SEO

  • Spotting keyword stuffing: if a keyword breaks out of the distribution, it is repeated too often.
  • Gauging vocabulary richness: a flat or overly steep distribution points to impoverished language.
  • Benchmarking against competitors: more useful than abstract norms — look at what the top-ranking texts for your query look like.
  • One of the signs of machine-generated text: a deviation is an indirect signal that the text was assembled from templates or generated.
Limitations of the metric
Don't draw conclusions from a single metric. A close fit to the curve doesn't prove a human wrote the text, and a poor fit doesn't prove a machine did: short texts, niche terminology and lists break the distribution on their own. Zipf's law does not affect rankings and is not a search ranking factor: it is a measuring tool, and tweaking a text to fit the curve is pointless.

Zipf's second law

Text analysis sometimes also mentions Zipf's second law. It describes the other side of the distribution: how many different words share the same frequency. The lower the frequency, the more such words there are: words that appear only once are the most numerous — in a typical text they make up a large part of the vocabulary. This is exactly the "tail" the detector scores separately: in natural text it is uneven, in templated text it is suspiciously smooth.

Where the law comes from

The pattern was described by the American linguist George Zipf in the 1930s–1940s, although similar observations about word frequencies had been made before him. It was later found far beyond language — in city sizes, incomes and website traffic. For texts it holds up remarkably well: in any sufficiently large natural text, word frequencies fall onto the same curve. The top ranks are almost always taken by function words — articles, prepositions, conjunctions, pronouns — while the meaningful topic words sit lower, and it is their share that shows what the text is about.

FAQ

How do I check a text against Zipf's law online?
Paste the text into PromoPilot's free Zipf's law calculator: it builds a log-log chart and shows the slope, R², a 0–100 fit index and words that appear more often than expected. The AI Detector also has a "Zipf's Law" metric in its results. Use at least 300 words, ideally 1,000+.
What does the percentage in the AI Detector's Zipf's Law metric mean?
How far the word frequency distribution deviates from a natural one: up to 40% is close to normal, 40–70% is a noticeable deviation, over 70% is strong. Don't draw conclusions from a single metric.
What is the formula for Zipf's law?
f(r) = C / r^α, where f is a word's frequency, r is its rank, C is the frequency of the most common word, and α is close to 1 for natural language. On logarithmic axes it is a straight line with a slope of about −1.
How do I check a text against Zipf's law by hand?
Build a word frequency list, sort words by descending frequency, take the logarithms of rank and frequency, and calculate the slope with the SLOPE function in Excel or Google Sheets.
Does Zipf's law affect rankings?
No. It is a measuring tool, not a ranking factor: tweaking a text to fit the curve is pointless.
Why does the metric show about 50% on a short text?
In a text shorter than 50 words, a frequency distribution doesn't form, so the metric returns a neutral value. It reaches full strength on texts of 200 words and more.
Was this article helpful?
Try it on your project Everything described in the article is available in the dashboard — the registration bonus is already in your balance.
Open dashboard