🧰 ToolPicoAll Tools →

Text Compare Tool

Find the difference between two texts in seconds. Word, line, and character-level colored diff; side-by-side and inline view, and a similarity ratio — all in your browser.

Word · Line · Character 100% in your browser Similarity ratio Updated: Jul 19, 2026
🔧 This looks like JSON.
🔧 This looks like JSON.
0 / 0
0 / 0
Quick answer Text comparison means viewing two texts side by side or inline to find the difference between them. This tool works at the word, line, and character level; it highlights added parts in green and removed parts in red, and calculates a similarity ratio. The LCS algorithm runs entirely in your browser — your text is never sent to a server.
3 modesWord · Line · Character
2 viewsSide-by-side & inline
100%In your browser, private
LCSExact diff algorithm
🔒 Privacy: All comparison happens inside your browser; your text is never sent to or stored on a server. You can safely compare contracts, source code, or personal documents. Only clicking "Copy link" encodes your text into a shareable address — avoid that button for sensitive content.

What is text comparison, and how do you compare two texts?

A full explanation of finding the difference (diff) between two texts, calculating a similarity ratio, and choosing between word, line, and character mode.

Text comparison (diff) is the process of automatically finding and displaying, in color, the differences between two texts, documents, or blocks of code. The goal is to see at a glance which parts were added, which were removed, and how similar the two versions are. This tool aligns the two texts using their longest common subsequence (LCS); parts found only in the first text are highlighted in red, and parts found only in the second text are highlighted in green.

How do you compare two texts?

Quick answerPaste the old text into Text A and the new text into Text B (or upload a .txt file), then choose word, line, or character mode. The tool aligns the two texts, highlighting additions in green and removals in red. The result updates instantly as you type.
  • Paste / upload — enter the texts in the two boxes, or load them from a file.
  • Choose a modeline for code, word for plain text, character for the finest-grained difference.
  • Options — ignore case, whitespace, or punctuation differences if needed.
  • View — switch between side-by-side (two columns) and inline (combined) view.

What is a diff, and how does it work?

Quick answerA diff splits two texts into parts (lines, words, or characters) and finds the longest common subsequence between them. Shared parts are "matched," parts only in A are "removed," and parts only in B are "added."

This tool uses its own vanilla-JavaScript implementation of the LCS (Longest Common Subsequence) algorithm — no external library is loaded. Any common leading and trailing sections of the two texts are trimmed first (in most edits, most of the text is unchanged), and dynamic programming finds the longest common sequence in the remaining middle section. This way, even texts with thousands of lines are processed quickly in your browser.

How is the similarity ratio calculated?

Quick answerSimilarity = (2 × matched) / (2 × matched + added + removed) × 100. If two texts are exactly the same, the ratio is 100%; if completely different, it approaches 0%. The ratio is calculated based on the mode you chose (line/word/character).

For example, if 90 of 100 words in two texts match, 6 words were removed, and 8 words were added, the similarity is (2×90) / (2×90 + 8 + 6) × 100 ≈ 92.8%. Character mode gives the most precise ratio; line mode measures structural similarity.

What's the difference between word, line, and character mode?

Quick answerLine mode compares whole lines (best for code and structured text); word mode shows word-level changes within a sentence (best for plain text); character mode catches every single letter difference (best for spotting typos).

Example comparison & reference tables

A real example showing how to read a diff, a mode-selection guide, and an explanation of the colors and marks used.

Example: A = "red fast car", B = "blue fast car" (word mode)
WordText AText BStatus
redyesremoved
blueyesadded
fastyesyesmatched
caryesyesmatched

Similarity = (2×2) / (2×2 + 1 + 1) × 100 ≈ 66.7%. "red" was removed and replaced with "blue"; "fast car" is unchanged.

Which mode fits which situation?
ModeWhat it doesBest for
LineCompares whole linesSource code, config files, logs, lists
WordShows word-by-word differencesPlain text, articles, translations, emails
CharacterCatches every letter/mark differenceTypo fixes, short text, passwords/keys

Line mode is the fastest for large texts; character mode is the most detailed but the slowest.

Colors and marks in the diff output
MarkColorMeaning
+GreenAdded — only present in Text B
Red (strikethrough)Removed — only present in Text A
(none)NeutralMatched — identical in both texts

In side-by-side view, the left column is Text A (removals in red) and the right column is Text B (additions in green).

Ignore options
OptionEffectExample
Ignore caseLetter case is not counted as a differenceHello = hello
Ignore whitespaceExtra spaces and indentation are not counted"a  b" = "a b"
Ignore punctuationPeriods, commas, etc. are ignored"Yes!" = "Yes"

These options hide irrelevant differences so you can focus only on meaningful changes.

Text comparison terms glossary

Short definitions of terms commonly used in the world of diffing.

DiffA comparison that finds and displays the difference between two texts; short for "difference."
LCSLongest Common Subsequence — the longest shared subsequence between two sequences. The basis of diff alignment.
Insertion (add)A part found only in the new text (B), added relative to the old one. Shown in green.
Deletion (remove)A part found only in the old text (A), removed in the new version. Shown in red.
MatchedA part identical in both texts, left unchanged. It raises the similarity ratio.
Similarity ratioA percentage based on matched parts. 100% means identical, 0% means completely different.
Side-by-side (split)A view that shows the two texts in two separate columns; the classic "side-by-side" diff.
Inline / unifiedA view that shows differences in a single flow, interleaving additions and removals.
WhitespaceInvisible characters like spaces, tabs, and line breaks. Can be neutralized with "Ignore whitespace."
Client-sideProcessing done entirely in the browser instead of on a server, meaning your data never leaves your device.
TokenThe smallest unit of comparison: a line, a word, or a character, depending on the mode.
TrimSplitting off common leading and trailing sections before the main calculation — a step that speeds up the algorithm.

In-depth guides

Detailed answers to the most common text comparison questions.

Code comparison: finding the lines that changed between two versions

To see which lines changed in your source code, choose line mode and turn on side-by-side view. Paste the old version into Text A and the new version into Text B. The tool aligns the shared lines and marks only the added (green) and removed (red) lines — much like a version control system (Git) diff.

If indentation (space/tab) differences don't matter to you, turn on "Ignore whitespace" so only real code changes remain. You can download the result as .txt and keep it as a review note attached to the code.

Comparing two article or translation drafts word by word

When comparing two drafts of an article, or two versions of a translation, word mode gives the most readable result. Inline view shows every word-level change within a sentence fluidly: a changed word appears in red (old) right next to green (new).

If you only made case or punctuation corrections, turn on the relevant "ignore" options to hide those small differences and focus on meaningful content changes.

Using the similarity ratio to spot duplicate or near-duplicate content

This tool measures how similar two texts are to each other with an LCS-based ratio. A high similarity ratio (e.g. 90%+) between two documents indicates that they share most of their content. It's a practical, quick indicator of how much two versions overlap.

Note: this is not a professional plagiarism-detection engine; it does not search the web, it only compares the two texts you enter. Academic plagiarism screening requires specialized services. The ratio here is meant to give you a quick read on the similarity of the two texts in front of you.

Popular comparisons

Quick shortcuts to the most commonly used modes and views of this tool.

Add this tool to your site (embed code)

Embed the text compare tool on your own website for free. Copy the code below into your HTML — the tool runs in a simplified view and links back to this page as its source.

The embedded tool has a fixed layout; you can adjust the height value to fit your site. No ads or personal data, runs entirely client-side.

Frequently asked questions

How do I compare two texts?
Paste the old text into the left box (Text A), the new text into the right box (Text B), or upload a .txt file. Then choose word, line, or character mode. The tool aligns the two texts with the LCS algorithm, highlights added parts in green and removed parts in red, and calculates a similarity ratio. The comparison updates instantly as you type.
What is a text diff?
A diff is the process of finding and displaying the differences between two texts. It aligns the two texts based on their longest common subsequence (LCS); parts found only in the first text are marked as "removed," and parts found only in the second text are marked as "added." This lets you see at a glance what changed between two versions of a document, piece of code, or translation.
Is comparing text online safe?
Yes. All calculation in this tool happens entirely inside your browser (client-side); your text is never sent to, or stored on, a server. This makes it safe to compare confidential text such as contracts, source code, or personal documents. Your text is only encoded into an address when you click "Copy link" to create a shareable link — avoid that button for sensitive content.
How is the similarity ratio calculated?
The similarity ratio is based on the number of matched (unchanged) parts: similarity = (2 × matched) / (2 × matched + added + removed) × 100. If two texts are identical, the ratio is 100%; if completely different, it approaches 0%. The ratio is calculated based on the mode you choose (line, word, or character).
Which mode is best for comparing code?
Line mode is best for comparing source code, since code is edited line by line and clearly shows which lines were added or removed. For finding a small typo, character mode is more useful; for seeing word-level changes within a sentence, word mode is more readable. You can hide indentation differences with "Ignore whitespace."
Can I ignore case and whitespace differences?
Yes. Ignore case means letter case is not considered; Ignore whitespace disregards extra spaces and indentation differences; Ignore punctuation ignores marks such as periods and commas. These options hide irrelevant differences so you can focus on meaningful changes.
Can I upload a file or download the result?
Yes. The "Upload file" button under each box lets you select a .txt, .md, .csv, or code file from your computer and read its contents (the file is read in your browser and never sent to a server). After comparing, you can copy the diff to your clipboard with "Copy result," save the diff report to your computer with "Download .txt," or share it with "Copy link."
How many lines of text can I compare?
The tool can process texts with thousands of lines directly in your browser. Common leading and trailing sections are trimmed automatically to speed up the calculation. For very large texts, line mode is much faster than word or character mode — for the smoothest results with big files, use line mode.
Can I quickly clean up text before comparing, and jump between changes?
Yes. Each text box has a small cleanup toolbar with Sort lines, Remove blank lines, Trim whitespace, and To lowercase buttons, so you can normalize messy input before running a comparison. Once a diff is generated, use the "↑ Prev change" and "↓ Next change" buttons above the result — with a counter like "3 / 12" — to jump directly to each changed section instead of scrolling manually.

Methodology & sources

ToolPico's Text Compare Tool is a free, independent text comparison (diff) tool. The calculation engine uses its own vanilla-JavaScript implementation of the LCS (Longest Common Subsequence) algorithm: texts are split into parts (line/word/character) based on the chosen mode, common leading and trailing sections are trimmed, and dynamic programming finds the longest common sequence in the remaining middle section. The similarity ratio is derived from the counts of additions, removals, and matches. All processing happens in your browser; no data is ever sent to a server.

Basis: Longest Common Subsequence (LCS) diff algorithm. Last updated: July 19, 2026. Results are for informational purposes only.

🔗 Add this tool to your site

Copy the code below into your own site. The tool is free, always up to date, and runs entirely on your page. No sign-up required.

Preview →
⚡ Built with ToolPico · toolpico.com