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 (or 'before') text in the left panel. This can be any text content: source code, configuration files, SQL queries, JSON data, CSV records, legal documents, or plain prose. The tool handles text of any length, though very large files (10,000+ lines) may take a moment to process.
  2. Paste the modified (or 'after') text in the right panel. The diff algorithm compares the two inputs line by line to identify every insertion, deletion, and modification. For the most useful results, make sure both texts share the same general structure — comparing two completely unrelated documents will show every line as changed.
  3. Click Compare to run the diff algorithm and see highlighted differences instantly. Added lines appear in green, removed lines in red, and modified lines show both the old and new versions with character-level highlighting so you can spot exactly which words or characters changed within a line. Unchanged lines are shown with reduced opacity for context.
  4. Review the results to understand what changed between the two versions. This is particularly useful for code reviews (comparing your branch against main), verifying configuration changes before deploying, checking translation files for missing keys, or auditing contract revisions. You can also use our JSON Formatter to prettify minified JSON before diffing it.

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.