Split any text into word or character n-grams, from single words to five-word phrases, and see how often each one appears. Filter out stopwords, set a minimum count, and export the full frequency table as CSV.
Last updated:
N-gram type
#
N-gram
Count
Share
Advertisement
Advertisement
How to use the N-Gram Generator
Paste your text or press Load sample.
Choose Words or Characters and the gram size N, for example 2 for bigrams or 3 for trigrams.
Set filters: stopwords, minimum count, case and punctuation handling, and whether n-grams may cross sentences.
Press Generate n-grams to refresh the frequency table and top-15 chart (it also updates as you type).
Export the full list with Download CSV, or Copy table to paste into Excel or Google Sheets.
How n-grams are counted
The text is split into tokens (words, or characters), then a window of size n slides along one token at a time. Each window is one n-gram. For a sentence with T tokens:
Number of n-grams = T − n + 1 (zero when T < n)
Share of an n-gram = count ÷ total n-grams × 100%
Example with the sentence "the cat sat on the mat" (T = 6 words):
N
Name
Count (6 − n + 1)
N-grams
1
Unigram
6
the, cat, sat, on, the, mat ("the" appears twice)
2
Bigram
5
the cat, cat sat, sat on, on the, the mat
3
Trigram
4
the cat sat, cat sat on, sat on the, on the mat
4
4-gram
3
the cat sat on, cat sat on the, sat on the mat
5
5-gram
2
the cat sat on the, cat sat on the mat
Common uses
SEO and keyword research: find the two- and three-word phrases a page or a competitor's content repeats most.
Review and survey analysis: bigrams like "fast shipping" or "poor quality" summarise what customers say.
Writing and editing: spot overused phrases and repetitive sentence openings.
Language modelling and NLP classes: n-gram counts give the probabilities P(word | previous n − 1 words) ≈ count(n-gram) ÷ count(prefix).
Character n-grams: language detection, fuzzy matching and spelling suggestions.
An n-gram is a sequence of n consecutive items from a text. With words, 'machine learning model' contains two bigrams (machine learning, learning model) and one trigram. With characters, the word 'text' contains the character bigrams te, ex and xt. N-grams are a basic building block of language models, search engines, spell checkers and keyword research.
How many n-grams does a text have?
A sequence of T tokens has T − n + 1 n-grams of size n (or none if T is smaller than n). For example, 10 words give 9 bigrams and 8 trigrams. When 'Don't cross sentence boundaries' is on, the formula is applied to each sentence separately, so the total is slightly lower.
What does the stopword filter do?
Stopwords are very common words such as the, of, and, is and to. Dropping n-grams that start or end with a stopword removes fragments like 'of the' or 'the customer' while keeping meaningful phrases like 'easy to use'. You can also drop only n-grams made entirely of stopwords, drop any n-gram containing one, or keep everything.
How is the Share column calculated?
Share is the count of that n-gram divided by the total number of n-grams of the same size in the text, before stopword or minimum-count filtering, times 100. It is the relative frequency, which is the maximum-likelihood probability estimate used in simple n-gram language models.
When should I use character n-grams?
Character n-grams are useful for language identification, fuzzy matching, spelling correction, cryptography exercises and analysing letter combinations. Turn on 'Include spaces' to let n-grams span word boundaries; spaces are shown as ␣.
Is there a size limit?
There is no fixed limit; everything runs in your browser's memory. Texts of several hundred thousand words work on a modern computer, though the table shows the top rows only. The CSV always contains every n-gram that passes the filters.
Is my text uploaded?
No. All counting happens locally in JavaScript. The text is only remembered in your browser's local storage so it is still there when you come back.
Are all the tools on FreeToolCabin tested for quality and accuracy?
Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.