How to compare code online
- Paste the original on the left and the changed code on the right, or drop a file on either pane.
- Leave Ignore formatting on. The language is detected and both sides run through the same formatter (Prettier for JS/TS/HTML/CSS/YAML/GraphQL/Markdown, dedicated formatters for JSON, SQL and XML).
- Read the result: green lines were added, red removed, and changed words inside a line are marked. Press Ctrl/⌘+Enter to jump to it.
- Tick Only changes to fold away unchanged code, then Copy diff or download a
.patchforgit apply.
Why formatting noise ruins a normal diff
A line-based diff compares text, not meaning. If one copy was minified, re-indented from 4 spaces to 2, or had its quotes changed by a formatter, almost every line differs and the one real edit is buried. Normalising both sides with the same formatter puts them in the same shape first, so the diff lines up again. If either side does not parse, the tool says so and falls back to a plain line diff.
Code diff vs. diff checker vs. JSON compare
| Use | When |
|---|---|
| Code diff (this page) | Two versions of source code that may be formatted differently. |
| Diff checker | Any plain text — prose, logs, config — compared exactly as typed. |
| JSON compare | Data: ignores key order and lists changes by path such as items[2].qty. |