Text Diff Checker
Compare two blocks of text and see differences highlighted line by line.
What is a Text Diff?
A diff (short for difference) compares two texts and highlights what changed between them. Diffs show additions, deletions, and modifications line by line. Essential for code reviews, document comparison, configuration auditing, and debugging. The diff algorithm (typically Myers or patience) finds the minimum set of changes.
Reading Diff Output
Lines prefixed with + (green) were added. Lines with - (red) were removed. Unchanged lines provide context. In unified diff format, @@ markers show line numbers. Understanding diffs is essential for working with Git and code review tools.
# Git diff
git diff file.txt
# Compare two files (CLI)
diff -u old.txt new.txt
# Python
import difflib
diff = difflib.unified_diff(
old_lines, new_lines,
fromfile='old.txt', tofile='new.txt'
)Frequently Asked Questions
- What diff algorithm does this tool use?
- This tool computes a line-by-line diff, highlighting additions and deletions. It's similar to the unified diff format used by Git and most code review tools.
- Can I compare code files?
- Yes. Paste any text including source code, configuration files, JSON, or log output. The tool compares line by line and highlights all differences.
Related Tools
Hash Generator
Generate MD5, SHA-1, SHA-256, and SHA-512 hashes from text.
JSON Formatter & ValidatorFormat, validate, and minify JSON with syntax highlighting.
HTML Entity Encoder/DecoderEncode special characters to HTML entities or decode them back.
Regex TesterTest regular expressions against text with real-time match highlighting.