</>DevTools

±Diff Compare

Compare two texts and highlight differences

Text Diff Compare Complete Guide

Diff Compare visually highlights differences between two texts line by line. Added lines appear in green, removed lines in red — giving you an instant overview of all changes. Particularly useful for code reviews, before-and-after document comparisons, and auditing configuration file changes.

Understanding Diff Algorithms

The Myers Algorithm — What Git Uses

This tool uses the Myers diff algorithm (published by Eugene Myers in 1986), which finds the longest common subsequence (LCS) between two texts to compute the minimum edit distance. Git, GitHub PR diffs, and VS Code's file compare all use the same principle.

Line diff vs Word diff vs Character diff

GranularityCharacteristicBest For
Line diffCompare per line (this tool)Code, config files
Word diffCompare per wordDocuments, translations
Character diffCompare per characterTracking JSON value changes

Relationship to Git Diff

git diff tracks file history and shows context lines around each change hunk. This tool compares two text snapshots instantly — no git repository needed, making it ideal for quick reviews or comparing non-versioned text.

Practical Use Cases

  • Code review: Share changes with teammates before a PR
  • Config file audit: Compare nginx.conf or docker-compose.yml before and after
  • Translation review: Spot missing paragraphs between source and translation
  • API response diff: Track changes between two versions of a JSON response
  • Resume / documents: Clearly see what changed between drafts

Practical Example: Auditing a Config Change

# Original
PORT=3000
DB_URL=postgres://localhost/dev
DEBUG=true

# Modified
PORT=8080
DB_URL=postgres://prod-server/prod
# DEBUG=true  ← commented out

Comparing these two blocks instantly highlights all three changes — PORT, DB_URL, and the commented-out DEBUG — color-coded in a single view.

🔗Related Tools💻 Regex / Code