Back

Text Diff Checker

Compare two texts or files line by line and word by word. Ignore case or whitespace, step through each change and copy the result as a unified diff. Everything runs in your browser.

Or drop a file for the original here, up to 5 MB. It isn't uploaded.

Or drop a file for the changed text here, up to 5 MB. It isn't uploaded.

Differences

Paste or open two texts to see what changed.

The patch names the file a/text.txt and b/text.txt, so git apply and patch -p1 can use it.

How to use this tool

  1. Add the two texts

    Paste the older version into Original and the newer one into Changed. You can also open a file in either box or drop one on it. Swap flips the two sides if you put them in the wrong order.

  2. Choose what counts as a change

    Turn on Ignore case when capital letters don't matter, like for SQL keywords or email addresses. Turn on Ignore whitespace when a file was reindented or reformatted. Both compare cleaned up copies while the view keeps your original text.

  3. Read the differences

    Side by side puts the original on the left and the changed text on the right. Inline lists removed lines above added ones, which suits long paragraphs. Changed words are marked inside each line, and long unchanged stretches fold away.

  4. Step through each change

    Use the next and previous buttons to jump from one change to the next. The counter shows which change you're on, so you can review a long file without missing an edit.

  5. Copy the unified diff

    Set the file name the patch should use, then click Copy as unified diff or download it as a .patch file. It uses the a/ and b/ names that `git apply` and `patch -p1` expect.

About this tool

The Text Diff Checker shows what changed between two versions of a text. Paste a config file, a contract, a list or a query on each side and it marks every removed and added line, plus the exact words that changed inside them.

It's built for the moment you have two copies and need to know the difference: a config that works on one server and not the other, a draft that came back with edits, or a log from a run that failed. When you're done, copy the changes as a unified diff and apply them with git or patch.

The texts never leave your browser. They aren't uploaded, and they stay out of the page URL, so it's safe to compare files with passwords or private data in them.

How the comparison works

The tool compares lines first, using the Myers diff algorithm that git also uses. That gives the smallest set of removed and added lines that turns the original into the changed text. Inside each block of changed lines it runs the same algorithm on words, so a renamed variable or a new date stands out from the rest of the line.

A change is one run of removed or added lines with unchanged lines on both sides. The next and previous buttons stop at each one.

What counts as a change

  • Every character counts by default, including spaces and capital letters.
  • Ignore case treats upper and lower case letters as equal.
  • Ignore whitespace removes all spaces and tabs before comparing, like git diff -w. A line that was only reindented then counts as unchanged.
  • Line endings never count, so a Windows copy of a file matches the Unix one.

The switches change what's compared, never what's shown. You always see the text you pasted.

The unified diff

Copy as unified diff gives the format that diff -u, git diff, git apply and patch use. Each section starts with an @@ line that says where it sits in each file. Up to three unchanged lines of context come before and after the edit, removed lines start with a minus sign and added lines start with a plus sign. With an ignore switch on, the patch leaves those ignored changes out, the same as diff -w -u would.

When to use something else

A text diff compares lines, so it sees reordered JSON keys or a reformatted file as changes. To compare two JSON documents by their data, use the compare mode of the JSON Formatter. To check how long a text is after an edit, the Character Counter counts characters, words and lines.

Text comparison guides

Worked examples for configs, documents, lists, logs and patches.

Frequently asked questions

How do I compare two texts?
Paste the older version into Original and the newer one into Changed, or open a file in each box. The differences show up right away, with a minus sign on each removed line and a plus sign on each added one. Inside a changed line, the words that changed are marked, so a one word edit in a long paragraph is easy to spot.
Is my text sent to a server?
No. The comparison runs in your browser, and big texts go to a background worker on the same page, not to a server. The texts also stay out of the page URL, so they don't end up in your browser history or in a link you share. Only the settings, like Ignore case or the layout, go in the URL.
What do Ignore case and Ignore whitespace do?
They change what counts as a difference, not what you see. Ignore case treats "Port" and "port" as equal. Ignore whitespace removes every space and tab before lines are compared, like git diff -w, so a reindented line matches the original. The view still shows both texts exactly as you pasted them.
How do I apply the copied diff with git or patch?
Save the copied text as a file, like change.patch. In the folder the patch should change, run git apply --check change.patch to test it, then git apply change.patch to apply it. Without git, patch -p1 < change.patch does the same. Set File name in the patch to the file's path from that folder, like src/config.ts, so both tools find the right file.
Why does a whole line show as changed when I edited one word?
A diff works in lines, so any edit makes the whole line a change. The tool then compares the words inside each changed line and marks only the ones that differ. When most of a line was rewritten, word marks would cover nearly everything, so the line shows as a plain removal and addition instead.
Do Windows and Unix line endings count as changes?
No. A file saved with CRLF (Windows) line endings matches the same file with LF (Unix) endings, and a note under the result says the endings differ. A missing line break at the very end of a file does count. The view marks it with "No line break at the end", and the patch adds the standard "\ No newline at end of file" line.
How big can the texts be?
Up to 5 MB per side. Large texts are compared in a background worker, so typing stays smooth, and every edit cancels the comparison that was running. If you open a file over the limit, the tool says so before it reads the file. Long stretches of unchanged lines fold away, and you can open each fold when you need the context.
Which diff algorithm does the tool use?
Eugene Myers' O(ND) algorithm, the same one git uses by default. It finds the fewest lines to remove and add so the original becomes the changed text, then runs again on the words inside each change. For two very different large files, it stops searching early and may show a slightly longer diff than the minimum, which keeps it fast. Git makes the same trade unless you pass --minimal.

Use this tool on your own site

Drop the Text Diff Checker into your blog, docs, or CMS with one iframe snippet. Free, no signup. See all embeddable tools