Skip to content
QueenNexa

Free tool

Text Compare & Diff Checker

Compare two texts side by side or inline and see every added, removed and changed line or word. Options to ignore case and whitespace. Nothing is uploaded.

Runs entirely in your browser. Nothing you type or upload is sent to our servers.

How to compare two texts

  1. Paste the original into the left box and the new version into the right box, or open two files.
  2. The differences appear below as you type. Pick side by side, inline or word view.
  3. Use the options to ignore whitespace, case or blank lines when formatting noise hides the real changes.
  4. Copy the result as a unified diff if you want to share it as a patch.

Worked example

Compare these two versions. Original:

The quick brown fox
jumps over the lazy dog
and runs away

Changed:

The quick red fox
jumps over the lazy dog
and runs away fast

Line 1 and line 3 changed and line 2 is the same, so the result is 2 changed lines, 0 added, 0 removed and 1 unchanged, a similarity of 33.3%. Similarity is two times the unchanged lines divided by the total number of lines on both sides: 2 × 1 ÷ 6. The word view of line 1 marks only the words that differ, with [-removed-] and {+added+}:

The quick [-brown-]{+red+} fox

As a unified diff, the same comparison reads:

--- original.txt
+++ changed.txt
@@ -1,3 +1,3 @@
-The quick brown fox
+The quick red fox
 jumps over the lazy dog
-and runs away
+and runs away fast

Line diff, word diff and what each is for

  • Line diff is right for code, configuration, logs and lists, where each line is a unit and order matters.
  • Word diff is right for prose, where re-wrapping a paragraph would make every line look changed.
  • Ignore whitespace and case separates real edits from reformatting, such as a tab-to-spaces change or a heading changing from Title Case to sentence case.

Limits

Each side can hold up to 2,000,000 characters and 50,000 lines. Comparison runs in your browser, so very large inputs use your device's memory and processor. When two texts are almost entirely different, the tool stops searching for a line-by-line match and shows the changed section as one replaced block, and it tells you when that happens.

Comparing structured data? Run it through the JSON formatter first so both sides use the same indentation and key order. For markup, see the HTML viewer and formatter, and for prose, the word counter.

Frequently asked questions

Is my text uploaded when I compare it?

No. Both texts are compared by JavaScript running in your browser, and nothing is sent to our servers or stored. That makes it suitable for contracts, source code, configuration files and anything else you would not paste into a website that processes text remotely. You can disconnect from the internet after the page loads and it keeps working.

How does the comparison work?

It uses Myers' difference algorithm, the same family of method behind git diff. It finds the smallest set of lines to add or remove that turns the first text into the second, so unchanged lines stay aligned. Lines that were replaced are then compared word by word to highlight what changed inside them.

What does ignore whitespace do?

It treats runs of spaces and tabs as a single space and ignores spaces at the start and end of each line, so re-indenting or trailing spaces do not appear as changes. Differences in the words themselves still show. Turn it on when comparing code that was reformatted, or text pasted from different editors.

Can I compare two files?

Yes. Use the Open a file link above either box to load a text file such as .txt, .md, .csv, .json, .html or source code from your computer. The file is read by your browser and never uploaded. Binary files such as Word documents, PDFs and images are not supported; copy their text and paste it instead.

Why do line endings not count as differences?

Windows files end lines with two characters and Linux and macOS files with one, so identical text saved on different systems would otherwise differ on every line. The tool treats all three common line endings as the same and also ignores a single line break at the very end of the text.

How big a text can it compare?

Up to 2,000,000 characters and 50,000 lines on each side. Typical comparisons finish instantly because identical beginnings and endings are skipped and the algorithm only works on the part that differs. If two very large texts are almost completely different, the tool says so and shows the changed section as one block instead of freezing.

What is the difference between the three views?

Side by side puts the original on the left and the changed text on the right, with changed words highlighted. Inline shows one column with removed lines in red above added lines in green, like a pull request. Words ignores line breaks and marks individual words, which suits prose and documents.

Can I get the result as a patch?

Yes. The Copy as unified diff button puts standard diff output on your clipboard, with a few lines of context around each change and the usual @@ hunk headers. Tools such as git apply and patch understand this format, so you can share the difference as plain text.

Link to this tool

Found it useful? Copy a link for your page, newsletter or documentation.

Get new tools and guides by email

Optional. The tool above works without signing up.

One email every Tuesday. Free, and you can unsubscribe in one click.

More free tools

Browse all developer tools or the full list of free tools.