Skip to main content

Text Diff Checker

Compare two texts and see the differences highlighted line by line.

Built and tested by Muhammad Irfan Liaqat · Updated

Text Diff Checker: key facts

  • Compares two texts line by line and highlights added and removed lines
  • Shows how many lines were added, removed and left unchanged
  • Whole lines are compared, so a one-letter change marks the full line as changed
  • Text is pasted in, not uploaded, and the comparison runs in the browser

How the text comparison works

Paste the original text on the left and the changed version on the right, and the diff checker marks every line that was added in green and every line that was removed in red. It works with any plain text, including source code, configuration files, JSON, CSV and contract drafts.

The comparison runs line by line using jsdiff, an open-source implementation of the Myers diff algorithm, which is also the default algorithm in Git. An edited line appears as a removed line followed by an added line, so compare the pair to find the exact change. Differences in spaces, tabs or line endings count as changes, which explains lines that look identical but are still marked. Both texts stay in your browser.

How to compare two texts and see the changes

  1. 1Paste the original text into the left box
  2. 2Paste the changed text into the right box
  3. 3Read the result: added lines in green, removed lines in red
  4. 4For an edited line, compare the removed and added versions to find the change

Frequently Asked Questions

How does the diff checker compare texts?
It compares the two texts line by line with the Myers diff algorithm, the same approach Git uses by default, and shows which lines were added, removed or left unchanged.
Why are identical-looking lines marked as changed?
The lines differ in characters you cannot see, usually trailing spaces, tabs instead of spaces, or Windows (CRLF) versus Unix (LF) line endings. Every character counts in the comparison.
Can I compare two files?
Yes, by pasting their contents. Open each file in a text editor, copy everything and paste one into each box. This works for any text file, such as .txt, .csv, .json, .xml or source code. For Word documents or PDFs, copy the text out of them first, since formatting is not compared.
Can it merge the two versions?
No. The diff checker shows the differences but does not merge them. Use it to find each change, then copy the lines you want to keep into your final version.
Can I compare code or JSON?
Yes. Any plain text works. For JSON, format both versions with the JSON Formatter first so that each value sits on its own line; the differences are then much easier to read.
Is my text sent to a server?
No. The comparison runs in your browser, so confidential code and documents never leave your device.
Does it highlight the exact words that changed?
No. It works line by line, so a changed line shows as one removed line and one added line. Put sentences on separate lines to narrow down what changed.
How do I compare two Word documents or PDFs?
Copy the text from each document and paste one into each box. Word also has a built-in Review > Compare feature that keeps the formatting.
How do I compare two lists to find missing items?
Paste one list into each box. Lines only in the first list show as removed and lines only in the second as added. Sort both lists the same way first, because the comparison follows the order of the lines.

Related Tools

Guides