Text Diff
Compare two texts line by line or word by word.
About this tool
Paste the original and the changed text to see what was added and removed. Compare whole lines or individual words, and ignore whitespace changes when they don’t matter.
How to use it
- Paste the original text on the left and the changed text on the right.
- Compare by Lines for code and config, or by Words for prose.
- Turn on Ignore whitespace to hide indentation-only changes, or Only changed lines to focus on the differences.
Questions
- What do the colours and signs mean?
- Lines marked + in green exist only in the changed text, lines marked − in red exist only in the original. The two number columns are line numbers in the original and the changed text.
- Can I compare JSON files?
- Yes. For the clearest result, format both with the JSON Formatter using Sort keys first, so differences in key order or spacing don’t show up as changes.
- Are my texts uploaded for comparison?
- No. The diff is computed in your browser, so you can compare contracts, configs or code safely.
- Can I compare two Word documents or PDFs?
- Not as files, because both are binary formats. Copy the text out of each version, paste it into the two boxes and compare by Words, which suits prose better than Lines. Formatting changes such as bold text, fonts or layout aren’t visible in plain text, so only wording changes will show.
- How do I compare two lists regardless of order?
- Sort both lists first with the same settings in Sort, Dedupe and Clean Lines, for example A to Z with duplicates removed, then paste them here in Lines mode. Lines marked − exist only in the first list and lines marked + exist only in the second, which gives you the difference between the two sets.
- Can I see which characters changed inside a word?
- No. The smallest unit is a word, so changing colour to color marks the whole word as removed and the new one as added. That keeps the result readable for text. For long IDs or hashes, put each value on its own line, and the changed value will stand out in Lines mode.
How does a diff checker work?
A diff checker finds the smallest set of additions and deletions that turns the original text into the changed one. It looks for the longest sequence of content both versions share and marks everything else as removed from the original or added in the changed text. A modified line therefore shows up as one removed line followed by one added line, the same way git diff and GitHub present changes.
The result depends on the unit you compare. Lines mode treats each line as one token, which suits code, config files, CSV and logs, where a line is a meaningful unit. Words mode compares word by word and marks changes inline, which works better for prose, contracts and long lines, where one edited word would otherwise mark a whole paragraph as changed. The status line counts added and removed lines, or changes in Words mode.
How to compare two files and ignore whitespace
To compare two files, use Open file above each box or drop a file onto it. Both are read in your browser and nothing is uploaded. Ignore whitespace, available in Lines mode, treats lines as equal when they differ only in leading or trailing spaces and tabs, so re-indented blocks stop showing up as changes, while a space added inside a line still counts. Only changed lines hides everything that matches.
When a diff marks every line as changed although both texts look identical, the cause is usually line endings. One file uses Windows CRLF and the other Unix LF, and the invisible carriage return makes each line different. Turning on Ignore whitespace treats that trailing character as whitespace, and the noise disappears. Tabs versus spaces at the start of lines are handled the same way. A missing newline at the end of a file is never reported.
Online diff checker vs git diff: when to use which
git diff is the right tool for files in a repository: it knows the history, works across whole directories and produces patches you can apply. An online diff checker covers the cases git doesn’t: comparing two API responses, a config from a server against the one in the repository, two versions of a contract pasted from email, or text that never lived in a file. Paste both sides and read the result immediately.
For structured data, normalise both versions before comparing. Format JSON with JSON Formatter and Sort keys, format SQL with identical settings in SQL Formatter, and sort lists with Sort, Dedupe and Clean Lines when order doesn’t matter. The diff then shows only real changes. This tool displays differences but doesn’t export a patch; for a unified diff, git diff --no-index a.txt b.txt works even outside a repository.
Something not working, or a result looks wrong? Report a problem with this tool