Skip to content
Utilities2026-05-316 min read

Online Text Diff Tool: Compare Two Texts Side by Side

What Is Text Diff

Text Diff means comparing two strings and marking what changed. git diff is the familiar form: an edit script of insertions and deletions, not a replay of the author's keystrokes.

The Text Diff tool is for snapshots you already have—configs, API bodies, log slices, code excerpts—compared in the browser with side-by-side or unified layout. Processing stays local. For commit history, keep using git log -p.

Why You Need Text Diff Comparison

  1. Code-snippet review: See what changed in a function or draft patch
  2. Configuration management: Diff Nginx, .env, or Compose fragments across environments
  3. Docs and translation: Catch missing or extra paragraphs
  4. Log analysis: Find the lines that actually drifted
  5. Pre-pass before structural diff: Spot serialization noise before JSON/YAML semantic compare

How to Use ToolVault Text Diff

Open the Text Diff tool:

  1. Paste Original on the left and Modified on the right
  2. There is no Compare button — the diff view appears as soon as either side has content
  3. Optionally enable Ignore whitespace (per-line trim) and Ignore case (lower-case both sides)
  4. Toggle side-by-side vs unified layout
  5. Read the stats bar: +added / -removed / ~modified / =unchanged plus line counts

Monaco colors additions green-ish and deletions red-ish. A “modification” usually appears as delete-old + add-new. The ~modified counter comes from a separate index-aligned tally (see Implementation notes)—not a distinct yellow highlight mode.

Example / Swap / Clear load a sample, swap panes, or wipe both. Inputs persist in local storage for the browser profile—Clear after pasting secrets.

Algorithms: LCS, Myers, Patience, Histogram

Line diffs aim for a short edit script, not your mental model of the edit.

NameIntuitionWhere you meet it
LCS DPLongest common subsequence; non-LCS lines are changesTextbooks, simple ports
MyersShortest path on an edit graph; memory-friendlyClassic git diff
PatienceAnchor on unique common lines, recursegit diff --patience; often clearer on moves
HistogramFrequency buckets; improves Patience on repeatsNewer Git defaults

Diff output is not unique. Several minimal paths can all be correct—two tools disagreeing on hunk shape does not mean either is wrong.

Before:        After:
apple          apple
banana         cherry
cherry         date
date

An LCS of apple → cherry → date reads as “delete banana, insert cherry somewhere”—not “rename banana to cherry.” When a moved block looks shredded, try Patience/Histogram in Git, or normalize ordering before diffing.

Complexity

Naive LCS is about O(m×n). A few thousand lines stay interactive in the browser; six-figure line counts should move to local git diff / diff -u or be sliced.

Side-by-Side vs Unified; Line vs Character

This tool switches layout (side-by-side vs unified), not a “line mode / character mode” algorithm pair.

GranularityGood forNotes
LineCode, configsPrimary alignment unit in Monaco Diff
Inline character highlightsChanged linesMonaco marks in-line edits (extra space, quote drift)
Word-levelProse reflowNot a separate mode here; use git diff --word-diff locally

If Monaco fails to load, the fallback compares line i to line i. An insertion in the middle marks every following line as changed—weaker than Monaco’s Myers-style alignment.

Whitespace, Case, CRLF

Ignore whitespace (actual behavior)

Ignore whitespace runs trim() on each line before diffing. It does not:

  • Collapse internal spaces (a b vs a b still differs)
  • Match git diff -w / diff -w
  • Drop blank lines or normalize indentation style

Keep it off for YAML, Python, Makefiles. Turn it on for prose or noisy logs. For stronger cleanup, use the whitespace remover first.

Ignore case

Lower-cases both sides. Handy for mixed log levels; wrong when case is semantic.

CRLF vs LF

\r\n vs \n makes identical-looking lines differ. Normalize line endings first. Trailing blank lines, BOM, and zero-width characters show up under inline highlights.

Reading a Unified Diff / Patch

diff --git a/app.conf b/app.conf
--- a/app.conf
+++ b/app.conf
@@ -1,4 +1,5 @@
 listen 80;
-server_name example.com;
+server_name www.example.com;
+access_log /var/log/nginx/access.log;
  1. --- / +++: file paths (not content)
  2. @@ ... @@: hunk header (old/new ranges)
  3. Leading space: context
  4. - / +: removed / added
  5. Adjacent delete+add blocks: often one logical edit

Already have a unified patch and want +N -M, file count, and a rough feature/docs/style guess? Use Diff Summary—it parses patch text, it does not compare two free-form panes. Pane compare stays on Text Diff.

Practical Use Cases

Configuration troubleshooting

Diff last-known-good vs current. Align line endings, then experiment with ignore-whitespace. For YAML/Compose, YAML ↔ JSON and the YAML JSON guide explain serialization traps that look like huge diffs.

API responses and JSON

Reorder and indent noise dominate raw bodies. Format with the JSON formatter, use JSON Diff for semantic trees (JSON Diff guide), and keep text diff for already-normalized dumps or semi-structured logs.

Translation and copy

Check omissions; normalize case with the case converter when needed. To extract lines before comparing, see the regex guide and regex tester.

Environment and list-like text

Reordered identical lines become mass delete+add. Sort or dedupe first.

Implementation notes

Behavior of DiffTool + DiffViewer (DiffEditor from @monaco-editor/react, assets under /monaco-editor/vs):

  • Engine: Monaco DiffEditor (line alignment + inline character highlights on changed lines). Fallback after load timeout: index-aligned line compare—weaker when lines are inserted mid-file.
  • No separate character-mode toggle: character detail is Monaco’s inline highlight, not a full-text character LCS mode.
  • Ignore whitespace: per-line trim only—not diff -w.
  • Ignore case: full-string lower-casing.
  • Stats bar: computeDiffStats counts by matching indices; it can disagree with Monaco’s minimal edit script. Trust the diff view for review; treat stats as volume hints.
  • No ignore-pattern regex: only whitespace and case toggles exist in the UI.
  • Local-only compute; inputs persist via usePersistentState—Clear on shared machines.

FAQ

What formats are supported?

Any plain text—code, JSON, XML, CSV, logs. The tool does not parse structure.

Will large files be slow?

Thousands of lines are usually fine. Hundreds of thousands should be sliced or handled with local diff.

Does the tool upload my data?

Diffing runs in the browser. Persistence keys stay in that browser profile; Clear after sensitive pastes.

Texts look identical but still differ?

CRLF/LF, trailing blank line, trailing spaces, tab vs spaces, BOM, zero-width characters. Diff with ignore-whitespace off first, or normalize with the whitespace tool.

Text Diff vs JSON Diff vs Diff Summary?

NeedTool
Two plain-text / config snapshotsText Diff
Semantic JSON tree diffJSON Diff
Summarize an existing unified patchDiff Summary

Further reading


From the ToolVault developer notebook. Browse more online tools on the homepage.