Text Diff

Compare two blocks of text

Examples

A changed word

Input
The quick brown fox
jumps over the lazy dog
Output
- jumps over the lazy dog
+ leaps over the lazy dog

An added line

Input
line one
line two
Output
+ line three

What is Text Diff?

Text Diff is a free, browser-based tool that compares two blocks of text and highlights exactly what changed between them. You paste one version on the left and another on the right, and the tool lines them up and marks every line that was added, removed or left unchanged.

Under the hood, a diff works by finding the longest sequence of lines the two texts share, then treating everything else as an insertion or a deletion. Instead of forcing you to read both versions in full and hold the differences in your head, the result shows you a colour-coded map: green (or one accent) for lines that appear only in the new text, red (or another accent) for lines that were dropped, and neutral for lines that match. That turns a slow, error-prone eyeball comparison into something you can scan in seconds.

It works on anything that is line-oriented text: prose, code, config files, logs, CSV rows, emails, contracts and more. If you can paste it, you can diff it.

Why use an online text diff?

Spotting changes by reading two versions side by side is deceptively hard. Your eye skips over single-word edits, transposed lines and trailing whitespace, and the longer the text, the more you miss. A diff removes the guesswork by computing the changes for you.

The usual concern with web-based tools is privacy: many diff sites send both blocks of text to a server to do the comparison. That is a real problem when the text is a private contract, an internal document, unreleased copy or source code. Dev Nexus is different - the entire comparison runs locally in your browser using JavaScript. Neither block of text is uploaded, logged or stored, so you can safely diff confidential material. It also keeps working offline once the page has loaded.

Compared with installing a desktop diff tool or running diff on the command line, an online diff is instant and needs no setup. You get a live, highlighted result the moment you paste, on any machine with a browser.

How to compare two blocks of text

Using the tool is straightforward:

  1. Paste the original version into the left panel and the changed version into the right.
  2. The comparison updates as you type, aligning matching lines and highlighting the rest.
  3. Toggle ignore case if capitalisation changes are noise you do not care about.
  4. Toggle ignore whitespace to hide differences that come purely from spaces, tabs or trailing blanks.

Reading the result is a matter of following the highlights. A line shown only on the new side was added; a line shown only on the old side was removed; a line that changed appears as one removal plus one addition, so you see both the old and new wording. Lines with no highlight are identical in both versions and can be safely ignored.

Common use cases

A text diff earns its place in a lot of everyday workflows:

  • Document revisions: compare two drafts of an article, contract or policy to see exactly which sentences an editor changed.
  • Code review: check what changed between two snippets or config files when a full version-control diff is not handy.
  • Copy and content edits: confirm that a marketing or legal edit only touched the lines it was supposed to.
  • Log and output comparison: diff the output of a program before and after a change to catch unexpected differences.
  • Data checks: line up two lists, CSV exports or exports from different tools to find rows that were added or dropped.
  • Translation and localisation: compare an updated source string against the version a translator worked from.

When the two things you are comparing are structured data rather than free text, a specialised comparison reads better - use JSON Compare for JSON so re-ordered keys are not flagged as changes.

Tips & best practices

A few habits make diffs easier to read and trust:

  • Normalise line endings. Text copied from different systems can mix Windows (\r\n) and Unix (\n) line endings, which can make otherwise identical lines look different. Paste clean text where you can.
  • Use ignore-whitespace for formatting-only edits. If someone reflowed a paragraph or changed indentation, turning on ignore-whitespace strips that noise so only real wording changes remain.
  • Diff in smaller chunks. If two long documents produce more changes than you can scan, compare one section at a time to isolate what actually moved.
  • Remember a diff is line-based. A change anywhere on a line marks the whole line as changed. For very long lines, splitting sentences onto their own lines makes the diff more precise.
  • Reach for the right tool. A text diff shows you what is different; if you then need to apply the same edit across a file, a find and replace tool is the better follow-up.

Frequently asked questions

Is my text uploaded to a server?

No. The entire comparison runs locally in your browser using JavaScript. Neither block of text is uploaded, logged or stored, so it is safe for private documents, contracts and source code, and it works offline once the page has loaded.

Does it compare line by line or word by word?

The diff is line-based: it aligns matching lines and highlights whole lines as added, removed or unchanged. A change anywhere on a line marks that line as changed, so putting sentences on their own lines gives you a more precise comparison.

Can I ignore case or whitespace differences?

Yes. Turn on ignore-case to treat capitalisation as identical, and ignore-whitespace to hide differences caused purely by spaces, tabs or trailing blanks. Both options help strip out formatting noise so you only see meaningful edits.

How do I read the highlighted result?

Lines shown only on the new side were added, and lines shown only on the old side were removed. A changed line appears as a removal plus an addition so you see the old and new wording. Unhighlighted lines are identical in both versions.

Is there a size limit on the text I can compare?

There is no fixed limit; the practical ceiling is your device's memory and browser performance. Very large inputs may slow down live highlighting, in which case comparing smaller sections at a time is faster and easier to read.

Can I compare code or config files, not just prose?

Yes. Anything line-oriented works - source code, config files, logs, CSV rows and more. For structured data like JSON, a dedicated JSON comparison is better because it ignores meaningless differences such as key order.

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

Because the comparison is line-based, any edit on a line makes the entire line count as different, shown as the old line removed and the new line added. This is normal for line diffs; splitting long lines makes the highlighting more granular.

Related guides

Related tools