Text Compare (Diff)
Find and highlight the differences between two texts
Loading the tool…
Compares two texts line by line, marks the lines that were added or removed, and highlights the words or characters that changed inside a line. Use it to see what changed between two drafts, contract versions or configuration files.
How to use
- Paste the texts into "Original" and "Changed", or load files with "Open file" or by dropping them onto a box.
- The result appears below as you type. Under "View", choose "Side by side" or "Unified".
- Set "Highlight by" to "Word" or "Character", and switch on "Ignore whitespace changes" or "Ignore case" if needed.
- Move between changes with "Next change" and "Previous change", and press "Copy unified diff" to copy the result.
How it works
- Removed lines have a − sign and a red background; added lines have a + sign and a green background. Highlights inside a line appear in the "Side by side" view.
- "Ignore whitespace changes" treats several spaces as one and ignores spaces at the ends of a line. A space that exists in only one text is still a difference.
- The page shows the first 20,000 lines; the copied unified diff contains everything. Very different long texts are shown as one changed block.
- Both texts and your settings are saved only in this browser on this device.
Questions and answers
- How do I show only the differences between two texts?
- Keep "Show only changes with context" on. Only changed lines and three lines around them are shown, and the number of added and removed lines appears above the result.
- Can I compare Word or PDF documents?
- Only plain text files such as .txt, .md, .csv or code files can be opened. Copy the text of a Word or PDF document and paste it into the boxes.
- What is a unified diff?
- A text format that lists each change with three lines around it, with - before removed lines and + before added lines. It looks like the output of diff -u or Git.
- Can it ignore differences in case or spacing?
- Yes. "Ignore case" treats upper and lower case as the same, and "Ignore trailing spaces" ignores spaces left at the end of lines.