Text Diff

Compare two blocks of text line by line and see what was added and removed. The comparison runs in your browser and highlights every change.

Comparison is line based: a paragraph rewritten in one long line appears as one removed line and one added line.

Differences

Compared output

—

Removed lines start with -, added lines with +, and matching lines have no marker.

How to read the output

Marker Background Meaning
- linepink rowPresent in the original, absent from the modified text
+ linegreen rowPresent in the modified text, absent from the original
  linegrey rowIdentical in both versions

Unchanged lines are kept in the output so you can see where a change sits in the document, not only what changed.

Rate this Tool

0.0/5

Based on 0 user ratings.

Comparing two versions is a sequence problem

A diff does not ask "are these texts different". It finds the largest set of lines they share, keeps those in order, and reports everything else as removed or added.

How line-by-line comparison works

The algorithm builds a table of the longest common subsequence (LCS) between the two lists of lines. For every pair of positions it records how many lines can still be matched if the comparison starts there. The table is then walked backwards to produce the edit script: a line that exists in both versions is kept, and a line that cannot be matched is marked as removed or added.

diff(A, B) = keep the LCS, report A \ LCS as removed and B \ LCS as added

The result is a sequence of operations rather than two independent lists, which is why the output can interleave -, + and unchanged lines in the order they appear. Two texts of m and n lines produce a table with (m + 1) × (n + 1) cells, so both time and memory grow with the product of the lengths.

That cost is invisible for a page of prose and noticeable for two large logs. If a comparison seems slow, reduce the input to the section that matters instead of pasting entire files.

What a line diff can and cannot show

SituationWhat you see
One word changed inside a lineThe whole line appears as one removal and one addition
A line insertedA single green line with a + marker
A line deletedA single pink line with a - marker
A block movedThe block is removed in one place and added in another
Trailing spaces changedA difference, even though the text looks identical
Line endings changedEvery line can appear different if the split differs
Why a moved paragraph looks deleted: the algorithm preserves order. A block that appears earlier in one version and later in the other cannot be part of one common subsequence in both positions, so it is reported twice.

Line, word and character granularity

Original Modified Release notes v2 Fixes crash on login - Cached results for speed Adds dark mode Thanks for testing Release notes v2 Fixes crash on login + New: export to CSV Adds dark mode Thanks for testing unchanged lines stay in place so each edit has context

Line granularity is the right default for prose, configuration files and changelogs, because it keeps the surrounding context readable. It is coarse for a single long paragraph: one comma changed marks the entire line.

Word and character diffs solve that by comparing smaller units, at the cost of a much noisier output. A useful compromise is to break the text into one sentence or one clause per line before comparing. The diff then points at the sentence that changed, and the reader can see the exact wording without a wall of highlighted characters.

Preparing text for a clean comparison

  • Use one sentence or one bullet per line. Short lines localize changes and make the output easier to scan.
  • Normalize line endings. A file saved with CRLF and one saved with LF can differ on every line when read by a tool that keeps the carriage return.
  • Trim trailing spaces. Editors sometimes add them silently, and they count as a change.
  • Remove volatile fields. Timestamps, build numbers and generated IDs create noise that hides the real edit.
  • Sort lists before comparing. A reordered list produces a large diff even when the items are the same set.

If the two versions come from different systems, check the character encoding first. The same accented word can arrive as one code point or as a base letter plus a combining mark, and the two forms compare as different strings even though they render identically.

Practical uses for a text diff

TaskWhat to compareWhat to look for
Contract reviewTwo revisions of the same clause listWording that changes an obligation
Configuration changeOld and new config textAccidental deletions and altered values
Translation QASource and translated segmentsMissing lines and untranslated fragments
Copy editingDraft and edited versionMeaning changes hidden among style edits
Data export checkTwo exports of the same queryRows added, removed or reordered
Documentation updatePrevious and current help pageSteps that no longer match the product

In every case the value is the same: the diff narrows attention to the lines that changed, so a reviewer spends time on the edit instead of re-reading the whole document.

Limitations to keep in mind

  • No intra-line highlighting. A one-character edit marks the entire line, so you still have to look closely at long lines.
  • No ignore-whitespace option. Indentation and trailing spaces count as differences here. Normalize them before pasting if they are noise.
  • Tie-breaking can vary. When several equally long common subsequences exist, different tools may choose a different one, producing a different but still valid diff layout.
  • No three-way merge. This is a two-version comparison; reconciling three documents needs a merge tool.
  • Large inputs get slow. The table grows with the product of the line counts, so split very large files before comparing.

None of these limits matter for the common case of two paragraphs or two short lists. They matter when the diff is part of a release process, where a missed line can ship a bug.

Related Text & Writing Tools

Tool What does it do? Action
Text Character Counter & Word Counter Free text counter: count characters with and without spaces, words and sentences, and estimate reading time. Check social media and SEO limits instantly. Count Text →
Case Convert your text between uppercase, lowercase, title case, and sentence case instantly. The perfect tool for students, secretaries, and writers. Change Case →
Instagram & TikTok Line Breaker Add clean line breaks to your Instagram and TikTok captions. Our space fixer tool inserts invisible characters to keep your formatting perfect and professional. Line Breaks →
JSON Formatter & Validator Format, validate, and minify JSON quickly and for free. Perfect for developers, API testers, and data analysts looking to prettify JSON or check syntax errors. Format JSON →
AI Prompt Optimizer Optimize your prompts for any AI model. Transform basic prompts into effective, structured inputs for ChatGPT, Claude, Gemini, Llama and more. Free and easy. Prompt Helper →
Lorem Ipsum Generator Generate placeholder paragraphs, sentences or words for layouts and mockups. Lorem Text →

Frequently Asked Questions

Yes. Hello and hello are different lines. To compare case-insensitively, convert both texts to the same case with a case converter before pasting them here.

The line probably contains an invisible difference: a trailing space, a different kind of dash, a non-breaking space or a carriage return. Select the line in both panels and compare the ends.

Open each file, copy its contents into the matching panel and press Compare. For very large files, a dedicated command-line diff is faster and can ignore whitespace automatically.

No, the comparison works line by line. A modified word causes the whole line to appear as one removal and one addition. Split long paragraphs into sentences to get more precise output.

It appears twice in the output: as a removed block at the old position and an added block at the new one. The algorithm preserves order, so it does not detect a move as a move.

Yes. Both panels are read by JavaScript in the page, and the comparison happens locally. Nothing is uploaded, saved or shared between visits.