Text Diff
3added3removed

Original (A)

Changed (B)

Differences

5 rows
1
host: api.example.com
1
host: api.example.com
2
retries: 2
2
retries: 3
3
timeout: 10
3
timeout: 30
4
debug: true
4
debug: true
5
region: us-east-1
5
region: eu-west-1

Text Diff

Compare two text files or strings line by line and see exactly what changed. Paste the before and after text into the live tool — added and removed lines appear side by side or as a copy-ready unified diff, all locally.

About this tool

What is it?
DataFormatter Text Diff is a free online tool that compares two texts line by line and reports every added and removed line, rendered side by side or as a git-style unified diff.
Who is it for?
Developers and analysts comparing config files, generated output, log exports or any plain-text document between two versions.
What makes DataFormatter's tool different?
Diffing runs entirely in your browser with line endings normalized, so nothing you paste is uploaded and text-only format noise stays out of the result.

Quick start

  1. Paste the original text into Original (A) and the edited version into Changed (B).
  2. Read the summary chips for added and removed line counts.
  3. Scan the side-by-side view: red block on the left for removals, green on the right for additions.
  4. Switch to Unified for a git-style, copy-paste friendly view of the same changes.

What text diff compares

The tool aligns both inputs line by line and reports every difference relative to the Original (A) side. Comparison rules:

  • Added lines are lines present only in Changed (B), prefixed +.
  • Removed lines are lines present only in Original (A), prefixed −.
  • Replaced lines show as a remove/add pair so you can read the before and after together.
  • Lines match exactly — no trimming, no case folding, no pattern matching.
  • Common lines are kept as context so you can see where a change sits in the file.

How to diff text online

  • Paste the two versions into the A and B editors — results update instantly as you type.
  • Use Swap to flip which side is treated as the original.
  • Switch between Side-by-side and Unified for reading or sharing.
  • Copy Diff hands a git-style patch to a colleague; everything stays in your browser.
Change on one side
host: api.example.com
retries: 2
timeout: 10
debug: true
What the diff reports
host: api.example.com
-retries: 2
+retries: 3
-timeout: 10
+timeout: 30
debug: true

Who diffs text — and when

Reviewing config changes

A config file changed between environments or branches. Paste both versions here to see the exact lines that added, removed or replaced settings.

Verifying generated output

Re-run a script or exporter and diff its output against the previous run to confirm only the intended content moved.

Comparing logs and exports

Aligned, line-level diffs make it easy to spot a new error group in a log export or the extra column in a data dump.

Common diff surprises

Whole file shows as one delete and one add

Why: Nearly every line differs — most often because one side was resaved with different indentation, line endings not yet normalized, or tabs vs spaces.

Fix: Normalize indentation first, then re-paste. Line endings (CRLF vs LF) are already normalized by the tool.

Changed lines appear out of order

Why: The alignment favors the longest run of matching lines, so a large moved block can be reported as many small changes near the common lines instead of one move.

Fix: The line numbers on each side tell you exactly where each change came from.

Both inputs are JSON

Why: A line diff of JSON is noisy — a single field change can shift a whole pretty-printed block.

Fix: Use JSON Diff instead: it reports changed values by path and ignores formatting entirely.

Pro tips

  • Small formatting differences surface immediately — trailing spaces and case changes are real deltas, not invisible.
  • The unified view drops straight into git or code-review threads when you need to paste a readable change.
  • Still using an upload-based compare site? This tool keeps your files on your machine, not on someone else's server.

Frequently asked questions

How does this text diff tool compare my files?

Both texts are split into lines and aligned by a longest-common-subsequence algorithm. Lines that appear in only one side are reported as removed (only in A) or added (only in B); identical lines are shown as context.

Can it diff JSON?

Yes — it diffs any text, including JSON. The tool also detects when both sides are valid JSON and suggests the structural JSON Diff, which reports changes by path instead of by line.

Does it ignore whitespace?

No. Lines are compared exactly, including leading and trailing spaces. A line that gained a trailing space counts as a change — useful when a file was resaved with different indentation.

How are line endings handled?

Windows CRLF and old Mac CR endings are normalized to LF before comparing, so two files with only different line endings finish as identical.

Is my text uploaded anywhere?

No. The entire diff runs locally in your browser. Nothing you paste ever leaves this page.

Can I copy or save the diff?

Yes. Copy Diff copies a unified, git-style view with @@ headers and +/- lines; Download saves that same view as a text file.

Related tools

Last reviewed September 2026 · DataFormatter team — this tool processes data locally in your browser.