This diff checker compares two versions of a text line by line and labels every line as added, removed or unchanged. Paste the older version into Original Text and the newer one into Modified Text, then press Compare. Counters above the results give the number of lines in each group, and the whole comparison runs in your browser.
How to use the diff checker
- Paste the first version into the Original Text box on the left.
- Paste the second version into the Modified Text box on the right.
- Press Compare. The Differences section opens with three counters: added, removed and unchanged.
- Read the Side by Side tab, which shows the two versions in numbered columns with a blank row opposite any line that has no partner. Removed lines are red and added lines are green.
- Switch to the Unified tab to see both versions merged into one list marked with plus and minus signs.
- Press Clear Both to empty the boxes and hide the results.
How the comparison works
The checker splits each text at its line breaks and finds the longest sequence of lines that appears, in the same order, in both versions. Those lines are unchanged. Every other line in the original is marked removed, and every other line in the modified text is marked added. The method is called longest common subsequence (LCS), and this difference checker applies it to whole lines only.
Worked example with a config file
Original text:
host = localhost
port = 8080
debug = true
timeout = 30
Modified text:
host = localhost
port = 9090
debug = true
timeout = 30
retries = 3
The counters read 2 added, 1 removed and 3 unchanged, and the Unified tab shows:
1 host = localhost
2 + port = 9090
2 - port = 8080
3 debug = true
4 timeout = 30
5 + retries = 3
The edited port line is reported as one removal plus one addition, with the new version listed first. Numbers beside plus lines are positions in the modified text; the others refer to the original.
Ways to compare text and code
Developers use it to find the line that changed between a working and a broken copy of a script or config file. Editors compare two drafts of an article or a contract clause, and anyone keeping a list of URLs or product codes can see which entries were added or dropped.
Lists show the line matching clearly. Compare a shopping list of Milk, Eggs, Bread and Butter, one item per line, with a second list of Milk, Bread, Butter and Coffee. The counters read 1 added, 1 removed and 3 unchanged: Eggs is marked removed, Coffee is marked added, and the three shared items line up opposite each other in the Side by Side tab even though their line numbers have shifted.
To check for differences in text written as long paragraphs, put one sentence on each line in both versions first. A paragraph is one line to the checker, so a single changed word marks the whole paragraph. The same trick helps when you compare an AI draft with your edited version, a process the guide on editing AI content so it sounds human walks through.
To compare JSON, format both versions with the JSON formatter first. Minified JSON sits on a single line, so any edit would mark the whole document as changed. The article on JSON formatters and validators explains why formatting and validating are separate steps. For Markdown files such as a README, compare the source here and check how the final version renders in the Markdown preview. Both tools sit with the other free writing tools.
Limits of this checker
- Lines are matched exactly. One changed character, a trailing space, different indentation or a change of capital letter marks the whole line as different, and nothing inside the line is highlighted.
- There is no setting to ignore whitespace or letter case.
- If only one of the texts ends with a line break, the extra empty line is counted as a difference.
- The comparison builds a table sized by the line count of one text times the line count of the other, so several thousand lines on each side can make the tab slow or unresponsive.