Text Diff Checker
Compare two blocks of text and see the line-by-line differences highlighted in green (added), red (removed), and gray (unchanged).
Original
Modified
FAQ
What algorithm does this tool use?▼
The diff uses the Longest Common Subsequence (LCS) algorithm, comparing line by line. The result is similar to the output of the Unix diff command.
What does the patch output represent?▼
Lines starting with + were added in the modified version. Lines starting with − were removed. Lines with a space are unchanged. This format is compatible with the Unix patch command.
Is there a file size limit?▼
All processing happens in your browser. Very large inputs (>1 MB) may slow the comparison. For huge files, use a dedicated diff tool like git diff.
Frequently Asked Questions
What algorithm does this diff tool use?
The tool uses a Longest Common Subsequence (LCS) algorithm for line-by-line comparison, producing results similar to the Unix diff command.
Can I compare code files?
Yes. Paste the contents of any text or code files. The tool highlights added lines (green), removed lines (red), and unchanged lines.
Can I download the diff as a patch file?
Yes. Click Download to save the diff as a standard .patch file compatible with git apply, patch, and other diff tools.
How Text Diff Works
A diff tool compares two versions of a text and outputs the minimal set of changes (additions and deletions) that transform version A into version B. The classic algorithm, developed by Eugene Myers in 1986, finds the Longest Common Subsequence (LCS) — the longest sequence of lines that appear in the same order in both texts. Lines in the LCS are “unchanged”; everything else is flagged as added or removed.
This is exactly how git diff, the Unix diff command, and code review tools like GitHub's PR view work under the hood.
Reading a Unified Diff
- - (red) — Line was in the original but removed in the new version.
- + (green) — Line was added in the new version.
- (grey) — Context line: unchanged, shown for reference.
@@ -1,5 +1,5 @@— hunk header: shows line ranges in original (-) and new (+) file.
Common Use Cases
- Code review — see exactly what changed between two versions of a function or file before merging a pull request.
- Configuration audits — compare server configs, environment files, or deployment manifests to identify drift.
- Content editing — review editorial changes between two drafts of a document or translation.
- Database migrations — diff two SQL schema files to understand what tables, columns, or indexes changed.
- API response comparison — paste two JSON responses to spot changes in fields or values between API versions.