Diff Checker

Compare two texts and highlight the differences.

+4 added-4 removed3 unchanged
Original
1
function greet(name) {
2
  console.log("Hello, " + name);
 
 
3
  return true;
4
}
5
 
6
// Call the function
7
greet("World");
 
 
Modified
 
 
1
function greet(name, greeting = "Hello") {
2
  console.log(greeting + ", " + name + "!");
3
  return true;
4
}
5
 
 
 
6
// Call the function with greeting
7
greet("World", "Hi");

Common use cases

1.Compare code changes before committing
2.Review document revisions
3.Find differences in config files
4.Debug by comparing expected vs actual output
5.Check for plagiarism or unauthorized changes
6.Merge changes from different sources

Frequently Asked Questions

How does the diff algorithm work?

We use the Longest Common Subsequence (LCS) algorithm. It finds the longest sequence of lines common to both texts, then marks remaining lines as added or removed.

What do the colors mean?

Green (+) indicates lines that were added in the modified text. Red (-) indicates lines that were removed from the original. Unchanged lines have no highlight.

What's the difference between split and unified view?

Split view shows original and modified side-by-side. Unified view shows all changes in a single column with +/- markers, similar to git diff output.

Can I compare code files?

Yes. Paste any text including code. The tool compares line by line. For syntax highlighting, copy the diff output to your code editor.

Is my text uploaded anywhere?

No. All comparison happens in your browser using JavaScript. Your text never leaves your device.

Related Tools