Skip to content

Text Diff Checker

Paste two versions of anything — code, config, copy — and see additions, removals and unchanged lines side by side. Uses a proper LCS diff algorithm, the same category used by version control, not a naive line-by-line comparison.

  • Line-level diff (LCS algorithm)
  • Added, removed and unchanged lines
  • Line numbers on both sides
  • Change summary counts
  • Runs fully client-side

Comparator

Compared locally, nothing uploaded

Paste text on both sides to see the differences.

How to compare two texts

  1. 01

    Paste the original

    Put the starting version — the "before" — in the left field.

  2. 02

    Paste the changed version

    Put the "after" version in the right field. The comparison updates as you type.

  3. 03

    Read the result

    Removed lines are marked in red, added lines in green, and everything unchanged stays neutral, with line numbers preserved on each side.

  4. 04

    Check the summary

    The counts at the top give you the total added, removed and unchanged lines without reading through everything.

What a real diff algorithm buys you over a naive comparison

The naive way to "diff" two texts is comparing line 1 to line 1, line 2 to line 2, and so on. That falls apart the moment a single line gets inserted near the top: every line after it now looks completely different from its counterpart, even though nothing past the insertion point actually changed.

This tool computes the longest common subsequence (LCS) between the two texts — the largest set of lines that appear in the same relative order in both — and treats everything else as an addition or a removal around that shared backbone. It is the same category of algorithm Git and most version control diffs are built on, not a coincidence: it is the algorithm that actually answers "what changed" correctly.

Why a single edited line shows as remove-then-add, not "changed"

A line-based diff has exactly two primitive operations: a line is either present in both, or it is added, or it is removed. There is no third "modified" operation, because the algorithm has no concept of similarity between two different lines — only exact-match or no-match.

So editing one word in a line shows up as that whole line being removed and a new, mostly-similar line being added right after it. This is standard behaviour for line-level diffing tools generally, not a limitation specific to this one — word-level or character-level diffing is a different, more granular algorithm applied within a line, which this tool does not attempt.

What counts as a changed line

Comparison is exact per line: whitespace, capitalization and punctuation all matter. Two lines that a person would call "basically the same" but differ by a trailing space are counted as fully different lines by this algorithm, the same way git diff would treat them.

Line endings are normalized before comparing, though — Windows-style \r\n and Unix-style \n are treated as equivalent, so switching a file's line-ending convention alone does not manufacture a wall of false differences.

When line-level diffing is and is not the right tool

It is exactly right for code, configuration files, structured logs, and anything organized into meaningful lines — which is most of what developers actually diff. It is a poor fit for flowing prose with no fixed line breaks, since the "lines" in that case are really just wherever a paragraph happened to wrap, and a diff of wrap points is not a diff of meaning.

Frequently asked questions

Why does changing one word show the whole line as removed and re-added?

Because line-level diffing only knows two things about a line: whether it exists in both texts, or not. There is no concept of "mostly the same line" — editing any part of a line means the old version is removed and the new version is added, which is standard behaviour for this class of algorithm, the same as git diff at the line level.

What algorithm does this use?

A longest common subsequence (LCS) diff — the same category of algorithm used by Git and most version control systems. It finds the largest set of lines shared between both texts in the same order, and reports everything else as an addition or removal around that shared structure.

Does whitespace count as a difference?

Yes, comparison is exact per line, so a trailing space or different indentation makes two otherwise-identical lines count as different. Line-ending style is the one exception: Windows CRLF and Unix LF are normalized before comparing, so that alone will not show as a change.

Can I compare two files, not just pasted text?

Not directly — paste the contents of each file into the two fields. Everything runs in your browser, so pasting file contents does not upload the files anywhere.

Is this good for comparing paragraphs of prose?

Less so than for code or structured text. Line-level diffing compares wherever the line breaks happen to fall, and prose often reflows differently between two drafts even when the underlying wording barely changed, which produces a noisier diff than the actual edit.

Is either text uploaded anywhere?

No. The comparison runs entirely in your browser using JavaScript. Neither text is sent over the network, logged, or stored.

Developers

JWT Decoder

Decode the header and payload of a JWT without the token ever leaving your browser.

Developers

.env Validator

Catch quoting, duplicate and syntax bugs in a .env file before they break your deploy.