Skip to main content

Diff Checker — Compare Two Texts Online Free

Paste two versions of text and see every added, removed, and unchanged line highlighted line-by-line. Choose side-by-side or inline view, then copy or download the result as a unified diff. 100% free, runs in your browser.

Original Text

Modified Text

Differences will appear here after comparison...

Latency: Instant Comparison
Security: 100% Browser-Side

Features

Line-by-Line Comparison

LCS algorithm marks each line added, removed, or unchanged with real line numbers

Side-by-Side View

Original on the left, modified on the right, with colored change gutters

Live Change Stats

Counts added, removed, and unchanged lines plus a change percentage

Inline Unified View

All changes in one stream with classic + and - prefixes, like git diff

Copy & Download

Export to a .txt unified diff with --- / +++ headers in one click

Privacy First

Runs 100% in your browser. No uploads, nothing leaves your device

Free Online Diff Checker to Compare Two Texts

A diff checker compares two blocks of text and highlights every line that was added, removed, or left unchanged. Paste an original and a modified version, press Compare, and Toolk shows the differences in side-by-side or inline view, with live counts and a one-click unified-diff export. It is free and runs 100% in your browser.

How to compare two texts

  1. Paste the original version into the left Original Text box (or click Load Example to try a sample).
  2. Paste the new version into the right Modified Text box.
  3. Pick a View Mode: Side by Side for two columns, or Inline for a single unified stream.
  4. Press Compare. Removed lines turn red, added lines turn green, unchanged lines stay neutral.
  5. Read the stats bar for the count of + added, - removed, and unchanged lines.
  6. Click Copy or Download to export the result as a unified .txt diff.
  7. Use Swap to flip which side is original, or Clear to start over.

How the diff algorithm works

Toolk splits both inputs into lines, then computes their Longest Common Subsequence (LCS) with a classic dynamic-programming table. The LCS is the longest ordered set of lines the two versions share. Anything in the original but not in that subsequence is marked removed; anything in the modified version but not in it is marked added. This is the same line-matching idea Eugene Myers formalized in his 1986 paper "An O(ND) Difference Algorithm and Its Variations", which unified the shortest-edit-script and LCS problems that drive git diff.

The export follows the unified diff convention standardized in POSIX.1-2008 (The Open Group diff utility): a --- line for the original, a +++ line for the modified file, then each line prefixed by + (added), - (removed), or a space (context).

Side-by-side vs. inline view

Both modes use the same comparison; they only differ in layout. Pick the one that matches your task.

AspectSide-by-Side ViewInline (Unified) View
LayoutTwo parallel columnsSingle continuous stream
Change markerColored left gutter per column+ / - prefix per line
Line numbersOriginal and modified, separatelySequential change stream
Best forReviewing structure and reorderingPatch logs and code review

Worked examples

The built-in example compares a JavaScript function before and after a refactor. Here is roughly what the inline (unified) output looks like:

--- original
+++ modified
- function greet(name) {
-   console.log("Hello, " + name);
-   return true;
+ function greet(name, greeting = "Hello") {
+   console.log(greeting + ", " + name + "!");
+   return { success: true };
  }

  const user = "World";
- greet(user);
+ const result = greet(user, "Hi");

Config drift example. Compare two .env files and only the changed keys light up. Input A has PORT=3000; input B has PORT=8080. Because each whole line is matched, the diff reports the old line removed and the new line added, even though only four characters changed.

Failing edge case — trailing whitespace. The line name: api (with one trailing space) does not match name: api. The live comparison is exact, so a stray space or a tab-vs-spaces change shows the entire line as removed and re-added. If that is noise, strip whitespace first with Find and Replace.

Unified diff symbol reference

These are the line markers in the exported toolk-diff-result.txt file.

SymbolMeaningSource
---Header for the original fileOriginal
+++Header for the modified fileModified
+Line added in the modified versionModified only
-Line removed from the originalOriginal only
(space)Unchanged context line, in bothBoth

The memory limit most diff tools never mention

Toolk's comparison fills a full (m + 1) × (n + 1) dynamic-programming table, where m and n are the line counts of the two sides. That means both time and memory grow as O(m × n), not the near-linear O(ND) of git's optimized Myers implementation. The practical effect: two 50-line inputs build a ~2,600-cell table and finish instantly, but two 20,000-line files would allocate a ~400-million-cell table and can stall the browser tab. For very large files, diff in smaller sections or use a command-line tool. Most web diff checkers hide this; we state it so you know the real ceiling.

One more honest note: the export writes +/-/space line prefixes and ---/+++ headers, but it does not emit @@ -l,s +l,s @@ hunk headers. It is a readable change log, not a patch you can feed straight into git apply.

What people compare with it

Code review

Spot exactly which lines changed between two revisions before you commit. Pair it with the JSON Formatter to normalize payloads first so the diff is meaningful.

Config drift

Compare a working .env, .yaml, or nginx config against a broken one to find the changed key. For structured data, the dedicated JSON Diff compares by value.

Content edits

Track changes between two drafts of an article or contract. Run the Word Counter to confirm length targets after editing.

Runs 100% in your browser

Your data never leaves your device. No uploads, nothing leaves your browser. The entire comparison, the unified-diff formatting, and the file download all run in client-side JavaScript, so you can safely compare API keys, private configs, and unreleased code. We tested the side-by-side and inline views with the built-in JavaScript sample, multi-hundred-line config files, and CRLF-vs-LF inputs to confirm the line-matching and export behavior described above.

Last updated: June 2, 2026. Reviewed against the built-in JavaScript example, multi-hundred-line configs, and CRLF inputs.

Need a different tool?

Browse all 89 free, in-browser tools — or tell us what we should build next.

Browse all tools