How to Compare Two Texts and Find Every Difference
Someone sends back your document "with a few small edits", and you have no idea what they touched. Reading both versions side by side is slow, and it's easy to miss a changed number. A diff checker finds every difference in seconds. Here's how to use one, and when to compare by lines, words or characters.
Quick answer
To compare two texts, paste the original into the left box of a diff checker such as our free Diff Checker and the new version into the right box. Removed text turns red, added text turns green, and changed words are highlighted inside each line. Compare by words for prose and by lines for code and lists.
What a diff checker does
A diff (short for difference) is the list of changes that turns one text into another. A diff checker works it out for you and colors the result:
- Red: text that was in the original and has been removed.
- Green: text that is new in the changed version.
- Darker highlight inside a line: the exact words or characters that changed, so you don't have to reread the whole sentence.
Good tools use the Myers algorithm, the same one behind git diff. It finds the smallest set of additions and removals between the two versions, so a single inserted paragraph shows up as one addition rather than as every following line being "different".
How to compare two texts online, step by step
- Open the Diff Checker.
- Paste the original version in the left box and the new version in the right box. You can also click Upload to load a .txt, .csv, .json, .html, .md or code file on each side.
- Read the differences below. They update as you type, with a count of added and removed lines and a similarity score.
- Switch to Inline on a small screen, or turn on Hide unchanged lines to see only the edits in a long file.
- Click Copy .diff or Download .diff to keep the result.
Both texts stay on your device. Nothing is uploaded, so you can compare contracts, source code and unpublished drafts safely.
Try it free: Diff Checker
Compare two texts or files side by side or inline, by lines, words or characters. Runs in your browser, no upload.
Lines, words or characters: which mode to use
| Mode | What it compares | Best for |
|---|---|---|
| Lines | Whole lines, with changed words highlighted inside | Code, CSV files, lists, config and log files |
| Words | Words, ignoring where lines break | Articles, essays, emails, contracts |
| Characters | Every single character | IDs, URLs, serial numbers, keys that look the same |
Word mode matters more than people think. If you copy text out of a PDF, Word file or email, the line breaks often land in different places. In line mode, every line looks changed. In word mode, only the real edits show up.
How to compare two documents in Word and Google Docs
If both versions are already documents, the built-in tools work well:
- Microsoft Word: go to Review › Compare › Compare, choose the original and the revised document, and Word creates a third document with the changes shown as tracked changes.
- Google Docs: open the newer document and choose Tools › Compare documents, then pick the older one in Drive. The result opens as a new doc with suggestions.
- One Google Doc over time: File › Version history shows who changed what, and when.
These options need both files in the same app. When one version is a PDF, an email or a web page, copy the text from each and paste it into an online diff checker instead.
How to compare two files with code tools
Developers have a few quick options:
- Mac and Linux terminal:
diff -u old.txt new.txtprints a unified diff. - Windows:
fc old.txt new.txtin Command Prompt, orCompare-Object (Get-Content old.txt) (Get-Content new.txt)in PowerShell. - Git:
git diff --no-index old.txt new.txtcompares any two files, even outside a repository. - VS Code: select both files in the Explorer, right-click and choose Compare Selected.
An online checker is handy when you don't have the files saved, for example two JSON responses or two snippets from a chat. Run JSON through the JSON Formatter first so both sides use the same indentation.
How to read a unified diff
When you export a .diff file, you get the standard unified format that git and patch tools use:
--- original
+++ changed
@@ -2,2 +2,2 @@
-Date: 12 March
+Date: 14 March
Attendees: Sam, Alex
- Lines starting with
-were removed, lines starting with+were added, and lines starting with a space are unchanged context. @@ -2,2 +2,2 @@means "starting at line 2, 2 lines in the original and 2 lines in the new version".
Why everything looks changed (and how to fix it)
- Different line breaks: text copied from a PDF wraps at different points. Switch to Words mode.
- Reformatted code: tabs became spaces or the indentation changed. Turn on Ignore whitespace.
- Upper and lower case: a heading was changed to Title Case. Turn on Ignore case if only the wording matters.
- Lists in a different order: a diff compares positions, so a sorted list looks completely changed. Sort both lists the same way first.
- Swapped sides: if additions show up as removals, click Swap.
Windows and Mac line endings (CRLF and LF) are handled automatically, so they never show up as changes.
Frequently asked questions
How do I compare two texts for differences?
Paste the original into the left box of the Diff Checker and the new version into the right box. Red marks removed text and green marks added text.
Can I compare two Word or PDF files?
Copy the text from each file and paste it into the two boxes, then use Words mode so different line breaks don't matter. For two .docx files, Word's own Review › Compare also works.
What does the similarity percentage mean?
It's the share of the two texts that is the same. 100% means identical; 50% means about half of the lines (or words) were kept.
Is it safe to paste confidential text?
In our tool, yes: the comparison runs in your browser and the text is never sent to a server. Many other online diff tools do upload what you paste, so check before using them for contracts or code.
Can a diff checker detect plagiarism?
Only between two texts you already have. It shows how much of a text was copied or rewritten from a known source, but it can't search the web for other sources.
Found something out of date or unclear? Email contact@ultratoolsai.com and we'll fix it.


