Text

Text Diff — Compare Two Blocks of Text

Compares two blocks of text line by line and lists exactly what was added and removed.

Loading the tool…

Processing happens locally in your browser. What you paste or load is processed by this page and is not uploaded to a server. Nothing is stored unless you use a control that says it stores something, and you can clear anything this site has kept from the privacy page.

How to use this tool

  1. Paste the original on the left and the version you are comparing on the right.
  2. Turn on ignoring whitespace if the two came from different tools and only the layout differs.
  3. Select Compare.
  4. Read the pairs: a removal immediately followed by an addition is usually one line that was edited rather than two separate changes.

What text diff does

This finds the longest sequence of lines the two texts have in common and reports everything else as an addition or a removal. That is the same approach a version control diff takes, and it is why the result stays readable when a block has been inserted in the middle: the lines after it are recognised as unchanged rather than every line from that point on being reported as different.

Comparison is by whole lines, so a line with one word changed shows as a removal and an addition rather than a highlighted word. Whitespace differences and case differences can each be ignored, which is what makes this usable on two exports of the same query or two copies of a configuration file that have drifted.

Frequently asked questions

Because the comparison is by whole lines. A line with one word changed is, to a line-based comparison, an old line gone and a new line arrived. A removal immediately followed by an addition is the pattern to look for — that is a single edit.

It trims each line and treats any run of spaces or tabs as one before comparing. That is what makes two exports of the same data, or two copies of a file formatted by different tools, comparable on the content rather than on the layout.

Three thousand lines a side. The comparison builds a table proportional to the two lengths multiplied together, and beyond that it would take long enough on the page to be useless. For larger files, compare the sections you care about or use a diff tool built for the job.

No. Both stay in your browser and the comparison runs there. That is the point of doing it here rather than in an online diff that posts your text to a server — the things people most want to compare are usually the things they least want to upload.