Diff Checker — How to Compare Text & Code
Learn how to compare text, code, and JSON files. Use our Diff Checker tool to find differences side by side.
What is a Diff?
A diff (short for difference) shows the changes between two files or texts. It highlights additions, deletions, and modifications line by line. Diffs are essential for code review, version control (git), debugging configuration changes, and tracking document revisions.
Diff Output Formats
--- original.txt +++ modified.txt @@ -1,5 +1,6 @@ line 1 -line 2 (removed) +line 2 (replaced) line 3 +new line 4 line 5 -line 6 (deleted)
Original
line 1 line 2 (removed) line 3 line 5 line 6 (deleted)
Modified
line 1 line 2 (replaced) line 3 new line 4 line 5
Real-World Diff Examples
Before
{
"name": "John",
"age": 30,
"email": "john@old.com"
}After
{
"name": "John Smith",
"age": 31,
"email": "john@new.com",
"phone": "+1-555-0000"
}Old Version
function greet(name) {
return "Hello " + name;
}
console.log(greet("World"));New Version
function greet(name, formal) {
if (formal) return "Good day, " + name;
return "Hello, " + name;
}
console.log(greet("World", false));When to Use a Diff Checker
• Reviewing code changes before committing to version control
• Comparing configuration files across environments (dev, staging, production)
• Verifying JSON or XML changes between API responses
• Checking for unintended changes after refactoring or formatting
• Comparing document revisions or draft versions
• Debugging by comparing working vs broken versions of a file