UtilHub

Diff Checker

Paste two versions of any text to see the differences highlighted line-by-line. Supports word-level and character-level diffs. Great for comparing code, documents, or config files.

+4 added-2 removed3 unchanged
3
1-function greet(name) {
1+function greet(name, greeting = "Hello") {
2+ const message = `${greeting} ${name}!`;
2- const message = "Hello " + name;
3+ console.log(message);
4+ return message;
35 console.log(message);
46 return message;
57 }

Frequently Asked Questions

How does the diff algorithm work?

This uses a simplified Myers diff algorithm, the same algorithm used by Git and most diff tools. It finds the shortest edit script (minimum insertions + deletions) to transform one text into another.

What does the context setting do?

Context controls how many unchanged lines to show around each change. This is the same as git diff -U3. Set to 0 to only show changed lines, higher to see more surrounding context.