Skip to content

Text Compare

Compare two text blocks in unified or side-by-side views.

Local, available offline
0 chars
0 chars

Combined limit: 2 MiB UTF-8 and 10,000 lines. Complex changed regions are bounded before allocation.

Difference

Run a comparison to inspect changes

No comparison yet

Paste two text blocks or load the sample. Added and removed lines always include symbols and labels, not color alone.

Working notes

Use Text Compare with the boundary visible.

Text Compare checks two bounded text inputs and presents additions, removals, and unchanged context in unified or side-by-side form.

What is Text Compare?

A text diff (short for difference) compares two versions of text and highlights exactly what changed between them. The algorithm finds the longest common subsequence of lines shared between both inputs, then marks everything else as an addition (present only in the new version) or a removal (present only in the old version). Diff tools are foundational to software development — Git uses a diff algorithm to track changes between commits, code review tools display diffs to show what a pull request changes, and deployment pipelines compare configuration files to detect drift. This tool runs a line-oriented diff entirely in your browser, showing results in unified format (interleaved additions and removals with context lines, like git diff) or side-by-side format (old and new text in parallel columns with aligned changes). It processes large inputs in a Web Worker to keep the UI responsive.

When to use it

  • Reviewing configuration changes — compare the old and new versions of a config file to see exactly which values changed before deploying.
  • Debugging unexpected output — diff expected and actual test output to pinpoint the exact lines that differ.
  • Comparing API responses — paste two JSON or XML responses to find differences in field values or structure.
  • Auditing document revisions — compare two versions of a contract, policy, or specification to identify all modifications.
  • Verifying migrations — diff database schema dumps before and after a migration to confirm only intended changes were applied.

How to use it

  1. 01Place the earlier (original) text on the left and the revised (new) text on the right.
  2. 02Choose unified or side-by-side output format.
  3. 03Run the comparison. Added lines are highlighted in green, removed lines in red, and unchanged context lines provide surrounding context.
  4. 04Review the bounded result and copy the diff output if needed.

Common mistakes

  • Trailing whitespace differences — invisible trailing spaces or tabs cause lines to show as changed even when the visible content is identical. Trim whitespace if these differences are not meaningful.
  • Line ending differences — Windows (CRLF) and Unix (LF) line endings produce different diffs. Normalize line endings before comparing if cross-platform consistency matters.
  • Comparing formatted vs unformatted text — reformatting (changing indentation, line wrapping) produces large diffs that obscure the actual content changes. Compare texts with the same formatting.
  • Ignoring context lines — additions and removals are easier to understand when you can see the surrounding unchanged lines. Unified format includes context by default.
  • Character encoding mismatches — if one text is UTF-8 and the other is Latin-1, non-ASCII characters appear as changes even if the visible text looks the same.

Synthetic example

Compare one changed line

Input

Before: timeout=30
After: timeout=45

Result

- timeout=30
+ timeout=45

Related standards

Limits and data boundary

  • The comparison is line-oriented and does not understand programming-language semantics.
  • Very large inputs are bounded and processed outside the main UI thread.

Frequently asked questions

What diff algorithm does this tool use?
It uses a line-oriented longest-common-subsequence algorithm, similar to the Unix diff command, implemented entirely in your browser.
Can I compare code files?
Yes. Paste code into both panels. The tool highlights added, removed, and unchanged lines but does not apply language-specific semantic analysis.
Is there a size limit for the comparison?
Very large inputs are processed in a background worker to keep the UI responsive. Practical limits depend on your browser's available memory.
What is the difference between unified and side-by-side format?
Unified format interleaves additions (+) and removals (-) with context lines, like git diff output. Side-by-side format shows old and new text in parallel columns with aligned changes.