Skip to main content

Text N-Grams Generator

Extract word and character n-grams from any input text with ranked frequency counts and percentage breakdowns per sequence. Supports stop word removal, case sensitivity toggling, n-gram sizes from 1 to 10, minimum frequency filtering, and full CSV export.

Runs entirely in your browser

This tool sends nothing over the network. Everything you enter is processed on your device and never reaches our servers.

Text Analysis
Linguistics
NLP
Loading the tool
Reference

Documentation

An n-gram is a contiguous sequence of n items extracted from a given text. Word n-grams group consecutive words, while character n-grams group consecutive characters, including the spaces between them. Frequency analysis of n-grams reveals common phrases, repeated patterns, and structural tendencies within any body of text; the output is a ranked frequency table of every discovered n-gram, showing occurrence counts and, optionally, each one's percentage of the total.

Word mode splits text on whitespace and punctuation boundaries to produce sequences of whole words; character mode slides a window across the raw text to produce sequences of individual characters. The n value sets how many tokens each n-gram spans: 1 produces unigrams, 2 produces bigrams (pairs), 3 produces trigrams, and so on up to 10.

Filtering and display are configurable independently of the extraction itself. A minimum frequency threshold drops n-grams that appear fewer times than the setting, and a maximum results cap limits how many rows the table shows. Case-sensitive matching distinguishes uppercase and lowercase variants rather than merging them; removing common stop words excludes articles, prepositions, and other high-frequency function words from word n-grams. Results sort by frequency or alphabetically, and a percentage column can be shown or hidden. Fractions (3/4), mixed numbers (5 1/16), decimals (0.75), and scientific notation (1.5e3) are all accepted in the numeric fields, including n-gram size, minimum frequency, and maximum results.

Results export to CSV with the n-gram text, frequency count, and percentage for each entry, and a previously exported CSV carrying n-gram and frequency columns can be imported back in to populate the table directly.

N-gram frequency analysis applies across many domains where understanding text patterns, word co-occurrences, or character sequences provides actionable insight. Below are practical scenarios illustrating how different fields benefit from n-gram generation.

  • Content Writing: Analyze blog posts and articles to identify overused phrases and repetitive bigrams. A writer reviewing a 2000-word article might discover that "in order to" appears 14 times and replace several instances with more direct phrasing.
  • SEO Analysis: Extract the most frequent word bigrams and trigrams from top-ranking competitor pages to identify keyword phrases worth targeting. Comparing n-gram frequency tables across multiple pages reveals shared terminology and content gaps.
  • Academic Research: Examine a corpus of research papers to find domain-specific collocations and frequently co-occurring technical terms. A linguistics researcher studying a 50,000-word corpus can identify statistically significant bigrams that indicate fixed expressions.
  • Plagiarism Detection: Compare trigram frequency tables between two documents to find overlapping three-word sequences. A high overlap percentage between submissions suggests shared source material or insufficient paraphrasing.
  • Natural Language Processing: Generate character-level n-grams for language identification or spelling correction models. Character trigram profiles differ between languages, enabling automatic classification of unknown text samples by comparing their trigram distributions against reference profiles.
  • Social Media Monitoring: Analyze a collection of tweets or posts mentioning a brand to identify the most common two-word and three-word phrases customers associate with a product. Tracking these n-grams over time reveals shifts in public perception and emerging topics of conversation.
  • Cryptography: Apply character bigram and trigram frequency analysis to ciphertext as part of classical cipher-breaking techniques. Comparing observed n-gram frequencies against known language statistics helps identify substitution patterns and narrow the key space.
  • Speech coaching: Analyze a transcript of recorded speech to identify word-level bigrams that mark habitual filler patterns or disfluencies. Tracking n-gram frequency across recordings measures progress in fluency practice.
Inputs, outputs, and what the Text N-Grams Generator computes

What the Text N-Grams Generator asks for and what it returns, as a plain list. Defaults, units, and ranges are the ones the form loads with.

Inputs

  • Text to analyze
  • Word / Character · default: Word
  • N (number of tokens per n-gram) (numeric input) · default: 2 · range: 1 to 10
  • Minimum frequency (numeric input) · default: 1 · minimum: 1
  • Maximum results (numeric input) · default: 100 · minimum: 1
  • Case-sensitive · default: off
  • Remove common stop words · default: off
  • Frequency (descending) / Alphabetical · default: Frequency (descending)
  • Show percentages · default: on

Controls

Generate · Reset · Export CSV