Submit an extension

↑↓ move · ↵ open · Tab filter · Esc close

Free tool · Developer utilities

Diff Checker: Compare Two Texts or Files

Paste or drop two versions and see every added, removed and changed line, with the exact words highlighted. Nothing is uploaded.

  • Free, no sign-up
  • Runs in your browser
  • Works on mobile
Empty
Empty
Comparison options

Paste text into both boxes. The diff updates as you type.

Differences appear here. Removed lines are red and marked with a minus on the original side; added lines are green and marked with a plus on the changed side. Changed words inside a line get a stronger highlight. Unchanged stretches are folded so you can see every change at once.

This diff checker compares two texts line by line and highlights what changed: removed lines in red, added lines in green, and the exact changed words inside each edited line. Paste text or open files, pick side-by-side or inline view, ignore whitespace or case if needed, then copy the result as a unified diff.

Last checked · Independent, not affiliated with Google

Your data The comparison runs entirely in your browser with JavaScript. Text you paste and files you open are read locally and never sent to our server or anyone else. We save only your option choices (view, context lines, ignore settings) in this browser's local storage, never the text itself.

How to use the Diff Checker

  1. Add the two versions

    Paste the original on the left and the changed version on the right. You can also press Open file or drag a file onto either box.

  2. Read the diff

    The result updates as you type. Red lines were removed, green lines were added, and stronger highlights mark the changed words.

  3. Tune the comparison

    Ignore whitespace, case or blank lines, switch to JSON mode for API responses, or choose character-level highlights for small edits.

  4. Jump between changes

    Use Next change and Previous change (or the n and p keys) and expand any folded unchanged section you need to see.

  5. Copy or save the patch

    Press Copy unified diff or Download .diff to get a standard patch you can paste into a review or apply with git apply.

What is a diff checker?

A diff checker is a tool that compares two versions of a text and lists the differences between them. "Diff" is short for difference, and it's also the name of the Unix diff program from the 1970s that made the idea standard.

You give it an original and a changed version. It works out the smallest set of lines to delete and insert to turn one into the other, then shows those edits. Everything else is marked unchanged. People use a diff text checker to review contract edits, spot what a colleague changed in a config file, check two API responses, or confirm that a copy-pasted block really matches the source.

  • Text compare: two drafts of an email, an essay or terms of service.
  • Code: two versions of a function, a stylesheet or a SQL query.
  • Data: JSON, CSV, XML or YAML exports that should match but don't.
  • Lists: two lists of emails, URLs or product IDs, to see what was added or dropped.

How to compare text online with this diff checker

Paste both versions and read the colours. The other controls cut noise out of the result.

  1. Put the older version in Original text and the newer one in Changed text. Order matters: lines only in the original show as removed.
  2. Look at the counters above the result: added, removed and changed lines. A changed line is a removed line paired with an added one in the same spot.
  3. Choose Side by side to read both versions in parallel, or Inline for a single column in the style of git diff. On a phone, side by side stacks each original line above its replacement so nothing scrolls sideways.
  4. Long unchanged stretches fold into a single bar. Set how many unchanged lines stay visible around each change, or pick Show everything.
  5. Use Swap sides if you pasted them the wrong way round.

How does a diff checker find the changes?

It looks for the longest run of lines the two versions share, in order, and treats everything else as edits. That shared run is called the longest common subsequence. Finding it quickly is the hard part.

This online diff checker uses Myers' O(ND) algorithm, published by Eugene Myers in 1986 and still the default in git diff and GNU diff. Its running time grows with the size of the input times the number of differences, so two long files with a few edits compare almost instantly. We use the linear-memory version, which splits the problem at a midpoint and solves each half, so a 10,000-line file doesn't need a huge table in memory.

How to read the result: a changed line appears in both columns with the edited words highlighted, a removed line has an empty slot on the right, and an added line has an empty slot on the left.

Word and character highlights

After the line diff, each removed line is paired with the added line in the same position. The tool then runs the same algorithm again on the words (or single characters) of that pair, so you see that only debug became info instead of re-reading the whole line. If two paired lines share less than about a third of their text, the whole line is highlighted instead, because scattered one-letter matches are harder to read than a plain replacement.

Ignore whitespace, case or blank lines: which option to use

Turn an option on when a kind of difference doesn't matter to you and is burying the ones that do. Each option only changes how lines are matched; the text shown is always your original text.

Comparison options and their Git equivalents
OptionWhat it ignoresUse it whenGit flag
Ignore all whitespaceEvery space, tab and indent differenceCode was re-indented or reformatted-w
Ignore trailing whitespaceSpaces and tabs at the end of linesAn editor stripped or added trailing spaces--ignore-space-at-eol
Ignore caseUpper vs lower caseComparing lists of emails, headings or SQL keywordsnone (GNU diff -i)
Ignore blank linesAdded or removed empty linesParagraph spacing changed in prose or code--ignore-blank-lines
JSON modeFormatting and (optionally) key orderComparing API responses or config filesnone

Windows (CRLF) and Unix (LF) line endings are always treated as the same, so a file saved on another system doesn't light up every line. A missing newline at the very end of a file does count, because tools like Git treat it as a real change; the result tells you when that is the only difference.

Using it as a JSON, XML, CSV or HTML diff checker

Structured data needs one extra step before a line diff is useful: both sides must be laid out the same way. For JSON the tool does that for you; for other formats, format both sides first.

JSON diff checker
Tick JSON mode. Both sides are parsed and re-printed with two-space indentation, so minified and pretty-printed JSON compare cleanly. Tick Sort JSON keys too, because JSON objects are unordered (RFC 8259) and {"a":1,"b":2} equals {"b":2,"a":1}. Invalid JSON gets an error with its line and column. To tidy a single document, use the JSON formatter.
XML diff checker
Pretty-print both files with the same indentation first, then turn on Ignore trailing whitespace. Attribute order still counts as a change, so sort attributes if your data allows it.
CSV diff checker
Each row is a line, so added and removed rows show directly and a changed cell is highlighted inside its row. Sort both files by the same key column first, or a reordered export will look like every row changed.
HTML diff checker
Works like any code diff. Minified HTML is one giant line, so format it before comparing; character highlights help find a single changed attribute.

Diff code checker: reading a unified diff and git diff output

A unified diff is the plain-text patch format that git diff, GitHub and code review tools use. Press Copy unified diff and you get exactly this format, so the tool doubles as a git diff checker for snippets you don't have in a repository.

--- config.old.yml
+++ config.yml
@@ -1,5 +1,5 @@
 # App settings
 name: my-app
-version: 1.4.0
+version: 1.5.0
 language: en
 timezone: UTC
  • --- and +++ name the original and changed file.
  • @@ -1,5 +1,5 @@ is a hunk header: this block starts at line 1 and covers 5 lines in each file.
  • Lines starting with - were removed, + were added, and a space means unchanged context (3 lines by default).
  • \ No newline at end of file marks a last line with no line break after it.

The patch is built from the text as you entered it, so it applies cleanly with git apply or patch. With an ignore option on, the patch follows that filtered comparison, the same as git diff -w, so treat it as something to read rather than apply.

File diff checker: comparing two files and large inputs

Press Open file on each side or drag a file onto a box. Any plain-text file works: .txt, .md, .json, .csv, .xml, .html, source code, logs. The file is read by your browser and never uploaded.

  • Up to 5 MB per file and 20,000 lines per side.
  • Binary files (images, PDFs, Word documents) are rejected with a message, because a line diff of their raw bytes means nothing. Save Word or Google Docs files as plain text first.
  • If two very large inputs are almost completely different, the tool stops searching for the minimal diff after a fixed amount of work and shows those regions as replaced whole. The result says so when that happens.
  • Only the first 4,000 rows are drawn at first; a button renders the rest, so the page stays responsive.

For whole folders or repositories, use git diff --no-index folder-a folder-b on your own machine. It uses the same algorithm and handles any size.

Online diff checker vs desktop and editor tools

An online diff checker is fastest for one-off comparisons, especially on a borrowed or locked-down computer. For daily work on code, the tools you already have are often better.

Where each way of comparing text fits
ToolBest forInstall neededText leaves your device
This diff checkerQuick text compare, JSON, snippets, phonesNoNo
git diff / diff -uFiles and folders in a projectYes (Git or diffutils)No
VS Code compareCode you are editingYesNo
Word Compare DocumentsFormatted documents with tracked changesYes (Microsoft Word)No
Diff sites that upload textSharing a diff by linkNoYes, check their policy

Developers who format and inspect data all day may prefer an extension in the toolbar; our JSON formatter use case and the JSON Formatter extension profile cover that, and tools for developers lists more.

Diff Checker: FAQs

What does diff mean?

Diff is short for difference. It is the name of the Unix program that compares two files and lists the lines you must delete or add to turn one into the other. A diff checker does the same job in a visual way, with colours for removed and added text.

How do I compare two texts for differences?

Paste the first text into Original text and the second into Changed text. The tool highlights removed lines in red, added lines in green and changed words inside edited lines. Turn on Ignore whitespace or Ignore case if those differences don't matter to you.

How do I compare two files?

Press Open file above each box, or drag a file onto it. This file diff checker reads plain-text files up to 5 MB in your browser, so nothing is uploaded. Word or PDF files need to be saved as plain text first.

Is this diff checker online and free?

Yes. This diff checker online is free, needs no account and has no daily limit. It runs in your browser, so it also keeps working if your connection drops after the page has loaded.

Is my text uploaded when I use this online diff checker?

No. The comparison runs in JavaScript on your device. Text and files are never sent to our server. Only your option choices, such as the view and ignore settings, are remembered in this browser.

Can I use it as a JSON diff checker?

Yes. Tick JSON mode and both sides are parsed and re-indented before comparing, so minified and formatted JSON line up. Tick Sort JSON keys as well to ignore key order, which JSON treats as meaningless. Syntax errors are reported with the line and column.

Does it work as a git diff checker?

It uses the same Myers algorithm Git uses by default and exports a standard unified diff with ---, +++ and @@ headers. You can paste that patch into a pull request comment or apply it with git apply.

Can I compare code with this diff code checker?

Yes. Paste two versions of any source file. Turn on Ignore all whitespace to skip indentation changes after reformatting, and use character highlights to find a single changed symbol, such as a swapped operator or quote.

How do I use it as a string diff checker for one line?

Paste each string into its own box and choose Characters under Highlight inside changed lines. The tool marks the exact characters that differ, which helps with near-identical IDs, URLs, hashes or keys.

Does it work as an XML, CSV or HTML diff checker?

Yes, as long as both sides use the same layout. Pretty-print XML and HTML with the same indentation first, and sort CSV rows by the same column. Each line is then compared, with changed values highlighted inside the row.

Why does every line show as changed?

Usually the whitespace differs: tabs vs spaces or re-indented code. Turn on Ignore all whitespace. If the files are reordered data, sort both first. Line endings (Windows vs Mac or Linux) are already ignored.

What is the difference between side by side and inline view?

Side by side shows the original and changed text in two columns, row by row. Inline shows one column like git diff, with removed lines marked - and added lines marked +. On narrow phone screens side by side stacks each pair.

How large a file can the diff checker handle?

Up to 20,000 lines per side and 5 MB per file. A 10,000-line file with scattered edits usually compares in well under a second. Very different large inputs may show some regions as replaced whole to keep the page responsive.

What is the best free text compare tool?

For a quick text compare without installing anything, a browser-based tool that doesn't upload your text is the safest choice. For projects already in Git, git diff or your code editor's compare view is better because it works on whole folders.

Sources and further reading