CodeKitHub
Text Tools

Text Diff — Compare Two Texts Online

Last updated:

To compare two texts, paste each version into the boxes below and the tool highlights every added line in green and every removed line in red, unchanged lines shown as context — the same diff approach git and code review tools use. Everything stays in your browser.

What Is This Tool?

A diff (difference) tool compares two texts and shows the minimal set of changes that turns one into the other. It's how version control systems like Git display code changes, and it's equally useful for comparing configuration files, contracts, articles or any two versions of anything.

This tool diffs line by line using the same underlying algorithm family (longest common subsequence) as classic diff utilities, so the output reads like a familiar code review: + for added lines, − for removed lines.

Why Use It?

  • See what actually changed between two versions instead of eyeballing them.
  • Familiar git-style output: green additions, red deletions, context lines between.
  • Summary count of added and removed lines at a glance.
  • Works with any text — code, configs, documents, lists.
  • Private: both texts stay in your browser, nothing is uploaded.

How to Use

  1. Paste the original text in the left box.
  2. Paste the changed version in the right box.
  3. Click "Compare".
  4. Read the result: green lines were added, red lines were removed, plain lines are unchanged.

Example

Input

Original:
line one
line two
line three

Changed:
line one
line 2
line three

Output

  line one
− line two
+ line 2
  line three

The middle line was changed, which the diff shows as removing the old line and adding the new one.

Common use cases

  • Reviewing an AI-rewritten paragraph: paste the original and the AI's version to see exactly which sentences changed, instead of re-reading the whole thing to spot edits.
  • Comparing two contract drafts: legal redlines are often easier to scan as a line diff than as tracked changes when the document was reformatted between versions.
  • Checking a config file after a deploy: paste the before/after of a .env or YAML file to confirm only the intended lines changed.
  • Comparing translated text revisions: see which lines a translator or editor actually touched between drafts.

Limitations to know about

This is a line-level diff, not a word-level diff — if you move a paragraph from the top of a document to the bottom without changing its text, it shows as a full deletion plus a full addition, not a "moved" annotation. For paragraph-heavy prose where only a few words change per sentence, a word-level diff tool would highlight less text, but line-level is standard for code, configs and structured documents and is what this tool focuses on.

How the comparison algorithm works

The tool finds the longest common subsequence (LCS) between the two texts — the largest set of lines that appear in the same relative order in both versions, even if other lines were inserted or removed between them. Everything in that common subsequence is shown as unchanged context; everything else is classified as either removed (present only in the original) or added (present only in the new version). This is the same core algorithm behind the Unix diff utility and Git's line-by-line comparison, which is why the output format will look immediately familiar if you've ever reviewed a pull request.

One practical consequence: if a line is duplicated elsewhere in the document (the exact same text appears twice), the algorithm matches it to whichever occurrence keeps the overall diff smallest — occasionally producing a slightly different pairing than you'd intuitively expect, though the final added/removed line counts are always accurate regardless of which duplicate got matched to which.

Frequently Asked Questions

Does it compare word by word or line by line?

Line by line, like git diff. A changed line appears as one removal plus one addition. Line-level diffs are the standard for code and configs and stay readable for large texts.

Why does a tiny change show the whole line as changed?

Because the unit of comparison is the line — any change within it marks the whole line. Split long paragraphs into shorter lines if you need finer granularity.

Does whitespace matter?

Yes. Lines must match exactly, so a trailing space or different indentation makes lines count as different. This is intentional — whitespace differences are real differences in code and configs.

Is there a size limit?

No hard limit, but very large texts (tens of thousands of lines) may take a moment since the comparison runs locally on your device.

Are my texts uploaded for comparison?

No. The diff algorithm runs entirely in your browser with JavaScript. Both texts stay on your device — safe for contracts, internal docs and unreleased code.

Related Tools