Diff Checker
Engineering-grade text comparison with structured modes, inline highlights, and navigation. Fully client-side.
About this tool
This diff checker compares two text inputs line by line and highlights additions, deletions, and modifications using a Longest Common Subsequence (LCS) algorithm. It supports side-by-side and unified views, inline character-level highlighting for modified lines, and structured comparison modes for JSON, YAML, and .env/INI files. Options include ignoring whitespace, case, or blank lines; sorting lines before comparing (useful for unordered config files); and navigating directly between changes with Previous/Next buttons. The result can be exported as a plain .txt diff or a standard .patch file. Everything runs locally in your browser - no uploads, no accounts.
Real example
Original:
host = db.prod.example.com port = 5432 max_connections = 100 debug = false
Updated:
host = db.prod.example.com port = 5432 max_connections = 200 debug = true log_level = info
Diff output (unified view):
host = db.prod.example.com port = 5432 ~ max_connections = 100 -> 200 ~ debug = false -> true + log_level = info
The inline highlight on the modified lines shows exactly which characters changed (100->200, false->true). The summary counters show: Added 1, Removed 0, Modified 2. Use the .env mode for this kind of config file to normalize key ordering before comparing, which eliminates false positives from key reordering.
Common use cases
- Config file auditing: Before deploying an infrastructure change, diff the current and proposed
appsettings.json,nginx.conf, or Kubernetes manifest to verify only the intended keys changed. Use JSON or YAML mode to normalize formatting before comparing so whitespace differences don't obscure real changes. - Pre-commit code review: Paste two versions of a function or module here to review the diff locally before opening a pull request. Useful for catching accidental changes or verifying a refactor only moved code without changing logic.
- Documentation and runbook versioning: Diff two versions of an incident runbook, API spec, or support article to identify exactly what was added or removed between revisions, without needing access to a version control system.
- Preparing JSON diffs: Paste two API response payloads in JSON mode. The tool sorts keys before comparing, so you see only value changes - not false positives from key reordering between API calls. Pair with the JSON Editor to sort and normalize keys first if needed.
How it works
Text comparison uses an LCS (Longest Common Subsequence) dynamic programming algorithm - the same approach used by Unix diff and Git. Lines that appear in both inputs are marked as context (no change); lines only in the original are marked as deletions; lines only in the updated version are marked as additions. Adjacent single deletions and additions are merged into modifications, with character-level inline diff applied. For files with more than ~4 million line-pair combinations, a greedy fallback algorithm is used to avoid browser memory exhaustion. Structured modes (JSON, YAML, .env) normalize both inputs into a canonical key=value format before comparison so structural differences don't create false positives.
Common mistakes
- Comparing JSON without JSON mode: Two JSON files with the same data but different key ordering will show many false-positive modifications in plain text mode. Switch to JSON mode, which sorts all keys recursively before comparing, so only genuine value changes appear as differences.
- Whitespace-sensitive comparisons: Indentation changes (e.g., switching from 2-space to 4-space JSON indentation) will show every line as modified in plain text mode. Enable "Ignore whitespace" to strip internal whitespace before comparing, or use JSON/YAML mode which normalizes indentation as part of parsing.
- Exporting .patch files for binary content: The .patch export follows the unified diff format (GNU patch compatible), but only works correctly for plain text. Binary files, base64-encoded content, or text with very long lines may produce malformed patch output.
FAQ
What is the difference between side-by-side and unified view
Side-by-side shows original and updated text in two columns, making it easy to read both versions in context. Unified view shows a single column where additions are prefixed with + and deletions with - - the same format used by git diff and patch files.
Can I compare JSON files with different key ordering
Yes. Select JSON mode in the Config Diff Mode dropdown. Both inputs are parsed and keys are sorted recursively before comparison. Only value differences and genuinely added/removed keys are shown as changes.
What does "sort lines before compare" do
It sorts both inputs alphabetically before running the diff. This is useful for comparing unordered lists (like requirements.txt or tag lists) where the order of items shouldn't count as a difference - only presence/absence matters.
Is my content sent to a server
No. The LCS algorithm, structured parsing, and rendering all run locally in your browser. No text is transmitted. This makes the tool safe for comparing sensitive config values, credentials references, or private document drafts.
Related tools
- JSON Formatter — sort JSON keys and prettify before running a diff to reduce noise
- Log Explorer — filter log lines and diff output between two deployments
- Line Sorter — normalize line order before diffing to avoid false positives
- Word Counter — count how many lines changed in your edited document
- YAML Validator — validate YAML config files before comparing versions