Skip to content

Runs entirely in your browser. Nothing you paste leaves this page.

Free / No sign-up

Text diff checker: compare two texts online.

Compare two versions of any text and see exactly what changed, line by line and word by word, side by side or as a unified diff. Both texts stay in your browser.

View

+4 added-3 removed1 unchanged

1Nexzem builds web apps.1Nexzem builds web and mobile apps.
2We ship every two weeks.2We ship every two weeks.
3Support is included for 30 days.3Support is included for 90 days.
4Contact us by email.4Contact us by email or WhatsApp.
5NDA available on request.

Line-by-line comparison with the Myers algorithm (the one behind git diff), plus word-level highlights inside changed lines. Both texts stay in your browser.

How to use it.

  1. 01

    Paste the original text on the left and the changed version on the right, or load the sample.

  2. 02

    Choose side by side or unified view, and tick Ignore whitespace or Ignore case if those differences do not matter.

  3. 03

    Read the highlighted lines and words, check the added and removed counts, or copy the diff.

What it does.

Everything this tool handles, all of it inside your browser tab.

  • Line-by-line comparison with the Myers O(ND) algorithm
  • Word-level highlights inside changed lines
  • Side-by-side or unified view, unified by default on phones
  • Ignore whitespace and ignore case options
  • Counts of added, removed and unchanged lines
  • Copy the result as a plain +/- diff
  • Swap the two texts in one click
  • Both texts stay in your browser

Worked examples.

  • Find the changed word in a line

    Original: Support is included for 30 days.
    Changed:  Support is included for 90 days.
    
    - Support is included for [30] days.
    + Support is included for [90] days.

    The line is marked changed and only 30 and 90 are highlighted, thanks to the word-level pass inside the paired lines.

  • Unified diff of two versions

    - Nexzem builds web apps.
    + Nexzem builds web and mobile apps.
      We ship every two weeks.
    - Support is included for 30 days.
    - Contact us by email.
    + Support is included for 90 days.
    + Contact us by email or WhatsApp.
    + NDA available on request.

    This is the built-in sample in unified view: 4 lines added, 3 removed, 1 unchanged. Lines starting with two spaces are the same in both.

  • Compare two JSON responses

      "plan": "pro",
    - "seats": 10,
    + "seats": 12,
      "currency": "USD",

    Pretty-print both responses with the same indentation first. Minified JSON is one long line, so the whole response would show as changed.

  • Ignore whitespace

    Original:  '  return total;'
    Changed:   'return  total;'
    
    Ignore whitespace off → 1 removed, 1 added
    Ignore whitespace on  → 1 unchanged

    Indentation and repeated spaces are collapsed before comparing, while the text is still shown as written.

  • The same comparison on the command line

    git diff --no-index old.txt new.txt      # any two files, Myers by default
    git diff --no-index --word-diff old.txt new.txt
    git diff --diff-algorithm=histogram       # often clearer for moved code
    diff -u old.txt new.txt                   # classic unified diff

    Useful when the files are large, binary-adjacent or already on a server. The browser checker is quicker for pasted text.

What does a diff checker do?

A diff checker compares two versions of a text and shows the smallest set of changes that turns the first into the second: which lines were removed, which were added and which stayed the same. The name comes from the Unix diff command, and the same idea powers version control, code review and the track changes view in word processors.

Finding that smallest set is equivalent to finding the longest common subsequence (LCS) of the two texts: the longest run of lines that appear in both, in the same order. Everything outside it is either a deletion from the original or an insertion in the new version.

How the Myers diff algorithm works

This checker uses the algorithm Eugene Myers published in 1986, 'An O(ND) Difference Algorithm and Its Variations'. Picture a grid with the original's lines along one side and the new version's along the other. Moving right is a deletion, moving down is an insertion, and moving diagonally is free wherever two lines match. The algorithm searches outward one edit at a time and stops at the first path that reaches the far corner, which is guaranteed to use the fewest edits.

Its running time grows with N, the length of the texts, multiplied by D, the number of differences. That makes it very fast for the common case of two versions that are mostly the same, and it is why Myers is the default algorithm in git diff and the basis of GNU diff. Git also offers patience and histogram diffs, which use extra heuristics to align unique lines and often read better for moved code blocks; they do not always find the smallest edit, which Myers does.

Line-level and word-level differences

The comparison runs first on whole lines. Where lines are removed and added at the same spot, the checker pairs them up as changed lines and then runs a second, word-level diff inside each pair, splitting text into words, spaces and punctuation. Only the words that actually changed are highlighted, so a one-word edit in a long paragraph is easy to spot.

To review a diff well, start with the counters to judge the size of the change, scan the overall shape of the edits, then read the word highlights line by line. In contracts and policies, look hardest at small words that flip meaning, such as may and must or a missing not, and at numbers, dates and names, which a quick read easily glosses over.

The side-by-side view puts the original and the new version in two columns with line numbers, which suits reviews on a large screen. The unified view shows one column, with removed lines marked - and added lines marked +, the same convention as git diff; it is the default on phones, where two columns do not fit. The counters above the result show how many lines were added, removed and left unchanged.

When to ignore whitespace and case

Ignore whitespace trims each line and collapses runs of spaces and tabs before comparing, so re-indented code, trailing spaces and double spaces after full stops no longer count as changes. Ignore case does the same for capitalisation. The original text is still displayed exactly as written; only the comparison changes.

Use them when you care about content rather than formatting, for example comparing a document that was reflowed, or configuration files that were re-indented. Leave them off when whitespace is meaningful, as in YAML, Python and Makefiles, where an indentation change can alter behaviour. Note that blank lines are still lines, so adding or removing one shows as a change either way.

Real uses: contracts, configs, JSON and translations

Common jobs include reviewing what changed between two drafts of a contract, policy or proposal; comparing configuration or environment files between staging and production; checking an editor's changes to an article; comparing translations or subtitle files; and spotting the one value that differs between two long API responses or log extracts.

For JSON, format both sides first with the JSON formatter using the same indentation. Minified JSON is a single line, so any change marks the whole thing as different; pretty-printed JSON puts each value on its own line and the diff points straight at it. For Markdown documents, compare the source here and preview the result in the Markdown viewer.

Diff checker vs version control

An online diff tool is ideal for one-off comparisons of text that is not in a repository. For code and documentation that changes over time, version control such as Git records every change automatically, with author and reason, and shows diffs in every pull request as part of code review. git diff --no-index compares any two files on disk, and git diff --word-diff gives a word-level view similar to the highlights here.

Limits and privacy

Both texts are compared in your browser and never uploaded, so the checker is safe for contracts, credentials in config files and unreleased work. Texts of thousands of lines compare quickly. Because the work grows with the number of differences, two large and almost completely different texts can hit a built-in limit of 4,000 edits; at that point they are not really versions of each other and a diff is not useful.

A paragraph that was moved shows as a deletion in one place and an insertion in another, since a line diff does not track moves. Copy unified diff gives you the result as plain text with -, + and two-space prefixes, handy for sharing in chat or a ticket; it is not a patch file with @@ hunk headers, so use git diff when you need one to apply.

Questions, answered

Something else on your mind? Ask a consultant and get a reply within one business day.

How do I compare two texts online?

Paste the original into the left box and the changed version into the right. Differences are highlighted immediately, line by line and word by word, in side-by-side or unified view.

Which diff algorithm does this use?

The Myers O(ND) algorithm, which finds a minimal edit script and is the default in git. Changed lines are then compared word by word for finer highlights.

Can I compare two files?

Yes: open each file, copy its contents and paste them into the two boxes. For Word or PDF documents, copy the text out first; formatting such as bold or fonts is not compared.

Is it safe for confidential documents?

Yes. The comparison runs entirely in your browser and nothing is uploaded or stored, so contracts, configs and unreleased work stay on your device.

What is a unified diff?

A single column where removed lines start with - and added lines with +, the convention used by git and patch files. Use Copy unified diff to share the result as text.

Why is a whole line marked when only one word changed?

The comparison works on lines first, so the line is marked changed. Inside it, only the words that differ are highlighted more strongly.

Why does a moved paragraph show as deleted and added?

A line diff finds the fewest insertions and deletions and does not track moves. A moved block appears as removed in one place and added in another.

How do I ignore whitespace or case differences?

Tick Ignore whitespace to treat lines that differ only in spacing or indentation as equal, and Ignore case to ignore capitalisation. Added or removed blank lines still count as changes.

Is there a size limit?

Texts of thousands of lines compare quickly. Two very large and almost completely different texts may hit the safety limit, because diff work grows with the number of differences.

Can I use it to compare code?

Yes, it works for any plain text, including code and config files. For code under version control, git diff and pull request reviews give you the same view with full history.

More free tools.

All tools

Need tooling like this inside your product?

We build internal tools, developer platforms and APIs. Tell us what your team keeps doing by hand.