Text Diff
Paste two text versions and get a color-coded line-level diff showing every addition and deletion, processed entirely in the browser.
What it does
- Line-level diff with additions and deletions highlighted
- Word-level highlight inside modified lines
- Counters: identical, added, removed, changed
- Unified diff output ready to copy
- No file upload, no server storage
no
Identical
0
Added
0
Removed
0
Changed
Paste the original version of a text in the left box, the modified version in the right box, and click Compare. The tool shows every line that was added, removed or kept, highlights the exact words that changed inside modified lines, and gives you a standard unified diff to copy into a ticket, a code review or an email. The comparison is computed by similar, a Rust diffing library, compiled to WebAssembly, so both versions stay in your browser.
How to compare two texts
- Paste the earlier version into Original.
- Paste the newer version into Modified.
- Click Compare.
- Read the summary counters, then the color-coded diff below them.
- Click Copy Unified Diff to copy the result in the format used by
git diffand patch tools.
How to read the result
- Identical: "yes" only when both texts match exactly, character for character, including spaces and line endings.
- Added: the number of lines present only in the modified text, shown in green with a
+. - Removed: the number of lines present only in the original, shown in red with a
-. - Changed: the number of lines that were edited rather than added or deleted. For these, a removed line is directly followed by its replacement, and the words that differ are highlighted inside both.
- Hunks: changes are grouped into blocks headed by
@@ -12 +14 @@, giving the starting line in the original and in the modified text. Each block shows up to three unchanged lines of context around the changes, and long unchanged stretches are skipped.
The unified diff format
The copied output starts with --- original and +++ modified, followed by hunks such as @@ -1,3 +1,4 @@, where the numbers give the start line and line count on each side. Lines starting with a space are context, - lines were removed and + lines were added. It is the same format as diff -u and git diff, so developers can read it at a glance and most code review tools display it with colors.
What the comparison is sensitive to
- Lines first: the diff works line by line. If a paragraph is one long line, a single comma change marks the whole line as changed, then the word-level highlight shows which words moved.
- Whitespace counts: a trailing space, a tab instead of spaces, or a different indentation makes lines different. There is no "ignore whitespace" option.
- Case counts: "Total" and "total" are different.
- Reordered lines appear as a removal at one place and an addition at another, since the algorithm looks for the longest common sequence of lines.
- Plain text only: paste the text content. To compare Word or PDF documents, copy their text out first; formatting changes (bold, fonts) are not visible to a text diff.
Typical uses
- Reviewing a configuration change before deploying it, for example two versions of an
nginx.confor a.envfile. - Checking what a colleague or a client changed in a contract clause, a press release or a translation.
- Comparing two API responses or log extracts to spot the field that differs. Format both JSON payloads first with the JSON formatter so the diff lines up key by key.
- Producing a readable patch to paste into an issue or a chat when the files are not in a Git repository.
Compared with Git, diff and word processors
When the files live in a repository, git diff remains the natural tool, and diff -u file1 file2 works on any Unix system. Word processors offer "Compare documents" with tracked changes for formatted files. This page covers the quick case: two pieces of text in your clipboard, no repository, no files to save, and no wish to paste confidential content into an online service that stores it.
Privacy: two versions of a sensitive text
The texts people compare are rarely public: contract revisions, configuration files containing credentials, HR documents, unreleased code. Many online diff checkers send both versions to a server, and some even generate shareable links that store them. Here the comparison runs in WebAssembly inside your browser, no request carries the text, and nothing is kept after you close the tab.
Frequently asked questions
- Are the texts I compare uploaded?
- No. Both versions are compared locally in your browser. Nothing is sent, logged or stored.
- Can I ignore whitespace or case differences?
- No, the comparison is exact. Normalize the texts before pasting them (for example trim trailing spaces) if those differences are not relevant.
- Why is a whole paragraph marked as changed when I edited one word?
- The diff works line by line, and a paragraph without line breaks is a single line. Look at the highlighted words inside the line to see the exact change.
- What does "Changed" count?
- Lines that were edited in place: a removed line immediately followed by its new version, with differing words highlighted. Pure additions and deletions are counted separately.
- Can I apply the copied diff as a patch?
- The output uses the standard unified format with
originalandmodifiedas file names. To apply it withpatchorgit apply, edit those header names to match your real file paths. - Can I compare files directly?
- The tool compares pasted text. Open each file in a text editor and paste its content. To check whether two files are byte-identical without reading them, compare their SHA-256 checksums with the file checksum calculator.
Related tools: search for patterns across a text with the regex tester.