# Text Diff

> Compare two texts or code snippets side by side, line by line, entirely in your browser. See added, removed and unchanged lines — no upload.

Canonical: https://host-tools.com/tools/text-diff/

---

## What is a text diff?

A text diff compares two versions of a text and shows exactly what changed between
them: which lines were added, which were removed and which stayed the same. It is the
same idea behind `git diff`, code review tools and "track changes" in editors.

## How line-by-line comparison works

This tool splits each input into lines and aligns them so unchanged lines stay
together. Added and removed lines are marked and counted. Everything happens locally
in your browser using a Myers diff algorithm — nothing is sent to a server.

## Side-by-side vs unified

- **Side-by-side** shows both texts in two columns, with matching lines aligned. It
  is the clearest way to read small or medium comparisons.
- **Unified** shows a single stream with `-` (removed), `+` (added) and context lines,
  plus a hunk header (`@@`). It matches the classic diff format and is easier to copy
  or share.

Use side-by-side to read a diff, and unified to copy or paste it into a patch, a
comment or a ticket.

## What added, removed and unchanged mean

- **Added** lines exist only in the *Modified* text.
- **Removed** lines exist only in the *Original* text.
- **Unchanged** lines are identical in both.

The counter above the result summarizes the changes at a glance.

## Comparing text, code and data

Text Diff compares by lines, so it works equally well for prose, source code,
configuration, JSON, YAML or logs. It does not interpret the content — the same
algorithm compares any text.

## Limitations of line diff

A line diff marks a whole line as changed when anything in it differs. To see what
changed *within* a single line, use an editor with word-level diff. This tool
intentionally keeps line-level comparison for simplicity and speed.

## Size limits

Inputs up to about 1 MB compare instantly. Above that, you will see a warning that
the comparison may take a moment. Inputs above 5 MB are too large to compare
responsively in a browser, so they are rejected with a clear message.

## Privacy

Your text stays in your browser. There is no upload, no storage and no account.

## Example

Load the example to compare two small JavaScript configs and see a typical
line-by-line diff.
