Text Diff Checker

Compare two blocks of text side by side. See additions, deletions, and unchanged lines with line numbers.

When developers use diff tools

  • Code review — compare a file before and after your changes to double-check what you modified before committing.
  • Config file comparison — compare two versions of nginx.conf, docker-compose.yml, or .env files to find what changed between environments.
  • API response comparison — paste two JSON payloads to quickly see which fields changed between API versions or environments.
  • Document version tracking — compare contract revisions, README files, or any text documents to identify edits.

Understanding unified diff format

The copied output uses the standard unified diff format — the same format used by git diff:

--- original
+++ modified
@@ -1,4 +1,4 @@
 line 1 (unchanged, starts with space)
-line 2 was removed (starts with -)
+line 2 was replaced (starts with +)
 line 3 (unchanged)
+line 4 was added (starts with +)

Diff in the command line

# Compare two files
diff file1.txt file2.txt

# Unified format (same as git diff output)
diff -u file1.txt file2.txt

# Side-by-side comparison
diff -y file1.txt file2.txt

# Compare directories recursively
diff -r dir1/ dir2/

# Git: show what changed in last commit
git diff HEAD~1 HEAD

Related Tools

Frequently Asked Questions

How does the diff checker work?

The diff checker uses the Longest Common Subsequence (LCS) algorithm to find the optimal set of differences between two texts. It highlights added lines in green, removed lines in red, and shows unchanged lines for context.

Can I compare code with this tool?

Yes. The diff checker works with any text including source code, configuration files, JSON, XML, and plain text. It preserves whitespace and indentation for accurate code comparison.

Is there a size limit?

Since everything runs in your browser, the practical limit depends on your device's memory. It handles texts with thousands of lines efficiently.

Can I copy the diff output?

Yes. Click the 'Copy Diff' button to copy the unified diff format to your clipboard, with + for additions, - for removals, and space for unchanged lines.