YourTools.
简体中文
Back to the catalog
Tools

Compare text

Compare two texts line by line with line numbers, and download a unified diff and a JSON report.

Process locally

Files stay in this browser session. Closing or clearing releases them.

Add text

Type or paste the text to process

Adjust settings

Optional: Ignore spaces at line ends, Ignore case, Context lines

Compare text

Run

Processes in this browser; cancel at any time

Add text first

About this tool

Compare two versions of a text line by line to see what was added, removed or left unchanged, for example two drafts of a contract, two configuration files, or a program’s output before and after a change. Each changed line is listed with its line number.

You get a unified diff (diff.txt) and a JSON report (diff.json) with counts of added, removed and unchanged lines. Each text may have up to 20,000 lines of at most 5,000 characters, and the two together up to 2 MB. Both stay in your browser and are not uploaded.

How to use it

  1. Paste the earlier version into “Original text” and the newer one into “Changed text”, or select Use example.
  2. If needed, turn on “Ignore spaces at line ends” or “Ignore case”, and set “Context lines” (0 to 10, 3 by default).
  3. Select Run.
  4. Preview diff.json and diff.txt, then download either file, or both as a ZIP.

Formats and limits

Input
Text
Output
JSON, Plain text
Size limit
2 MB
Settings
Ignore spaces at line ends; Ignore case; Context lines
Privacy
Files stay in the current browser session. No file bytes are uploaded.
Price
Free, no sign-up

Common questions

Does it show which word changed within a line?

No. Lines are compared as a whole, so a line with any change appears as one removed line and one added line.

What does “Ignore spaces at line ends” ignore?

Spaces and tabs at the start and end of each line, so changed indentation or trailing spaces no longer count as differences. Spaces inside a line are still compared.

How do I read diff.txt?

It uses the unified diff format: lines starting with - were removed from the original, lines starting with + were added, and lines starting with a space are unchanged context. Each “@@ -a,b +c,d @@” header gives the first line and the number of lines in the original and changed text, and “Context lines” sets how many unchanged lines surround each change.

What if the two texts are identical?

diff.txt is empty, and diff.json shows identical as true with no hunks.

Why is a large block shown as all removed and then all added?

When more than about 2,000 added and removed lines in total separate the texts, the tool stops searching for the smallest set of changes to keep memory use bounded. Everything between the matching start and end of the two texts is then reported as removed and added.