About Diff Checker

Diff checker that highlights every difference between two texts. See added, removed, and changed lines side by side. Free tool for comparing code, configs, and documents.

How to use

  1. Paste the original ("before") text into the left panel. Anything plain-text works: source code, YAML/TOML configs, SQL, JSON payloads, CSV exports, log lines, Markdown, prose. The diff runs in your browser, so even paste-sensitive content like API keys or proprietary code stays local — nothing is uploaded. For files over ~10,000 lines, expect a 200-500ms compute pause; the algorithm is O(ND) where N is total length and D is the number of differences.
  2. Paste the modified ("after") text into the right panel. For meaningful results, the two inputs must share the same structure — diffing a Python file against a JSON config will mark every line as changed, which tells you nothing. Common pitfall: comparing the same JSON serialized with different indentation or key ordering will show 100% changed even when the data is identical. Format both sides consistently first.
  3. Hit Compare to run the diff and render highlights. Green lines = additions, red = deletions, modified lines show both versions with character-level highlighting so you can pinpoint which token changed (often a single character — a wrong port number, a missing comma in a JSON object). Unchanged lines fade to provide context without visual noise.
  4. Toggle between unified and side-by-side views depending on the use case. Unified is the format git diff outputs and what you paste into bug reports — compact, with +/- prefix markers. Side-by-side is better for code review on long files because your eyes scan horizontally instead of jumping back and forth. For diffs over ~200 lines, side-by-side is almost always more readable.
  5. For structured data, normalize before diffing. Run both JSON blocks through the JSON Formatter with consistent indentation (2 or 4 spaces) and sort keys alphabetically — otherwise reordered keys produce a noisy diff that hides the real change. For YAML, ensure both files use the same flow style (block vs inline) and same quote style on strings. For SQL, format both queries with the same dialect formatter.
  6. Use this for code review when GitHub is overkill — comparing your local working tree against a teammate's pull request, checking environment variable diffs between staging and prod .env files, verifying that a renamed variable was renamed everywhere, or auditing contract redlines paragraph-by-paragraph. The Myers diff algorithm here matches what git diff uses internally.
  7. If you need to diff entire directory trees or thousands of files, this tool is the wrong layer — use git diff, VS Code's built-in 3-way merge view, Beyond Compare, or WinMerge. This tool excels at single-file comparisons where the output goes into a Slack message, a code review comment, or a debugging session.

Frequently asked questions

What is a diff checker?
A diff checker compares two pieces of text and highlights every difference between them — lines that were added, removed, or modified. The name comes from the Unix diff command, which has been a core developer tool since 1974. Modern diff tools add color coding, character-level change highlighting, and side-by-side views that make it far easier to spot changes than reading raw diff output in a terminal.
Can I compare code files?
Yes, and that is one of the most common use cases. Paste any two versions of a source code file, configuration (YAML, TOML, .env), SQL query, JSON payload, or Markdown document. The diff engine works line by line and also highlights character-level changes within modified lines, so you can see the exact variable name or value that changed. This is essentially the same comparison you see in GitHub pull requests or git diff output, but without needing a git repository.
Unified vs side-by-side diff?
Unified diff shows changes in a single column with + and - prefixes marking added and removed lines — this is the format used by git diff and most patch files. Side-by-side diff displays the original and modified text in two parallel columns, making it easier to visually compare long documents because your eyes can scan horizontally across matching line numbers. Side-by-side is generally better for code review, while unified is better for generating patch files.
Is my data safe?
Yes. The entire comparison runs locally in your browser using JavaScript. No text is uploaded to any server, no data is stored, and no network requests are made during the diff operation. This makes it safe for comparing sensitive content like API keys in config files, proprietary source code, or confidential documents.
What diff algorithm does this tool use?
This tool uses a variant of the Myers diff algorithm, the same algorithm that powers git diff. It finds the minimum number of edits (insertions and deletions) needed to transform the original text into the modified text, then presents those edits in a human-readable format. The algorithm runs in O(ND) time where N is the total length of both inputs and D is the number of differences, so it is fast for texts that are mostly similar.
Can I compare JSON or XML files?
Yes, but for the best results with structured data formats, first format both inputs consistently. Minified JSON with different key ordering will show as 100% different even if the data is identical. Use the JSON Formatter to prettify both JSON blocks with the same indentation before pasting them here. For XML, ensure both documents use the same formatting and attribute ordering.
How do I compare files from my computer?
Open each file in a text editor, select all content (Ctrl+A / Cmd+A), copy it (Ctrl+C / Cmd+C), and paste it into the left or right panel. For quick access on macOS, you can also use pbcopy < file.txt in the terminal. On Linux, use xclip -selection clipboard < file.txt. This tool is designed for quick browser-based comparisons — for heavy-duty file diffing with directory trees, consider desktop tools like VS Code's built-in diff viewer or WinMerge.

Part of ToolFluency’s library of free online tools for Developer Tools. No account needed, no data leaves your device.