Skip to main content

Text Diff Tool

Compare two texts and highlight differences. Line-by-line and character-level diff. Useful for code review and document comparison.

The diff shows line changes; the character view narrows further to the exact insertion or deletion. Whitespace-only changes can be ignored, which is usually what you want when reviewing a pull request.

Tool workspace

Original Text
Modified Text
Comparison mode

Compares raw text line by line. Whitespace and letter case count as differences unless ignored below.

Compare options

Line-by-Line

Compares text line by line to identify added and removed lines.

Character Level

Highlights differences at the character level within changed lines.

Reference: a real run, the parameters, and the failure modes

Worked example

Text mode on a one-character change, then JSON mode on a key-order change

Input

original:
const greet = (name) => `Hello, ${name}`;

modified:
const greet = (name) => `Hello, ${name}!`;

Output

Text mode: one changed line, shown as `- const greet = (name) => `Hello, ${name}`;` and `+ ...!`;. JSON mode on the sample pair: a single change at `limits.kb`, 1024 → 2048 — the reordered keys are not reported.

How to verify: `git diff --no-index a.txt b.txt` or `diff -u a.txt b.txt` prints the same two lines. In JSON mode the output must not list name, version or features as changed.

Parameters

Parameters
ParameterValueDefaultBound
ModeText or JSONTextJSON mode canonicalizes key order; the whitespace toggle is inactive there
Comparison unitLine (text) / leaf path (JSON)LineA moved line is reported as a −/+ pair, not as a move
Ignore whitespaceOn or offOffCollapses every whitespace run and trims the line; ignored in JSON mode
Ignore caseOn or offOffÜnïcode-aware; Ä and ä are equal, ß and ss are not
Displayed changesFirst 1,000 diff lines1,000Longer results are cut with a notice; the added/removed counters stay complete
Output shapeLines prefixed with −, + or space—No @@ hunk headers and no ---/+++ file headers; not a patch file

Failure checklist

Failure checklist
SymptomLikely causeWhat to do
Every line is marked as changed.One side has CRLF line endings, the other LF.Normalize line endings before comparing.
The two panes look identical but the tool reports no change.Ignore whitespace or ignore case is switched on.Turn both options off to see the raw difference.
JSON mode reports invalid JSON.The text is not strict JSON: comments, trailing commas or single quotes.Remove them, or compare in text mode.
Only part of the difference is listed.The 1,000-line display cap was reached.Compare in smaller pieces; the counters at the top still cover the whole input.
Umlauts or ß are marked as changed although the words look the same.NFC and NFD forms differ, or ss and ß spellings differ.Normalize the Unicode form first; ß and ss are different words to this tool.
How to Compare Text Online

Learn how to compare two texts and highlight differences using a client-side tool.

  1. 1

    Enter original text

    Paste the original text in the left input box.

  2. 2

    Enter modified text

    Paste the modified text in the right input box.

  3. 3

    Click Compare

    The tool highlights differences line by line and character by character.

  4. 4

    Review results

    View added, removed, and unchanged lines in split or unified view.

Use cases
  • 1Review code changes line by line before committing or merging
  • 2Compare two versions of a configuration, document, or API payload
  • 3Spot whitespace and character-level differences that break exact-match checks
  • 4Track what changed in logs or error messages across environments

Frequently Asked Questions

Which diff modes are available?

Line-by-line and character-level comparison, with unified and side-by-side views.

Are my texts uploaded?

No. Comparison happens entirely in your browser.

Can I compare large files?

Large inputs are handled client-side; performance depends on your browser.

Can I compare JSON semantically instead of line by line?

Yes. The JSON mode parses both sides and reports added, removed, and changed keys regardless of key order or whitespace. Line and character modes remain available for plain text.

How large can the inputs be?

Each side accepts up to 1 MB, which keeps the comparison responsive in the browser. Larger inputs are rejected with a clear message rather than freezing the tab.

Related Guides

Related Tools

Your inputs remain on your device.

You are responsible for key management and output validation.