Compare Text Documents
Highlight Differences
How to compare two texts online
Paste the original text into the left panel and the updated version into the right panel, then hit Compare. Lines that were removed show in red, lines added show in green. Works for code, config files, JSON, markdown, prose — anything text-based.
What people actually use this for
The most common use is code review — you've got two versions of a function or config file and want to see what changed. Paste them in, hit compare, done.
The other big one is API response debugging. Your endpoint returned something different and you're not sure what changed. Copy the old response from your logs, copy the new one, compare — the diff shows the exact field that shifted.
It works for document editing too: paste two drafts to see every sentence that was changed, added, or cut. Everything runs in your browser so pasting sensitive contracts or internal docs is safe.
How the diff algorithm works
This tool uses the Longest Common Subsequence (LCS) algorithm — the same foundation as git diff. It finds the longest sequence of lines shared between both inputs, then marks everything outside that sequence as added or removed. The comparison is line-by-line: a one-word change in a long line marks the whole line as modified, which is intentional — it preserves context.
How the Diff Algorithm Works
This tool uses the Longest Common Subsequence (LCS) algorithm the same foundation behind git diff and most code review tools. It finds the longest sequence of lines shared between both inputs, then marks everything outside that sequence as added, removed, or changed.
LCS-based diffing is line-oriented by default. That means a one-word change to a long line shows the whole line as modified, not just the word. That behavior is intentional for code review and document comparison it preserves context. Paste both versions in the two panels, and the diff highlights instantly.
All comparison happens in your browser. Nothing is sent to a server.
Complete Developer Toolkit
Text diffing is useful across every part of the development workflow — comparing API responses, config files, code before and after refactoring, and minified vs source files. Use our JSON formatter to beautify both JSON blobs before diffing them so the comparison is line-by-line rather than one long string. When comparing SQL queries, our SQL formatter normalizes indentation first so structural differences stand out clearly. Our Markdown preview is useful when diffing documentation files — preview each version to see how the rendered output changed.
For comparing minified code against source, use our JS minifier or CSS minifier to generate one side of the diff. Our regex tester helps you build patterns for extracting specific sections from each file before comparing them. When reviewing config changes, our Base64 encoder decodes encoded config values so you can compare their plaintext. The Git command cheat sheet covers the git diff command and flags for diffing commits directly in your terminal. Our HTML to Markdown converter converts HTML files to a cleaner format for easier visual diffing.
How to Use This Tool
- 1 Paste your original (before) text into the left panel.
- 2 Paste the modified (after) text into the right panel.
- 3 Click Compare Versions.
- 4 Red lines were removed, green lines were added — scan down to see every change.