Compare Text & Code Online

Paste or upload two texts to compare them line by line

Original Text

1
Lines: 0 Characters: 0

Changed Text

1
Lines: 0 Characters: 0
+0 added −0 removed 0 unchanged
Quick answer

Paste your original text in the left panel and your changed text in the right panel, then click Find Differences. Additions are highlighted in green, removals in red, with line numbers throughout. Toggle between Unified and Side-by-Side views. You can also upload files directly. Nothing is ever sent to a server - all comparison runs in your browser.

How to use this tool

Paste your original (older) text in the left editor and the revised (newer) text in the right editor. Click "Find Differences." The diff output appears below with every change clearly marked. To upload a file instead of pasting, use the upload icon at the top of each panel - it accepts .txt, .js, .py, .html, .css, .json, .xml, .md, .sql, .yaml, and dozens of other text-based formats.

The Swap button exchanges the contents of both panels. The Sample button loads a short example if you want to see how the output looks before pasting your own text. The Copy Diff button copies the full diff result to your clipboard.

What is a diff checker?

A diff checker compares two versions of text and shows exactly what changed between them. The name comes from the Unix diff command, first written in 1974, which compared two files line by line and output the differences. Today the term is used broadly for any tool that identifies additions, removals, and unchanged content between two text inputs.

Diff checkers are used by developers to review code changes, by writers to compare document drafts, by lawyers to spot contract redlines, and by system administrators to track config file changes. The core function is always the same: show precisely what is in one version but not the other, without having to read both texts manually.

What does "diff" mean?

Diff is short for difference. In computing it refers specifically to the output of a comparison operation - a structured list of changes between two versions of a file or text. When a developer says "I'll send you the diff," they mean the exact list of lines added and removed, not the full files.

Reading the diff output

Once you click Find Differences, the output panel shows every line from both texts classified into one of three states:

  • Green lines (additions): Lines that exist in the changed (right) text but not in the original (left). These were added.
  • Red lines (removals): Lines that exist in the original (left) text but not in the changed (right). These were deleted.
  • Unchanged lines: Lines that are identical in both texts. Shown without colour to keep the focus on what changed.

Unified vs side-by-side view

The tool offers two ways to display the same diff.

Unified view

All changes appear in a single column. Removed lines (red) are followed immediately by added lines (green). This is the format used by Git, GitHub pull requests, and most version control systems. Compact and works well when changes are scattered throughout a long file.

Side-by-side view

Both texts are displayed in parallel columns - original on the left, changed on the right - with corresponding lines aligned next to each other. Easier to read when comparing prose documents or when you want to read the full context of each version.

FeatureUnified viewSide-by-side view
LayoutSingle columnTwo columns
Best forCode, long files, scattered changesProse, short files, dense changes
Used byGit, GitHub, terminal diff toolsWord Track Changes, graphical diff tools

Use cases

Code review

Compare your working copy against the original to catch bugs, unintended changes, or missing lines before merging. Works with any language - JavaScript, TypeScript, Python, HTML, CSS, SQL, Go, Java, PHP, and more. For language-specific tools see Compare Code.

Document and essay proofreading

Compare a draft against a revised version to see exactly what was added, deleted, or reworded - without reading both documents in full. For Word documents use the Compare Documents tool.

Legal and contract review

A single changed word in a contract can alter its meaning significantly. Pasting two versions of a contract into a diff checker immediately surfaces every change - including additions and removals that are easy to miss in a manual read-through.

Config file and infrastructure changes

Paste two versions of a configuration file (nginx, Docker Compose, Kubernetes YAML, .env) to see every line that changed between environments or deployments.

How the diff algorithm works

This tool uses a Longest Common Subsequence (LCS) algorithm. Both texts are split into lines. The algorithm builds a matrix that tracks the longest sequence of lines appearing in both texts in the same order. Lines in the LCS are unchanged; lines outside it are added or removed. This is the same principle used by the Unix diff command and Git.

Privacy

All diff processing runs entirely in your browser using JavaScript. Your text is never sent to any server, never logged, never stored, and never shared with any third party. The moment you close the tab, the text is gone. Open your browser's network panel (F12 → Network tab), paste text and click Find Differences, and confirm that no network requests are made when the diff runs.

Common mistakes

Pasting in the wrong order

The left panel is "Original" and the right panel is "Changed." If you paste the newer version on the left, the colours will be reversed. Use the Swap button to fix it without repasting.

Trailing whitespace and line endings

A line that looks identical may differ only in trailing spaces or line endings (Windows CRLF vs Unix LF). This causes the diff to show lines as changed when the visible content is the same. Use plain-text paste (Ctrl+Shift+V) to strip formatting.

FAQs

What is a diff checker?

A diff checker compares two versions of text and highlights exactly what changed. Additions appear in green, removals in red. It uses a diff algorithm to identify which lines were added, removed, or unchanged.

Is my text private?

Yes. All processing happens in your browser. Nothing is sent to any server at any point.

Can I compare code files?

Yes. The tool handles any text-based file. Upload .js, .ts, .py, .html, .css, .json, .xml, .md, .sql, .yaml, .go, .java, .php, and more. For language-specific tools see Compare Code.

Can I compare Excel or CSV files?

Yes, with the dedicated Excel and CSV comparison tool. It compares spreadsheets cell by cell and finds changed values, added rows, and removed rows.

How is this different from Git diff?

Git diff compares tracked file versions within a repository. This tool compares any two texts you paste or upload, with no repository setup required. The underlying algorithm (LCS) is similar.