About comparing text
What a text diff is for
A diff answers one question: what changed between two versions of the same text? Reading two long files side by side by eye misses things. A diff lines them up and marks every line that was added, removed or edited, so a one-character change in a 500-line config file is as easy to spot as a new paragraph.
Common uses are checking a config file before and after an edit, comparing two API responses, spotting what a colleague changed in a document, comparing a .env file across environments, and checking that two exports of the same data really match.
How diff algorithms work
A diff tool looks for the longest run of lines the two texts share, in the same order (the longest common subsequence). Every line outside that shared run is either a deletion from the left or an insertion on the right. The result is the shortest list of edits that turns one text into the other.
Most tools, including Git, use Eugene Myers' 1986 algorithm, which finds that shortest edit list quickly when the two texts are mostly alike. This tool uses the same approach, through the open-source diff library. It compares whole lines first, then runs a character-level diff inside each changed line, so you see exactly which word or digit moved rather than just a red line and a green line.
Why a diff can look noisier than the change
A diff is exact, not clever. Re-indenting a file, switching between tabs and spaces, or reordering lines can mark almost every line as changed even though nothing meaningful moved. A line that moved to a new position is usually shown as one deletion and one insertion, because the algorithm only knows about lines, not about intent.
Line endings are another trap. Windows files end each line with CRLF, while Linux and macOS use LF. Two files can look identical on screen and still differ byte for byte.
What this tool does
Paste the original on the left and the new version on the right, then click Diff. Results appear side by side with line numbers, and both panes stay editable. Four options cut the noise. Ignore space diff squeezes runs of spaces and tabs down to one and trims each line, so indentation changes disappear. Ignore newline diff treats CRLF, CR and LF line endings as the same. JSON (prettify before diff) parses both sides and re-prints them with two-space indentation and every object's keys sorted, so a minified object and a pretty one can be compared line by line, and two objects that differ only in key order show no difference. Sort before diff sorts each side alphabetically first, which turns the comparison into “which lines are on one side but not the other”.
The comparison runs in your browser. Your text is kept in this browser's local storage so it survives a reload, and it is not uploaded.
Frequently asked questions
- How do I compare two lists and ignore their order?
- Turn on Sort before diff. Both sides are sorted alphabetically before comparing, so only the lines that exist on one side and not the other are marked. This works well for ID lists, package lists and config keys.
- Why does every line show as changed when the text looks the same?
- Usually it is invisible whitespace: different indentation, tabs versus spaces, or trailing spaces. Turn on Ignore space diff. If the files came from different operating systems, turn on Ignore newline diff as well.
- Can I compare two JSON objects whose formatting differs?
- Yes. Turn on JSON (prettify before diff) and both sides are parsed and re-printed in the same layout first. If either side is not valid JSON, the tool shows the parse error instead of a diff.