Compare text and find differences
Compare two texts line by line. Added and removed lines are marked, and the changed words inside each line are highlighted. View side by side and export a unified diff.
There are too many differences for a detailed comparison, so the changed block is shown as removed and added in full.
With ignore options on, ignored differences are not included in the diff, so applying it as a patch may not reproduce the changed text exactly.
Files you select are processed in your browser on this device. They are never uploaded to or stored on our server. For how analytics are handled, see the Privacy Policy.
How to use
- Paste the original text on the left (or top) and the changed text on the right (or bottom), or load a text file with "Open file".
- Optionally turn on "Ignore leading and trailing spaces" or "Ignore case", then press "Compare".
- Added lines are marked with "+" in green and removed lines with "−" in red. Changed words inside a line are underlined or struck through.
- Under "View", choose "Side by side" to see the original and the changed text next to each other.
- By default only 3 unchanged lines are shown around each change. Turn on "Show unchanged lines" to see everything.
- Use "Copy unified diff" or "Download .diff" to export the differences as a patch.
Supported formats and limits
- Each text can have up to 5,000 lines and 500,000 characters.
- Files must be UTF-8 text files of up to 2 MB. Word, PDF and Excel files cannot be opened.
- When the texts are very different (more than about 2,000 added and removed lines in total), the detailed comparison is skipped and the changed block is shown as removed and added in full.
- A moved line is shown as removed in one place and added in another.
- "Ignore leading and trailing spaces" does not ignore differences in spacing inside a line.
- The unified diff has the same format as diff -u, but differences hidden by the ignore options are left out. A difference only in the final line break is not detected.
How it works
Lines are compared with the Myers diff algorithm, which finds the smallest set of added and removed lines. Matching lines at the start and end are set aside first.
When removed and added lines appear next to each other, they are paired and compared again word by word to highlight what changed. Latin text is compared by words; scripts without spaces, such as Japanese, roughly by characters.
In the side-by-side view, the n-th removed line of each change is shown next to the n-th added line.
The unified diff includes 3 unchanged lines of context around each change and "@@ -start,count +start,count @@" hunk headers.
Color is not the only signal: each line also has a "+" or "−" marker and a hidden "Added" or "Removed" label for screen readers.
FAQ
Is my text uploaded?
No. The comparison and file reading run entirely in your browser, and nothing is sent or stored, so it is safe for contracts and drafts.
Can I compare two files?
Yes, for text files (.txt, .md, .csv, source code and similar, UTF-8): use "Open file" on each side. For Word documents, copy the text and paste it in.
Can I save the differences as a patch?
Yes. "Download .diff" saves a unified diff with 3 lines of context, the same format as diff -u.
Do Windows and Unix line endings count as a difference?
No. CRLF and LF line breaks are treated the same.
Related guides
- How to find and fix JSON errors, then format JSONThe JSON mistakes that break parsers most often — quotes, commas, comments, True/False — how to locate them, and how to format, minify and inspect JSON.
Related tools
Last updated: