Diff Checker
Paste your original and modified text below, then click Compare to see the differences highlighted line by line.
How to Use the Diff Checker
Comparing two versions of a text or code file is one of the most common tasks in software development, writing, and content editing. This free online diff checker highlights exactly what changed between two texts so you can quickly review modifications, catch unintended edits, and understand the evolution of a document. Simply paste both versions and click Compare.
- Paste original text: Copy the earlier version of your text, code, or configuration file into the "Original Text" field on the left.
- Paste modified text: Copy the updated version into the "Modified Text" field on the right.
- Click Compare: The tool splits both texts into individual lines and uses a Longest Common Subsequence algorithm to determine which lines were added, removed, or left unchanged.
- Review the output: Additions appear with a green background and a "+" prefix. Deletions appear with a red background and a "−" prefix. Unchanged lines appear with no background highlight.
Understanding Diff Output
| Indicator | Colour | Meaning |
|---|---|---|
| + (plus) | Green | Line was added in the modified version |
| − (minus) | Red | Line was removed from the original version |
| (space) | None | Line is identical in both versions |
Common Use Cases
- Code review: Compare your code before and after a refactor to verify only the intended lines changed. This is especially helpful when reviewing pull requests or debugging regressions.
- Configuration management: Compare two versions of a server configuration, environment file, or YAML manifest to pinpoint exactly which settings changed between deployments.
- Document editing: Writers and editors can compare drafts to see what was added, removed, or reworded, making the revision process transparent and efficient.
- Data validation: Compare CSV exports, SQL dumps, or log files to ensure data integrity and detect unexpected modifications.
- Merge conflict resolution: When resolving Git merge conflicts, paste both conflicting versions to visualise the differences before deciding which changes to keep.
About the LCS Algorithm
The Longest Common Subsequence (LCS) algorithm is the foundation of most text comparison tools, including GNU diff and Git's built-in diff engine. It works by finding the longest sequence of lines that appear in both texts in the same order, though not necessarily consecutively. Lines that are not part of this common subsequence are marked as either additions or deletions. This approach produces minimal, intuitive diffs that accurately represent the smallest set of changes needed to transform the original text into the modified version.
Frequently Asked Questions
How does the diff algorithm work?
This tool uses a Longest Common Subsequence (LCS) based algorithm to compare two texts line by line. It finds the longest sequence of lines common to both texts, then marks everything else as either an addition (present only in the modified text) or a deletion (present only in the original text). This is the same fundamental approach used by tools like Git diff and Unix diff.
Can I compare code files with this tool?
Yes. Paste the contents of any two text files — source code, configuration files, CSV data, or plain text — into the original and modified fields. The diff output preserves whitespace and line breaks, so indentation differences in code are clearly visible.
What do the colours in the output mean?
Green highlighted lines are additions — text that exists in the modified version but not in the original. Red highlighted lines are deletions — text that was in the original but removed in the modified version. Lines with no highlight are unchanged between the two versions.