DevKitHub

Programming

Text Diff Checker

Paste two versions of a file or snippet to see a line-by-line comparison. Whitespace and case can optionally be ignored.

0 lines
0 lines

This tool runs entirely in your browser. Your input is never uploaded, stored or logged.

How it works

The comparison finds the longest common subsequence of lines — the largest set of lines appearing in the same order in both inputs. Everything in that set is unchanged; everything else is an addition or a removal. This is the same general approach the diff command uses.

Working line by line has a consequence worth knowing: a block of text that moved is reported as a removal in one place and an addition in another, because its lines are no longer in a common order. The content is identical, but its position is the thing that changed.

Ignoring whitespace or case changes only the comparison, never the output. Lines are normalised to decide whether they match, and then the original text is displayed — so a line that differs only in indentation is reported as unchanged while still showing you its real indentation.

Common problems

Every example below is run against this tool in our test suite, so what it says here is what the tool actually does.

Everything shows as changed

Why:
Usually mismatched line endings. A file saved with Windows CRLF compared against one with Unix LF differs on every single line.
Fix:
Normalise line endings first, or enable "Ignore whitespace".

Frequently asked questions

How is the comparison calculated?
It uses a longest-common-subsequence algorithm over lines, which is the same general approach used by standard diff tools. Lines are matched in order, so moved blocks appear as a removal plus an addition.
Is my text uploaded anywhere?
No. The comparison runs entirely in your browser. Neither side of the diff is transmitted or stored.

Last updated