ORIGINAL
MODIFIED
CHANGED
DIFF
+ function calculateTotal() {
- function getTotal() {
return items.length;
+ const result = process(data);
- const output = process(data);
// end of function
Developer Tools

How to Compare Texts and Find Differences Online

A practical guide to using a free diff checker for code review, document editing, and any side-by-side text comparison. No installation needed.

Quick Start Guide
Quick Start: Compare Texts in 30 Seconds
1
Open Tool
Go to affligo.com/diff-checker
2
Paste Texts
Original on left, modified on right
3
Set Options
Ignore whitespace, case, word mode
4
Compare
Click Compare and see results
5
Copy Diff
Copy results to clipboard

Every time you compare two versions of a document by reading them side by side, you are wasting time and missing changes. Manual text comparison is error-prone, slow, and unreliable. Whether it is a code file, a contract, a configuration, or a translated document, human eyes are not built to spot small differences across long blocks of text.

A diff checker solves this instantly. Paste two texts, click one button, and every addition, deletion, and modification is highlighted in color. No more squinting at paragraphs to find what changed. No more wondering if you missed a subtle edit. The tool does the heavy lifting so you can focus on the changes that matter.

This guide covers everything: what a diff checker is, how the LCS algorithm works under the hood, when to use line-by-line versus word-by-word comparison, and real-world scenarios where diff tools save hours of work. By the end, you will know exactly how to use a diff checker for any comparison task.

What Is a Diff Checker

Understanding the concept behind text comparison tools.

A diff checker is a tool that compares two blocks of text and highlights every difference between them. Instead of reading through two documents side by side and trying to spot what changed, the tool does it instantly and shows you exactly which lines or words were added, removed, or modified.

Side-by-Side Input

You paste the original text on the left and the modified text on the right. The tool processes both simultaneously and produces a unified diff output showing every change between the two versions.

Instant Results

The comparison runs entirely in your browser using JavaScript. There is no server roundtrip, no waiting, and no file upload. Results appear the moment you click Compare.

Visual Highlighting

Added lines appear in green, removed lines in red with strikethrough, and modified lines in amber. This color coding makes it possible to scan through hundreds of changes in seconds.

100% Private

Everything happens on your device. Your text is never sent to any server, never stored, and never logged. This makes the tool safe for confidential documents, proprietary code, and sensitive contracts.

Multiple Comparison Modes

Choose between line-by-line and word-by-word comparison. Toggle ignore whitespace and ignore case to customize how strictly the tool compares your texts.

File Upload Support

Upload .txt files directly instead of copying and pasting. The tool reads the file in your browser without sending it anywhere, making it easy to compare large documents.

Key Concept

You have probably used diff technology without realizing it. Version control systems like Git use diff algorithms to show what changed between commits. Text editors like VS Code have built-in diff views. Code review platforms like GitHub and GitLab display pull request diffs using the same fundamental approach. The AFFLIGO diff checker brings this same power to a simple, standalone tool.

How the LCS Algorithm Works

A step-by-step look at the Longest Common Subsequence algorithm powering the diff checker.

Under the hood, the diff checker uses an algorithm called LCS (Longest Common Subsequence). This is the same family of algorithms used by Git, GNU diff, and most professional diff tools. LCS finds the longest sequence of elements that appear in both inputs in the same order, then marks everything else as a change.

01

Split Into Lines

The tool takes both input texts and splits them into individual lines. Each line becomes an element in two arrays. The original text becomes array A and the modified text becomes array B.

02

Build the DP Matrix

The algorithm creates a two-dimensional matrix of size (m+1) by (n+1), where m is the number of lines in A and n is the number of lines in B. Each cell (i, j) stores the length of the LCS for the first i lines of A and the first j lines of B. The matrix is filled using dynamic programming: if lines match, the value is one plus the diagonal; otherwise, it takes the maximum of the cell above or to the left.

03

Backtrack to Find the Diff

Starting from the bottom-right corner of the matrix, the algorithm traces back to the top-left. At each step, if the lines match, it marks them as equal. If not, it moves in the direction of the larger value, marking lines as deleted (from A) or inserted (from B). This produces the complete edit script.

04

Mark Changed Lines

When a deletion is immediately followed by an insertion, the tool detects this as a modification rather than separate add and remove. In word-by-word mode, it then runs a second LCS pass on the individual words within those two lines to pinpoint exactly what changed at the word level.

Example Walkthrough

Consider two short texts. The original has three lines, and the modified version has four lines with one change:

Original (A):
  The quick brown fox
  jumps over the lazy dog
  It was a dark night

Modified (B):
  The quick brown fox
  leaps over the lazy cat
  It was a bright morning
  The sun was shining

The LCS finds that "The quick brown fox" appears in both. Lines 2 and 3 differ. Line 4 is new. The result shows one unchanged line, two removed, two added, and one newly inserted.

  The quick brown fox
--jumps over the lazy dog
++leaps over the lazy cat
--It was a dark night
++It was a bright morning
++The sun was shining
Algorithm Complexity

The basic LCS algorithm runs in O(m x n) time and space, where m and n are the number of lines in each text. For most everyday comparisons, this is instantaneous. The tool also warns you when combined input exceeds 50,000 characters, as very large inputs may take a few extra seconds to process. For most use cases, performance is not a concern.

Line-by-Line vs Word-by-Word

Understanding when to use each comparison mode for optimal results.

The diff checker offers two comparison modes. Understanding when to use each one helps you get the most out of the tool. The default mode compares entire lines. The word-by-word mode goes deeper for changed lines.

Line-by-Line (Default)

In the default mode, the tool compares entire lines. If a line changed at all, the whole line is highlighted. This is fast and works well for most comparisons, especially when changes are spread across different lines. This mode is ideal for code files where each line typically contains a single statement, for configuration files, and for documents where changes tend to be line-based.

Word-by-Word

When you enable the word-by-word toggle, the tool goes deeper for changed lines. It splits both versions at word boundaries and runs a second diff on the individual words. Instead of highlighting an entire line in amber, it shows exactly which words were added (green) or removed (red strikethrough) within that line. This is especially useful when a line has a small change buried in a long sentence.

~The quick brown foxcat jumps over the lazysleeping dog.

Without word mode, the entire line would show as changed. With word mode, you can see that "fox" became "cat" and "lazy" became "sleeping" two small changes in a long line, highlighted instantly.

FeatureLine-by-LineWord-by-Word
Comparison unitFull linesIndividual words within changed lines
Best forGeneral comparisons, code, configsLong lines, prose, contracts
SpeedFasterSlightly slower on very large texts
GranularityLine level onlyWord level within changed lines
Changed line displayEntire line highlighted in amberSpecific words highlighted in green/red
Use caseCode reviews, config diffsDocument edits, contract changes
When to Use Word Mode

Use word-by-word mode whenever a changed line is longer than about 80 characters and you need to know exactly what shifted. For short lines or when the entire line clearly changed, line-by-line mode is sufficient and faster. You can toggle between modes at any time without re-entering your texts.

Step-by-Step: How to Use the Tool

A complete walkthrough of every feature in the AFFLIGO diff checker.

01

Enter Your Texts

Paste the original text into the left panel and the modified text into the right panel. You have three ways to input text:

  • Type directly — click in either textarea and start typing
  • Paste from clipboard — use Ctrl+V or Cmd+V to paste copied text
  • Upload a .txt file — click the upload icon next to each textarea to load a plain text file from your computer

The tool handles any amount of text, but very large inputs (over 50,000 characters combined) may trigger a performance warning.

02

Set Your Comparison Options

Before comparing, choose the options that match your use case:

  • Ignore whitespace — collapses multiple spaces into one and trims leading/trailing spaces. Useful when formatting changed but content did not.
  • Ignore case — converts all text to lowercase before comparing. "Hello" and "hello" will be treated as identical.
  • Word-by-word — enables word-level diff within changed lines, showing exactly which words were added or removed.

These options only affect how the algorithm sees the text. Your original input is never modified.

03

Compare

Click the Compare button. The results appear instantly below the input panels. You will see:

  • A color-coded diff showing every addition, deletion, and modification
  • A summary bar showing counts for added, removed, and unchanged lines
  • Line-by-line highlighting with clear visual indicators

If word-by-word mode is enabled, changed lines will show word-level highlights within the line.

04

Refine Your View

Use the Show All / Diffs Only toggle to control what you see:

  • Show All — displays every line including unchanged ones (default)
  • Diffs Only — hides unchanged lines and shows only additions, deletions, and modifications

Diffs Only mode is great for large documents where you just want to jump to the edits without scrolling through identical content.

05

Copy the Results

Click Copy Diff to copy all diff lines to your clipboard. You can then paste the results into:

  • A pull request comment or commit message
  • An email explaining what changed
  • A Slack or Teams message
  • A documentation file or changelog

The copied text preserves the diff formatting with + and - prefixes for each line.

Quick Tip

Use the Swap button to quickly reverse the comparison direction. This is handy when you want to see the diff from the other perspective for example, checking what was removed rather than what was added. The Swap button exchanges the contents of both panels and re-runs the comparison automatically. Use the Clear button to reset both panels and start fresh.

Ignore Options Explained

How normalization options change what the diff algorithm sees.

The ignore options change how text is normalized before comparison. They do not modify your original text — they only affect how the diff algorithm processes it. This is important: your input panels always show the original text. The normalization is applied internally.

Ignore Whitespace

When enabled, the tool applies this transformation to each line before comparing:

This is useful when code was reformatted (for example, re-indented) but the actual logic did not change. Without this option, every re-indented line would show as a change, cluttering the diff output with irrelevant formatting noise.

 Without ignore whitespace:
-- function calculateTotal(items) {
++function calculateTotal(items) {
 With ignore whitespace:
  function calculateTotal(items) {

Ignore Case

When enabled, every line is converted to lowercase before comparison. This means capitalization differences are ignored entirely. It is useful when comparing text that may have inconsistent capitalization but the same underlying content. For example, a heading that changed from "Introduction" to "INTRODUCTION" would not appear as a change with this option enabled.

Combine Both Options

You can enable both ignore whitespace and ignore case at the same time. This gives you the most forgiving comparison, where only actual content changes are highlighted. This is particularly useful when comparing texts from different sources that may have different formatting conventions but the same logical content.

Important

Ignore options affect only the comparison logic, not your displayed results. The diff output always shows the original text from your input panels, not the normalized version. This ensures you see the actual content while benefiting from flexible comparison rules.

Color Coding Explained

What each color means and how to read the diff output at a glance.

The diff results use a consistent color scheme to make it easy to scan through changes. Each color represents a specific type of change, and understanding these colors helps you interpret results quickly even in large diffs.

Green: Added Lines

Lines highlighted in green exist only in the modified (right) text. They were not present in the original. These are new content that someone added. In the diff output, they are prefixed with a + symbol.

Red: Removed Lines

Lines highlighted in red exist only in the original (left) text. They were deleted or replaced in the modified version. The text appears with a strikethrough decoration. In the diff output, they are prefixed with a - symbol.

Amber: Changed Lines

Lines highlighted in amber represent modifications. A line in the original was replaced by a different line in the modified text. In the diff output, they are prefixed with a ~ symbol. When word-by-word mode is on, the specific changed words are highlighted within the line.

No Highlight: Unchanged

Lines with no background color are identical in both texts. They appear in the default background and are prefixed with a space character in the diff output. These lines are only visible in Show All mode.

The Summary Bar

Below the input panels, a summary bar shows three counts after comparison:

 +3 added -2 removed =14 unchanged

This gives you a quick overview of how much changed without reading the entire diff. A high unchanged count with low added/removed counts means the texts are mostly the same. A high added or removed count indicates significant changes.

Real-World Use Cases

Common scenarios where a diff checker saves real time and catches errors.

Code Review

Paste the old version and new version of a code file to see exactly what changed. The word-by-word mode is especially useful here because it highlights the specific variable names, function calls, or logic that changed within a line. Essential for pull request reviews and debugging.

Document Editing

When a colleague sends back an edited document, paste both versions to see every change they made. This is faster than reading through the entire document trying to spot edits manually. Works for essays, reports, proposals, and any text-based document.

Contract Comparison

Legal and business contracts often change by just a few words between versions. A word-level diff catches even the smallest modifications — a changed date, a different dollar amount, or a reworded clause. Critical for due diligence and contract negotiation.

Configuration Files

When deploying applications, config files often have minor environment-specific changes. Comparing them side by side helps you verify that only the intended changes are present and nothing was accidentally modified or deleted.

Translation Verification

If you have two versions of a translated document, the diff checker can help verify that all changes were applied consistently and nothing was accidentally left out or mistranslated across the entire document.

Plagiarism Spot-Checking

Compare two suspected documents to see if content was copied with minor modifications. The word-level diff makes it easy to spot paraphrased sections, renamed variables, or reordered sentences that are otherwise hard to detect by reading.

Pro Tip

For code reviews, enable both ignore whitespace and word-by-word mode. This combination filters out formatting noise and highlights the exact code changes, making it much faster to review pull requests. For contract comparison, use word-by-word mode without ignore options to catch every single word change, no matter how small.

Tips for Better Comparisons

Practical advice to get the most accurate and useful diff results.

01

Use Ignore Whitespace for Code

Reformatting and re-indenting are common in code reviews. Enabling this option ensures you only see actual logic changes instead of every indentation shift being flagged as a difference. This dramatically reduces noise in code diffs.

02

Use Word-by-Word for Long Lines

If your text has long paragraphs or lines, word mode helps you pinpoint the exact change instead of reading through the entire line. This is especially valuable for prose, contracts, and documentation where a single word change matters.

03

Try Diffs Only for Large Texts

When comparing long documents, switch to Diffs Only mode to skip all the unchanged content and jump straight to the edits. This saves scrolling time and helps you focus on what actually changed between versions.

04

Use Swap to Check Both Directions

Sometimes you want to see what was added, other times you want to see what was removed. The Swap button reverses the comparison instantly, giving you a different perspective on the same changes without re-entering anything.

05

Upload .txt Files for Large Inputs

Instead of pasting very large blocks of text, upload them as .txt files. The tool reads them directly in your browser without uploading to any server, making it easy to compare large documents without copy-paste issues.

06

Copy Results for Documentation

Use Copy Diff to grab the results and paste them into commit messages, pull request descriptions, email threads, or changelog files. The formatted output preserves the + and - prefixes for clear communication.

Performance Note

The tool works entirely in your browser, so very large inputs (over 50,000 characters combined) may trigger a performance warning and process more slowly. For most everyday comparisons, this is not an issue. If you consistently hit this limit, consider splitting your text into smaller sections or using a server-based diff tool for massive files.

Frequently Asked Questions

Answers to common questions about the diff checker tool.

Q1

What is a diff checker?

A diff checker is a tool that compares two blocks of text and highlights the differences. It shows which lines or words were added, removed, or changed between the two versions, making it easy to spot modifications without reading both texts manually.

Q2

How does the diff checker algorithm work?

The AFFLIGO diff checker uses the LCS (Longest Common Subsequence) algorithm. It finds the longest sequence of lines that appear in both texts, then marks everything else as added or removed. For word-level diffs, it applies the same algorithm to individual words within changed lines.

Q3

What does ignore whitespace do?

When ignore whitespace is enabled, the tool collapses multiple spaces into a single space and trims leading and trailing whitespace before comparing. This prevents minor formatting changes like re-indentation from showing up as differences.

Q4

What does ignore case do?

When ignore case is enabled, the tool converts all text to lowercase before comparing. This means "Hello" and "hello" are treated as the same, so only actual content differences are highlighted regardless of capitalization.

Q5

What is word-by-word comparison?

Word-by-word comparison splits each line at word boundaries and runs a separate diff on the individual words. Instead of highlighting an entire changed line, it shows exactly which words within that line were added or removed, providing granular detail.

Q6

What is the diffs only mode?

Diffs Only mode hides all unchanged lines from the results. It shows only the lines that were added, removed, or modified, making it easier to focus on what changed without scrolling through identical content.

Q7

Is my text sent to a server?

No. All comparison happens entirely in your browser using JavaScript. Your text never leaves your device, so it stays completely private. This makes the tool safe for confidential documents, proprietary code, and sensitive contracts.

Q8

What file types can I upload?

You can upload .txt (plain text) files. Click the upload icon next to each textarea to load a file. The tool reads the file in your browser without uploading it to any server, ensuring your data stays private.

Ready to Compare Your Texts?

Spot differences in seconds. Free, private, and runs entirely in your browser. No signup required.

Open Diff Checker