Compare two texts and see the differences
Paste the original and the changed text, or load two files, and the differences appear straight away: lines added and removed, with the changed words marked inside each line. Everything happens in this page and nothing is uploaded.
Options
Differences
- Lines added
- 4
- Lines removed
- 3
- Lines unchanged
- 4
- Characters changed
- 24
Original
Changed
Shopping list
Removed line: - milk
Added line: - oat milk
- bread
Removed line: - 6 eggs
Added line: - 12 eggs
- coffee beans
Added line: - butter
Removed line: Remember to bring the bags.
Added line: Remember to bring the reusable bags.
The unified diff uses 3 lines of context and works with the patch and git apply commands.
How the comparison works
- •The texts are compared line by line to find the smallest set of added and removed lines that turns the original into the changed text. This is the same kind of result as the diff command, and the line counts match it.
- •Inside a line that was changed, the words (or single characters, if you choose) that differ are highlighted, so a small edit in a long line is easy to spot. Chinese and Japanese are compared character by character.
- •The options let you ignore spaces and tabs, upper and lower case, blank lines, or spaces at the end of lines. Windows line endings (CRLF) count as a change unless you ignore spaces at the end of lines.
- •"Copy as unified diff" and the download buttons give a standard patch with 3 lines of context that the patch and git apply commands accept. If you turned on ignore options, the patch leaves out the differences you ignored.
- •The two texts together can be 2 MB at most. Long result lists show the first 400 rows, with a button for more. If two big texts have almost nothing in common, the page stops searching for the shortest list and says so.
Questions
- Are my texts uploaded?
- No. Both texts are compared in your browser, and nothing is sent anywhere or stored. Closing or refreshing the page clears them.
- Why is a line marked as changed when it looks the same?
- Usually there is an invisible difference: a space or tab at the end, a different line ending (Windows CRLF against Mac and Linux LF), or a missing line break at the very end of the file. Turn on "Ignore spaces at the end of lines" to hide the first two.
- Can I use the result with git or the patch command?
- Yes, for a single file. Download the .patch file and run patch original.txt changes.patch, or use git apply with matching file names in the header. It is built to the unified diff format, and applying it to the original text gives back the changed text.
- Is the shortest list of changes always found?
- Yes for normal texts: the line comparison finds a smallest set of added and removed lines. When there can be several equally small answers, the page may pick a different one than another tool. For very large texts with almost nothing in common, it gives up and tells you.