How to Compare Text and Find Differences

· 5 min read

Finding what changed between two versions of a document, config file, or piece of code is a common task. Reading both versions and spotting differences manually is slow and unreliable, especially with long texts. A diff checker does it instantly and highlights every change. The same algorithm that powers Git's commit history, GitHub's pull-request review interface, and the Unix diff command underlies every visual diff tool you have ever used.

How to compare text

  1. Paste both versions: enter the original text on the left and the modified text on the right.
  2. Review the highlights: added lines are shown in green, removed lines in red. Modified lines show both the old and new versions.
  3. Export or copy: copy the diff results or download a report.

The comparison happens as soon as both panes have text. There is no Compare button to click; edits to either side re-run the diff in real time, which is useful when you are iterating on a fix and want to see the effect immediately.

Reading a diff

Diff output uses a simple color system:

This is the same convention used by Git, GitHub, GitLab, Bitbucket, and every major version control system. The colors are not arbitrary: green for additions and red for deletions has been the standard since the 1970s when the first visual diff tools (like the sdiff command) shipped on Unix. Modern tools sometimes add yellow or orange for "changed" (a line that exists in both but is different), but red and green remain the universal additions/deletions.

A short history of diff

The diff algorithm was first published by Douglas McIlroy at Bell Labs in 1976, building on Eugene Myers's later refinement (the O(ND) algorithm, 1986) that made diff fast enough for interactive use. McIlroy's original algorithm was published with the Unix V7 release in 1979 and has been part of every Unix-like operating system since. The Myers algorithm is what powers modern diff implementations: Git's diff, GitHub's web interface, every diff GUI from Beyond Compare to VS Code.

The visual side-by-side diff format predates the algorithm: it traces back to manual proofreading conventions in publishing (showing two columns of text with changes marked in the margin). The 1970s software just automated what editors had been doing on paper for centuries. The "unified diff" format (the one with --- and +++ headers that you see in patch files) was introduced in 1990 by GNU diff and is now the de facto standard for sharing changes by text.

When diff checking is useful

Line-based vs character-based diff

The diff checker uses line-based comparison, which means it treats each line as the smallest unit of difference. If you change a single word on a line, the entire line is shown as changed (the old line in red, the new line in green) and you have to spot the word-level difference yourself.

Line-based diff is the standard for code and configuration files because those are typically line-oriented (one statement per line, one config option per line). It is fast, predictable, and matches how Git and every code review tool work.

For prose comparison where line-level changes are too coarse, some tools offer word-level or character-level diff that highlights just the changed words within a line. That is more precise but harder to read for code. If you need word-level diff, look for a tool specifically labeled "word diff" or "intra-line diff."

Privacy and confidential content

The diff checker runs entirely in your browser. Both pieces of text stay on your device; nothing is uploaded. This matters because the text you most want to diff is often confidential: contracts under negotiation, draft press releases, internal policy documents, source code under an NDA. Cloud diff tools (DiffChecker.com, JsonDiff.com, online merge tools) require uploading both texts to a third-party server, which is precisely what you want to avoid for sensitive content. Browser-based diff has none of that exposure.

The session is also stateless: nothing persists after you close the tab. If you need to keep a record of the diff, copy the output or take a screenshot before navigating away.

Common pitfalls

Tips

Frequently Asked Questions

Does the diff checker compare character by character?

It compares line by line, the same approach used by Git and most professional diff tools. If any character on a line changes, the entire line is highlighted as changed.

Is there a size limit?

There is no hard limit, but very large texts (over 10,000 lines) may take a moment to process since the comparison runs entirely in your browser.

Can I compare code files?

Yes. The diff checker works with any text, including source code. Syntax highlighting helps you read code diffs more easily.

Is my text sent to a server?

No. The comparison happens in your browser. Your text never leaves your device.