Skip to main content

Text N-Grams Generatorv1.0.0

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. 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 all discovered n-grams, showing occurrence counts and optional percentage breakdowns.

  • Paste or type your source text into the Text to analyze textarea. The generator accepts any length of plain text, from a single sentence to full documents.
  • Select the N-Gram Type. Choose Word to split the text on whitespace and punctuation boundaries, producing sequences of whole words. Choose Character to use a sliding window across the raw text, producing sequences of individual characters including spaces.
  • Set the N (number of tokens per n-gram) field to your desired n-gram size. A value of 1 produces unigrams (single words or characters), 2 produces bigrams (pairs), 3 produces trigrams, and so on up to 10.
  • Click the Generate button to run the analysis. Results appear below as a frequency table showing each n-gram, its count, and its percentage of the total.
  • Open the Settings panel to adjust filtering and display. Set Minimum frequency to filter out n-grams that appear fewer times than the threshold. Set Maximum results to cap the number of rows displayed. Enable Case-sensitive to distinguish between uppercase and lowercase variants. Enable Remove common stop words to exclude articles, prepositions, and other high-frequency function words from word n-grams. Choose between Frequency and Alphabetical sorting. Toggle Show percentages to include or hide the percentage column.
  • Fractions (3/4), mixed numbers (5 1/16), decimals (0.75), and scientific notation (1.5e3) are supported in all numeric input fields such as n-gram size, minimum frequency, and maximum results.
  • To import previously exported data, click the Import CSV file input and select a .csv file containing n-gram and frequency columns. The imported data populates the results table directly.
  • Click the Export CSV button to download the current results as a .csv file containing the n-gram text, frequency count, and percentage for each entry.
  • Click the Reset button to clear all inputs, results, and saved settings, restoring every field to its default value.

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 and Language Therapy: Analyze transcripts of patient speech to identify word-level bigrams that indicate habitual filler patterns or disfluencies. Tracking the frequency of specific n-grams across sessions measures progress in fluency training programs.
Inputs, outputs, and what the Text N-Grams Generator computes

The form above accepts the following inputs and produces the outputs listed below. This summary is rendered in the page so the parameters are visible to crawlers, assistive tech, and indexing agents that don't fetch the embedded tool frame.

Inputs

  • Text to analyze
  • Word · default: word
  • Character · default: character
  • 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
  • Remove common stop words
  • Frequency (descending) · default: frequency
  • Alphabetical · default: alphabetical
  • Show percentages

Controls

Generate · Reset · Export CSV

Worked example

An n-gram is a contiguous sequence of n items extracted from a given text.