To compare two texts, paste the original version in one box and the new version in the other: a diff tool then marks every line as added, removed or unchanged, so you see exactly what changed without reading both versions side by side. It works for contracts, articles, configuration files, lists and code snippets.
Our free text diff viewer compares two texts line by line as you paste them and counts the added, removed and unchanged lines. This guide explains how diff tools decide what changed, how to read the output, and how to prepare text so the comparison shows only the changes you care about.
How a text diff works
A line-based diff treats each text as a list of lines. It finds the longest sequence of lines that appears in both versions in the same order, called the longest common subsequence (LCS). Those lines are unchanged. Any line found only in the original was removed, and any line found only in the new version was added.
This is the same idea behind the Unix diff command and git diff, which use related algorithms to find the smallest set of changes between two files. The output convention is shared too: a + marks an added line, a - marks a removed line, and unchanged lines carry no marker. Our viewer uses the same markers.
Worked example: comparing two lists
| Original text | Modified text |
|---|---|
|
|
The diff viewer shows:
Milk
Eggs
- Bread
+ Whole wheat bread
Butter
+ Coffee
The counters read Added: 2, Removed: 1 and Unchanged: 3. Notice that editing "Bread" into "Whole wheat bread" counts as one removed line and one added line. A line-based diff doesn't know a line was edited; it only knows the old line is gone and a new one exists.
What counts as a change
| Difference | Shown as a change? |
|---|---|
| Different words or characters in a line | Yes, the whole line is marked |
| Uppercase vs lowercase ("Hello" vs "hello") | Yes, the comparison is case-sensitive |
| Spaces or tabs at the start of a line (indentation) | Yes |
| Spaces or tabs at the end of a line | No, trailing whitespace is ignored |
| Windows vs Unix line endings | No, all line break styles are treated the same |
| A blank line added or removed | Yes, shown as "(blank line)" |
| Lines moved to a new position | Yes, as a removal in one place and an addition in another |
A text that ends with a line break has one extra empty line at the end. If only one of your texts ends that way, the diff shows a blank line added or removed at the bottom. That is a real difference, not a fault.
How to use the Text Diff Viewer
- Open the Text Diff Viewer.
- Paste the earlier version into Original text.
- Paste the newer version into Modified text.
- Read the Line diff panel. The Added, Removed and Unchanged counters sum up the changes, and the list below shows every line with its
+or-marker. - Edit either side to try a fix; the diff updates a moment after you stop typing. Click Clear both to start a new comparison.
Each side accepts up to 50,000 characters and 1,000 lines. For longer files, compare them section by section, or use diff or git diff on your computer.
Tips for cleaner comparisons
Put one sentence on each line
Because the whole line is marked when anything in it changes, a long paragraph with one edited word shows up as an entirely new paragraph. For prose such as contracts or articles, break both versions into one sentence per line before you compare. The changed sentence then stands out on its own.
Format structured data first
Minified JSON is a single line, so any change marks the whole document. Run both versions through the JSON formatter first so each key sits on its own line, then compare. For YAML configuration, the JSON / YAML converter can put both files in the same format. Our guide to JSON syntax and formatting covers the details.
Sort lists when order doesn't matter
Two lists with the same items in a different order produce a noisy diff. Sort both with the duplicate line remover and sorter, then compare them to see only the items that were really added or removed. Our guide to removing duplicate lines and sorting text shows how.
Match the case when capitals don't matter
The comparison is case-sensitive. If "Product" and "product" should count as the same, convert both texts to lowercase with the case converter before comparing.
Keep secrets out
The comparison runs on our server. As with any online tool, remove passwords, API keys and personal data before you paste configuration files or documents.
Frequently asked questions
How do I compare two texts for differences?
Paste the original into the first box and the new version into the second box of a diff tool. It marks each line as added, removed or unchanged and counts each type of change.
What do + and - mean in a diff?
A plus sign marks a line that exists only in the new version, so it was added. A minus sign marks a line that exists only in the original, so it was removed.
Why is a whole line marked as changed when I edited one word?
Line-based diffs compare complete lines, so any edit makes the old line count as removed and the new line count as added. Put one sentence per line to narrow changes down.
Does the diff ignore whitespace?
It ignores spaces and tabs at the end of lines and treats all line break styles the same. Spaces at the start of a line, such as indentation, count as a change.
Is the comparison case-sensitive?
Yes. "Hello World" and "hello world" are different lines. Convert both texts to lowercase first if capitalization shouldn't count.
How much text can I compare?
Up to 50,000 characters and 1,000 lines on each side. Split longer documents into sections and compare them one at a time.