How to use the diff checker
- Paste the earlier version into Original.
- Paste the newer version into Changed.
- Choose Compare: Lines for code and config, Words or Characters for small edits inside a line.
- Tick Ignore whitespace to skip indentation changes, or Ignore case to treat capitals and lower case as equal.
- Review the highlighted Differences. In Lines mode, copy or download the Unified diff.
What it does and when to use it
This tool is built for developers’ everyday comparisons, where the answer you need is a precise list of changed lines:
- Config drift. Compare the YAML or
.envlayout from staging with production to find the setting that differs. - Reviewing a snippet. See what a colleague changed in a function they pasted into chat.
- Before and after a formatter. Check that running a formatter changed only spacing.
- Making a patch. Produce a unified diff to attach to an issue or apply with
git applyorpatch. - Checking generated output. Compare an API response or a build artefact against a known good copy.
For comparing prose, such as edits to an article or a contract, the Text Comparison tool in the Writing Studio is a better fit. To test a pattern before a find-and-replace across files, use the Regex Tester. To check that two downloads are byte-for-byte the same, compare their hashes with the Hash Generator.
How it works
The tool uses the open-source diff library, which runs in your browser. In Lines mode it finds the longest sequence of lines the two versions share and marks the rest as added or removed, so a moved block or an inserted line does not make the whole file look different. The unified diff includes three lines of context around each change, the same default git uses.
Words and Characters modes compare smaller pieces and show changes inline, with removed text struck through and added text highlighted. The counts at the top show how many lines, words or characters were added, removed or left unchanged.
Worked examples
A YAML config. The original sets port: 8080 and logging: info. The changed file sets port: 9090, logging: debug and adds - search to the features list. The result is Added: 3 lines, Removed: 2 lines and Unchanged: 5 lines. The unified diff starts with the header @@ -1,7 +1,8 @@, meaning 7 lines from line 1 became 8 lines from line 1.
Re-indented code with Ignore whitespace. The function body moved from two spaces to four, and the first line changed from function add(a, b) { to function add(a,b){. With Ignore whitespace on, the re-indented return line counts as the same, giving Unchanged: 2 lines. The first line is still reported, because spaces inside a line are not ignored.
Two identical inputs. The tool shows The two texts are identical instead of an empty diff.
Limits and tips
- Very large files can take a moment to compare, because the work happens on your device.
- Ignore whitespace does not apply in Words or Characters mode.
- For the clearest results with JSON, format both sides the same way first, with consistent indentation and key order.
Frequently asked questions
Why does every line show as changed?
What does Ignore whitespace do?
What is a unified diff?
Can I compare JSON objects regardless of key order?
Is my code uploaded?
How do we know nothing is uploaded? Test it yourself on the privacy proof page.