Skip to main content
Browse all

Diff Checker

FREEDeveloper
TOOLDiff Checker
5 added4 removed3 unchanged
1-function greet(name) {
2- console.log("Hello, " + name);
1+function greet(name, greeting) {
2+ console.log(greeting + ", " + name);
33 return true;
44 }
55
6-const x = 42;
7-const arr = [1, 2, 3];
6+const x = 100;
7+const arr = [1, 2, 3, 4];
8+const obj = { key: "value" };
100% freeNo signupRuns in your browser

About Diff Checker

The diff algorithm is a fundamental tool in software development, underpinning git diff, code review tools, document version history, and configuration management. Properly diffing two pieces of text requires solving the Longest Common Subsequence (LCS) problem — finding the maximum set of lines common to both inputs so that the minimum number of additions and removals can be identified. A good diff viewer surfaces these changes with enough context to understand why a line changed, not just that it changed.

How It Works

The comparison engine uses the Myers diff algorithm, the same algorithm at the core of Git and most Unix diff utilities. Myers's algorithm finds the shortest edit script (minimum number of line insertions and deletions) that transforms the original text into the modified text. Its time complexity is O(ND) where N is the total number of lines and D is the edit distance, making it fast for typical source code and configuration file sizes.

The output is rendered in three modes. Side-by-side (split) view renders original and modified text in two synchronized scrolling columns with line numbers and color-coded changes. Unified view renders the classic +/- interleaved format with 3 lines of context around each changed block. Inline view renders changes character-by-character within each modified line, showing exactly which words were inserted or deleted.

The whitespace normalization options preprocess each line before comparison: trimming trailing whitespace, normalizing runs of internal whitespace to a single space, and optionally lowercasing all characters. Blank line skipping removes lines that contain only whitespace before the comparison, reducing visual noise in config file diffs.

Who Is This For

A developer compares two versions of a Nginx config file before deploying a routing change, using "ignore whitespace" to focus on meaningful rule differences.

A QA engineer diffs the API contract document against the implementation spec to identify fields that were added or removed without a changelog entry.

A tech lead reviews an AI-generated code refactor by pasting the before and after into the diff tool to verify only the intended logic changed.

A writer compares two drafts of technical documentation side by side to review copyediting changes before publishing.

How to Use

1

Paste your original text in the left panel

2

Paste the modified text in the right panel

3

View the diff below — green for added, red for removed lines

4

Switch between side-by-side, unified, or inline views. Download as .diff file.

Frequently Asked Questions

The tool uses a Longest Common Subsequence (LCS) algorithm for accurate line-by-line matching. This is the same approach used by Git and other version control systems.
Yes. Toggle "Ignore whitespace" to skip spacing differences, "Ignore case" for case-insensitive comparison, and "Ignore blank lines" to skip empty lines.
Yes. Click the ".diff" button to download the unified diff in standard patch format, compatible with Git and other tools.
No. All comparison happens 100% in your browser. Your text never leaves your device.
Side-by-side (split) view shows original and modified text in two columns, making it easy to scan both versions simultaneously. Unified view interleaves additions (+) and removals (-) in a single column with context lines around changes, which is the format Git uses by default and is more compact for large files.
Yes. Toggle "Ignore whitespace" to suppress differences caused by tabs vs. spaces, trailing spaces, or indentation changes. This is especially useful for comparing code formatted by different auto-formatters like Prettier and Black.
The downloaded .diff file is in unified diff format, compatible with Git's patch format. It can be applied to a file using git apply or the Unix patch command. Each changed block includes 3 lines of context by default, matching Git's default behavior.

Need production-ready starter kits?

Next.js, React, and Node.js starter templates with auth, payments, and deployment pre-wired. Starting at $4.

Browse Developer Kits

Found this useful? Share it.

Share: