N-gram Frequency Chart Calculator

Explore word and character n-grams, compare documents, customize preprocessing, inspect matching contexts, visualize patterns, and export complete frequency analysis results instantly online with ease.

Analysis results

Enter text and select Analyze N-grams.
No analysis

Selected N-gram contexts

Click a chart item or result row.
Matching source contexts will appear here.

Statistical interpretation

The calculator will summarize concentration, diversity, repetition, and comparison patterns.
Rank N-gram N Count A Count B Difference Relative A Percent A Cumulative First position Document frequency
No calculated results.

1. Text sources

0 characters · 0 words · 0 sentences
0 characters · 0 words · 0 sentences
CSV files are processed in your browser. Quoted commas are supported.

2. N-gram and tokenization settings

Tokens will appear here.

3. Text preprocessing

4. Frequency, filtering, and sorting

5. Chart customization

6. Formula and method

Raw frequency: the number of times an N-gram occurs.

Relative frequency: N-gram count divided by all generated N-grams.

Percentage frequency: relative frequency multiplied by one hundred.

Document frequency: the number of analyzed documents containing that N-gram.

How to use this calculator

Paste text or upload a supported file. Choose word, character, or custom token analysis. Set one N value or analyze a range.

Adjust preprocessing before running the calculation. Filters control which N-grams remain visible. Chart settings change the visualization without altering the source text.

Click any result to inspect its contexts. Export tables and charts for reports. Browser storage can preserve your preferred settings.

Example data

TextNExpected repeated N-gramCount
machine learning improves models and machine learning supports predictions2machine learning2
data data science data1data3
banana2 charactersan2

N-gram analysis guide

An N-gram is a sequence of N neighboring tokens. Word bigrams contain two adjacent words. Character trigrams contain three adjacent characters.

Smaller N values reveal broad vocabulary patterns. Larger values capture phrases and local context. Very large values often produce sparse results.

N-grams support language models, search, spam detection, classification, authorship analysis, autocomplete, and sentiment analysis. Preprocessing choices strongly affect every reported frequency.

Frequently asked questions

What is the best N value?

Start with bigrams for phrases and unigrams for vocabulary. Try several values when context matters.

Should stop words be removed?

Remove them for content-focused exploration. Keep them when grammar and phrase structure matter.

Why prevent N-grams crossing sentences?

Cross-sentence sequences are often accidental. Sentence protection produces more meaningful language patterns.

When are character N-grams useful?

They help with spelling variation, language identification, noisy text, and morphology.

What does document frequency mean?

It counts how many analyzed documents contain an N-gram at least once.

Why do totals change after preprocessing?

Removed tokens and altered boundaries change every available sequence and denominator.

What is a Zipf chart?

It plots rank against frequency, often revealing a steep power-law-like decline.

Can this compare two documents?

Yes. Enable comparison, add text B, and select a comparison chart.

Is uploaded text sent anywhere?

No. This page processes supported text files inside your browser.

Related Calculators

Word Frequency Bar ChartDocument-Length HistogramSentiment Distribution PlotTopic Distribution ChartTopic-Term HeatmapWord-Embedding Scatter PlotConfusion Matrix for Text ClassesAttention MatrixToken Probability PlotVocabulary Coverage Curve

Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.