Diff Checker: Compare Text

Paste two versions of a text, code, configuration file or document to instantly see what changed. Added lines are shown in green, removed lines in red, and changed lines highlight the exact words that differ. Switch between side-by-side and unified views, ignore whitespace or letter case, collapse unchanged sections, open files directly, and export the result as a standard .diff patch. Everything is compared in your browser.

  • 100% free
  • No sign-up
  • Private & local
  • Works on mobile

Private by design: every calculation runs locally in your browser. Nothing you type is sent to a server or stored by us.

What Is a Diff Checker?

A diff checker compares two pieces of text and shows exactly what was added, removed or changed between them. The name comes from the classic Unix diff command, which has been used since the 1970s to track changes to source code, and which still underpins Git, code review tools and patch files today. Comparing texts by eye is slow and error-prone. A diff tool finds every change in milliseconds, including a single changed character in a thousand lines.

This online diff checker is useful for developers comparing code, configuration files, SQL, JSON or logs. It's just as handy for writers, editors, lawyers, students and translators comparing drafts, contracts and documents.

How to Compare Two Texts

  1. Paste the original on the left and the changed version on the right, or open files from your computer.
  2. Read the result. Removed lines are red, added lines are green, and within changed lines the exact words that differ are highlighted.
  3. Choose a view: side by side for reading, or unified (like Git) for a compact list of changes.
  4. Refine with "ignore whitespace" (indentation and spacing changes) and "ignore case", and collapse unchanged lines to focus on the differences.
  5. Export the differences as a unified .diff patch to share or apply.

How the Comparison Works

The tool uses the Myers diff algorithm, the same algorithm used by Git and GNU diff. It finds the shortest edit script, the smallest set of line insertions and deletions that turns the original into the changed text, so the result matches what a person would consider the real changes. When a removed line is followed by an added line, they're paired as a "changed" line, and a second, word-level diff highlights precisely which words were edited.

Reading a Unified Diff

SymbolMeaning
--- original / +++ changedThe two files being compared
@@ -3,4 +3,5 @@A hunk: 4 lines starting at line 3 of the original become 5 lines starting at line 3 of the new file
- lineRemoved from the original
+ lineAdded in the new version
space + lineUnchanged context

The exported patch uses the standard format with 3 lines of context, so it can be applied with git apply or patch -p0 (check the file names first).

Tips for Better Comparisons

  • Format first: for JSON or XML, format both versions with the JSON Formatter or XML Formatter before comparing, so differences line up.
  • Ignore whitespace when indentation or trailing spaces changed but the content didn't.
  • Sort lists first (Sort Lines tool) when order doesn't matter.
  • Line endings: Windows (CRLF) and Unix (LF) line endings are treated as whitespace when "ignore whitespace" is on.

Common Uses for a Diff Checker

  • Code review: compare two versions of a function or configuration file without a Git repository.
  • Config drift: find what differs between staging and production settings, .env files or server configs.
  • Documents: see exactly what a colleague changed in a contract, policy or article draft.
  • Data checks: compare exported lists, CSV rows or SQL query results before and after a change.
  • Translations: spot missing or changed lines between language files.

Word-Level vs Line-Level Differences

Line-level diffs tell you which lines changed. That's ideal for code, where each line is usually one statement. For prose, a single edited word marks a whole paragraph as changed, which is why this tool adds a word-level comparison inside each changed line, highlighting only the words that were actually removed or added. For documents written with one paragraph per line, this makes it easy to see small edits such as a changed number, a corrected name or an added clause, without re-reading the whole paragraph. Tick "ignore whitespace" to skip changes that only affect spacing or indentation.

Frequently Asked Questions

Is my text uploaded?

No. The comparison runs entirely in your browser, which makes it safe for code, contracts and confidential documents.

How large can the texts be?

Several thousand lines compare instantly. Extremely different large files may fall back to showing a full replacement.

Can I compare Word or PDF files?

Convert them to text first with the Word to Plain Text or PDF to Text tools, then paste them here.

What does "similar %" mean?

The share of lines that are unchanged, relative to the average length of both texts.

Can I apply the .diff file with Git?

Yes. Set the file names to the real paths, then run git apply changes.diff.