PublicSoftTools
Tools16 min read·PublicSoftTools Team·May 2026

Diff Checker — Compare Two Texts and Find Differences

A diff checker (difference checker) compares two pieces of text and highlights exactly what has changed — which lines were added, which were removed, and which are unchanged. Developers use diffs to review code changes; legal and business teams use them to compare document versions; writers use them to track edits. The free diff checker on PublicSoftTools shows line-by-line and character-level differences instantly.

How to Use the Diff Checker

  1. Open the diff checker.
  2. Paste the original text in the left panel (or "Version A").
  3. Paste the new or modified text in the right panel (or "Version B").
  4. Click Compare (or the comparison is live-updating as you type).
  5. Added lines are highlighted in green; removed lines in red; unchanged lines in neutral.
  6. Switch between line diff, word diff, and character diff modes for different granularity levels.

Types of Diff Comparison

Diff typeHow it comparesWhat is shownBest for
Line diffCompares text line by lineAdded lines (green), removed lines (red), unchanged lines (neutral)Code comparison, document revision, configuration file changes, log analysis
Word diffCompares text word by word within linesIndividual words added or removed highlighted within each lineDocument editing, identifying specific wording changes in long paragraphs
Character diffCompares character by characterIndividual characters changed highlighted within wordsFinding subtle differences — an extra space, a changed digit, a transposed letter
Side-by-side diffShows original and new version in parallel panelsTwo-panel view with corresponding sections alignedVisual comparison of longer texts; easier to read than unified diff
Unified diffShows changes in a single panel with +/− symbols+ prefix for added, − prefix for removed, context lines unchangedgit diff output format; patch files; code review tools

Common Use Cases

ScenarioWhat you are comparingBenefit
Code reviewComparing the old version of a function with the new versionSee exactly which lines changed — spot unintentional modifications alongside intentional ones
Document revisionContract v1 vs. contract v2 — find every change between versionsLegal review requires knowing every difference; line-level diff shows additions and removals clearly
Configuration file debuggingWorking config vs. broken config — why did it stop working?Immediately identifies the difference — which line changed, was added, or was removed
Plagiarism detectionOriginal text vs. submitted text — find unchanged copied sectionsUnchanged lines between two documents reveal directly copied content
Data comparisonExport from two dates — what data changed?CSV or JSON diff shows which rows were added, removed, or modified
API response monitoringYesterday's API response vs. today's — did anything change?Detects breaking changes or unexpected data mutations in external APIs

How the Diff Algorithm Works

The standard algorithm for computing diffs is the Longest Common Subsequence (LCS) algorithm, or the more efficient Myers diff algorithm (used in git and most modern diff tools). The algorithm:

  1. Finds the longest common subsequence — the longest sequence of lines (or words, or characters) that appear in both texts in the same order
  2. Anything in the original that is not in the LCS is a deletion (shown in red)
  3. Anything in the new text that is not in the LCS is an addition (shown in green)
  4. The LCS itself represents unchanged content

The Myers algorithm is optimised for the common case where differences are small — it finds the minimum edit distance (smallest number of insertions and deletions needed to transform one text into the other). This produces the most "human readable" diff — grouping changes together rather than scattering them randomly.

Reading a Unified Diff

The unified diff format (used by git diff, patch files, and code review tools) shows changes with the following conventions:

Git Diff: The Developer's Diff Tool

Git provides built-in diff functionality. Key commands:

GitHub, GitLab, and Bitbucket display diffs in pull request (PR) and merge request reviews, with visual highlighting of additions and deletions. Code review is fundamentally based on reading diffs to understand what changed between versions.

Diff for Non-Code Uses

Diff checkers are not only for code. Common non-developer uses:

Whitespace and Case Sensitivity

Diff tools often have options for ignoring:

Common Questions

What does a "merge conflict" look like in a diff?

A merge conflict occurs when two branches in git both modified the same lines in different ways. Git marks the conflicted area with conflict markers: <<<<<<< HEAD shows the current branch version; >>>>>>> branch-name shows the incoming branch version; ======= separates them. The developer must manually edit the file to choose or combine the versions, then remove the conflict markers. Diff checkers can help visualise the two conflicting versions before resolving.

Can I compare binary files with a diff checker?

Text-based diff checkers work with UTF-8 text — source code, JSON, XML, CSV, HTML, markdown. Binary files (images, PDFs, compiled executables, Word .docx) cannot be compared meaningfully with a text diff. Word documents can be compared using Word's built-in track changes or by extracting their XML content first. Specialised tools handle binary diffs — images can be diffed pixel-by-pixel; database schemas have their own diff tools.

What is the difference between diff and patch?

A diff shows the differences between two texts. A patch is a file containing a diff that can be applied to transform one version into another. The classic Unix workflow: generate a diff with the diff command; distribute the patch file; recipients apply it with the patch command to update their local copy. Git patches (git format-patch, git apply) extend this for version-controlled workflows. Patch files allow changes to be distributed without sending entire files.

Compare Texts Side by Side

Paste two versions of any text to instantly see added, removed, and changed lines highlighted in green and red.

Open Diff Checker