How Diff Algorithms Work: Myers, Patience & More
Understanding the algorithms behind text comparison tools like Git diff.
Compare two texts and highlight differences
2 articles to help you understand and use this tool effectively
Understanding the algorithms behind text comparison tools like Git diff.
Libraries and techniques for comparing text in JavaScript applications.
Common questions about using the Text Diff Checker tool
To compare texts: 1) Paste the original text in the left panel, 2) Paste the modified text in the right panel, 3) Differences are highlighted automatically. Red shows deletions, green shows additions. Use inline or side-by-side view.
Red/minus (-) indicates removed content from the original. Green/plus (+) indicates added content in the new version. Yellow/tilde (~) may indicate modified lines. Unchanged content appears in normal color.
Unified diff shows changes inline with context, using +/- markers. Side-by-side shows original and modified text in parallel columns. Unified is compact and good for patches; side-by-side is more visual and easier to review.
Yes, this tool works with any text including code. For best results with code: enable whitespace comparison if indentation matters, use side-by-side view for readability. The tool handles any programming language.
Toggle 'Ignore whitespace' to exclude spacing differences. Useful when comparing code reformatted with different styles. Options may include: ignore all whitespace, ignore trailing whitespace, or ignore blank lines.
Diff algorithms find the minimum set of changes between two texts. Common algorithms: Myers (default in git, optimal), patience (better for code), histogram (improved Myers). This tool uses efficient algorithms for accurate, fast comparisons.
A patch file contains diff output that can be applied to transform one file into another. Use unified diff format with context lines. Apply with: patch < file.patch. Useful for sharing changes without sending full files.
Yes, paste JSON in both panels. For semantic comparison (ignoring formatting), format both JSON files first, then compare. This shows actual data differences rather than whitespace changes.
Three-way merge compares two modified versions against a common ancestor, automatically merging non-conflicting changes. Used by git for branch merging. This tool does two-way comparison; for three-way, use git merge tools.
This tool handles reasonably large files in the browser. For very large files: 1) Compare specific sections, 2) Use command-line tools like diff or git diff, 3) Consider specialized diff tools for binary or huge files.