Text Diff Checker
The Text Diff Checker compares two pieces of text and highlights the differences between them. It shows additions, deletions, and changes in a clear visual format. This tool is essential for comparing document versions, reviewing code changes, checking edits, and verifying data transformations. It supports character-level and word-level diffing, making it useful for both small corrections and major rewrites.
Formula
Diff algorithm: - LCS (Longest Common Subsequence) - Word-level: compare word by word - Character-level: compare char by char - Line-level: compare line by line Output: - Green: added text - Red: removed text - Unchanged: normal
Example
Text 1: The quick brown fox Text 2: The slow brown fox Diff: The [quick|slow] brown fox Removed: quick (red) Added: slow (green)
How to Use
- Paste the original text in the left field
- Paste the modified text in the right field
- Select diff level (word, character, or line)
- Optionally enable ignore whitespace
- Review the highlighted differences
Frequently Asked Questions
What is a text diff?
A diff (difference) shows what changed between two versions of text. It highlights added, removed, and modified content. Diffs are used in version control, document review, and any context where you need to track changes.
What is the difference between word-level and character-level diff?
Word-level diff compares word by word, better for prose and documents. Character-level diff compares character by character, better for code and precise edits. Line-level diff compares line by line, best for structured files.
How does the diff algorithm work?
The tool uses the Longest Common Subsequence (LCS) algorithm to find the longest shared sequence between the two texts. Differences are then highlighted based on what was added or removed from the common sequence.
Can I diff very large texts?
For texts under 100KB, the browser handles it well. For larger texts, the diff may be slow. For production use with large files, use a dedicated diff tool like Git or Unix diff command.
Can I ignore whitespace in diffs?
Yes. The tool can ignore leading/trailing whitespace, multiple spaces, or all whitespace. This is useful when formatting changes should not be counted as differences, such as in code review.