Skip to main content
CheckTown
Dev Tools

Text Diff Tool: Compare Files and Spot Every Change

Published 5 min read
In this article

What Is a Text Diff?

A text diff is a comparison between two versions of text that highlights exactly what changed. It shows additions (new lines or characters), deletions (removed content), and unchanged context. Diff tools are fundamental to version control, code review, and document comparison workflows.

The most common diff algorithm is Myers diff, which finds the minimum number of edits (insertions and deletions) to transform one text into another. This is the algorithm used by Git and most diff tools.

How Diff Comparison Works

CheckTown's text diff compares two text inputs and presents the differences visually.

  • Line-by-line diff — compares texts at the line level, showing which lines were added, removed, or modified
  • Inline character diff — for modified lines, highlights the specific characters that changed
  • Side-by-side view — displays both versions in parallel for easy visual comparison

Try it free — no signup required

Compare Text →

When To Use Text Diff

Text diff is useful in any workflow where you need to identify changes between two versions of content.

  • Code review — compare code versions to understand what changed in a pull request or patch
  • Document comparison — identify changes between contract versions, policy documents, or configuration files
  • Data debugging — compare API responses from different environments to identify discrepancies

Frequently Asked Questions

What is the unified diff format?

Unified diff is the standard text-based diff format used by git diff and patch. Lines starting with + are additions, lines starting with - are deletions, and lines with no prefix are unchanged context lines. The @@ markers indicate which line numbers the chunk applies to.

What is the difference between word diff and line diff?

Line diff shows entire lines as added or removed. Word diff (git diff --word-diff) shows changes at the word level within lines, making it easier to spot small edits in long lines. Character-level diff shows every individual character change, which is most useful for comparing closely related strings.

How do I ignore whitespace in a diff?

Most diff tools support whitespace-ignoring options. In Git, use git diff -w to ignore all whitespace changes or -b to ignore changes in whitespace amount. This is useful when comparing code that was reformatted without functional changes, or when comparing text from different editors that may use different line endings.

Related Tools