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:
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:
- Open the Text Diff tool. It loads instantly and runs entirely in your browser.
- Paste the original text into the left panel (Text A — Original).
- Paste the modified text into the right panel (Text B — Modified).
- Click Compare. Added lines appear in green, removed lines in red, and unchanged lines in white, with line numbers on both sides.
- 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 / sign | Meaning |
|---|---|
| + Green | Line is present in Text B but not Text A (added) |
| − Red | Line is present in Text A but not Text B (removed) |
| White | Line 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:
- Ignore case — treats
ERRORanderroras the same line. Useful for comparing logs or case-insensitive config keys. - Ignore leading/trailing whitespace — trims spaces and tabs from the start and end of each line before comparing. Useful when only indentation changed between two environments.
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 case | Best tool |
|---|---|
| Code, config files, logs, Markdown, prose | Text Diff |
| API responses, JSON objects, structured data | JSON Diff |
| Two JSON files with reordered keys | JSON Diff (order-independent) |
| Two SQL queries or shell scripts | Text Diff |
Common use cases
- Config review — compare
nginx.confor a.envfile before and after a change before deploying. - Log analysis — paste two log snapshots and instantly spot lines that appeared or disappeared.
- AI-generated code — check what an AI snippet changed versus your existing code.
- Search-and-replace audit — confirm a bulk replace only touched the lines you intended.
- Document drafts — compare two versions of a README or spec to see what copy changed.
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.
Need to compare two blocks of text right now?
Open Text Diff →