How to Compare Two Text Files Online (Free Diff Checker Guide)

To compare two text files online, paste the original into one panel and the modified version into another, then run a diff — the tool highlights every line that was added, removed, or left unchanged. This guide shows the fastest way to do it for free, how diff tools actually decide what changed, and how to hide differences you don't care about.

Compare two texts right now — free, private, in your browser:

Open Text Diff → JSON Diff →

What is a text diff?

A text diff (short for "difference") is a side-by-side comparison of two blocks of text that highlights exactly what changed between them. It splits each input into lines, lines them up, and marks each line as added, removed, or unchanged — the same view you see in a code review or when you run git diff. It answers one question instantly: what is different between these two versions?

How to compare two text files online (step by step)

Using a browser-based diff checker takes about ten seconds and requires no account:

  1. Open the Text Diff tool. It loads instantly and runs entirely in your browser.
  2. Paste the original text into the left panel (Text A — Original).
  3. Paste the modified text into the right panel (Text B — Modified).
  4. Click Compare. Added lines appear in green, removed lines in red, and unchanged lines in white, with line numbers on both sides.
  5. Refine if needed using the Ignore case or Ignore whitespace toggles, then read the result or click Copy diff.

How does a diff tool decide what changed?

Under the hood, most diff tools (including git) use a longest-common-subsequence (LCS) algorithm. It finds the longest run of lines that appears in both texts in the same order and marks those as unchanged. Everything left over is reported as either removed (only in the original) or added (only in the modified version). This produces the minimum, most readable set of changes — instead of flagging the whole file as different the moment one line shifts.

Example

Comparing these two short configs:

Text A (original)        Text B (modified)
------------------       ------------------
host = localhost         host = localhost
port = 5432              port = 5432
timeout = 30             timeout = 60
                         retries = 3

A line-based diff reports: host and port unchanged, timeout = 30 removed and timeout = 60 added (a changed line shows as one removal + one addition), and retries = 3 added.

Reading the output: added, removed, unchanged

Colour / signMeaning
+ GreenLine is present in Text B but not Text A (added)
− RedLine is present in Text A but not Text B (removed)
WhiteLine is identical in both (unchanged)

A modified line shows as a red removal plus a green addition — line-based diffs don't track "edits," only added and removed lines. The line numbers on each side let you jump straight to the change in your editor.

How to ignore whitespace and capitalization

Sometimes the differences that show up aren't the ones you care about — an extra space, a tab-vs-space change, or a capitalization tweak. Two toggles handle this:

Text Diff vs JSON Diff — which should you use?

If you're comparing structured data rather than plain text, a line-based diff can mislead you. Reformatting JSON or reordering its keys changes the text without changing the data — and a text diff will flag all of it. Here's when to use each:

Use caseBest tool
Code, config files, logs, Markdown, proseText Diff
API responses, JSON objects, structured dataJSON Diff
Two JSON files with reordered keysJSON Diff (order-independent)
Two SQL queries or shell scriptsText Diff

Common use cases

Frequently Asked Questions

How do I compare two text files online for free?

Paste both versions into a browser-based diff tool like the Text Diff tool, then click Compare. It splits each text into lines and highlights added lines in green, removed lines in red, and unchanged lines in white. It is free, requires no signup, and runs entirely in your browser so your text is never uploaded.

Is it safe to compare confidential text in an online diff tool?

It depends on the tool. Many online diff checkers send your text to a server. The Text Diff tool does all comparison locally in your browser with JavaScript, so your text never leaves your device — which is safe for confidential code, configs, and logs.

What is the difference between a text diff and a JSON diff?

A text diff compares any plain text line by line and treats the input as characters. A JSON diff parses both inputs as JSON and compares them key by key, so reordered keys do not show as false differences. Use JSON Diff for API responses and structured data, and Text Diff for code, configs, logs, and prose.

Can I ignore whitespace or capitalization when comparing text?

Yes. The Text Diff tool has an Ignore case toggle that treats Hello and hello as equal, and an Ignore leading/trailing whitespace toggle that trims spaces from each line before comparing. These hide differences that do not matter, like indentation changes.

How does a diff tool decide what changed?

Most diff tools use a longest-common-subsequence (LCS) algorithm — the same approach behind git diff. It finds the longest sequence of lines that appears in both texts in the same order, marks those as unchanged, and reports the remaining lines as added or removed.

Is there a limit on how much text I can compare?

There is no hard limit in the Text Diff tool, but because the comparison runs in your browser, very large inputs (tens of thousands of lines) may take a moment. For typical files, configs, and snippets the result is instant.

Compare two texts now — free and private

Paste two versions, click Compare, and see every added and removed line. Nothing is uploaded — it all runs in your browser.

Open Text Diff JSON Diff JSON Formatter

Need to compare two blocks of text right now?

Open Text Diff →
About the author

Pasindu Ishan is a software developer based in Sri Lanka. He builds developer tools at JSON Dev Tools.