Skip to content

Text compare (diff checker)

Compare two texts, JSON files, PDFs or Word documents and see what changed, side by side. JSON is compared by meaning, so key order doesn't count. No upload.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
Compare as
Text, code, PDF or Word files.

Paste or open two texts to see what changed. Nothing you add leaves this page.

How it works

The page splits both texts into lines and finds the most lines they share in the same order, with the Myers diff algorithm that git and GNU diff also use. Lines found only in the original are shown as removed and lines found only in the changed text as added. Inside lines that changed, the same comparison runs again on words, or on single characters if you choose, to mark exactly what is different.

Order matters here, because a diff compares versions of one text. To compare two lists of emails, names or IDs whatever their order, and see what is only in one, only in the other and in both, use Compare two lists.

Side by side puts each changed line next to its new version; inline lists removed lines above the lines that replaced them, which fits a phone better. Long stretches of unchanged lines are folded away, keeping three lines around each change, and open with a tap. “Copy as unified diff” gives the changes in the format of diff -u and git, which patch can apply.

In JSON mode both documents are read with the strict parser of the JSON formatter and compared value by value. Objects are matched key by key, whatever their order; lists are matched item by item in order, pairing equal items first, so one item put in or taken out shows as one difference, not a change to every item after it. Strings count as the same however they are escaped, and numbers by their exact value, digits JavaScript would round included. Below the list, both documents are written out the same way, keys sorted A to Z, and compared line by line.

PDFs are read with pdf.js and Word documents straight from the file, both on this page. A PDF's lines are joined into paragraphs first, because two PDFs of the same text often break their lines in different places. A Word document gives its body, text boxes, footnotes and endnotes, without headers, footers, comments or deleted tracked changes.

Ignoring whitespace treats a run of spaces and tabs as one space and ignores spaces at the start and end of lines; ignoring case makes “Hello” and “hello” the same. Windows line breaks (CR LF) and Mac or Linux ones (LF) always count as the same.

The comparison runs in a background worker inside this tab, so long files don't freeze the page. Neither text is saved or added to the page address, and spell checking is off in both boxes so the browser doesn't send what you paste off for checking.

Questions

How do I compare two texts for differences?

Paste the original text on the left and the changed version on the right, or open a file on each side. The differences show as you type: removed lines in red with a minus sign, added lines in green with a plus sign, and the words that changed inside a line marked more strongly. Ignore whitespace and Ignore case leave out re-indented lines, trailing spaces and capital letters.

How do I compare two JSON files?

Choose JSON at the top, then paste or open the two JSON documents. They are compared by the data they hold, so key order, spacing, line breaks and the way numbers are written (1.0 or 1) don't count. Each difference is listed by its path, like $.items[2].price: 10 → 12, and both documents are shown side by side, formatted the same way with keys sorted. If either one isn't valid JSON, the page says which and where.

Can I compare two PDF or Word documents?

Yes. Open a PDF or a Word document (.docx) on each side and their text is compared, paragraph by paragraph, with the changed words marked. Layout, fonts and pictures aren't compared. A scanned PDF has no text to compare, and a PDF whose author turned off copying isn't read. Older Word files (.doc) need saving as .docx first.

Is it safe to compare confidential documents or JSON here?

Only on a page that doesn't upload them. This one compares everything in your browser: neither side is sent to a server, saved, or put in the page address, and there is no share link that could leak. Closing or reloading the page clears both, so contracts, API responses with tokens and drafts stay on your device.

Limits

Each side can hold up to 5,000,000 characters and 200,000 lines. When two long texts are very different, the search for the fewest changes takes a shortcut once it gets costly, as GNU diff does, so the result can then list a few more changes than strictly needed.

Text that moved shows as removed in one place and added in another. Lines that share less than a third of their text are shown as wholly changed, without word marks, and a changed block of more than 200,000 words is marked by line only.

JSON must be strict: comments, trailing commas and single quotes are errors, and JSON Lines (one document a line) isn't read. A key that appears twice in one object is compared by its last value, as most programs read it. Lists are compared in order, so the same items in another order show as changes. Up to 10,000 differences are listed; more are counted.

Text files are read as UTF-8, or in your language's older encoding when they aren't valid UTF-8. Word documents can be up to 50 MB and PDFs up to 100 MB. Scanned PDFs (pictures of pages), PDFs locked with a password or with copying turned off, older Word files (.doc), images and other binary files can't be compared. Page numbers, headers and footers printed on PDF pages are part of their text, so they are compared too.

Privacy

This tool runs entirely in your browser. The files you open and what you type are never sent to a server, and nothing is stored after you close the page. See the privacy page.

Related tools