Text Diff Checker
Compare two text blocks and highlight exactly what changed.
A fast, browser-based text diff checker and code comparison utility. Compare two versions of any text, source code, JSON, YAML, HTML, CSS, Markdown, or SQL side-by-side or in unified diff mode. Powered by the Myers difference algorithm with word-level and character-level inline change detection, whitespace normalization, and case-insensitive matching. Generates standard unified diff (.patch) files compatible with git apply and GNU patch. Features synchronized scrolling, syntax-aware line numbering, similarity metrics, and quick swap shortcuts. All comparison calculations execute 100% client-side in your browser, guaranteeing total privacy with zero data transmission.
Keywords: text diff, diff checker, diff viewer online, compare text online, online diff, unified diff, side by side diff, code diff, file compare, text compare, diff tool, patch generator, json diff, yaml diff, line diff, word diff, myers diff algorithm, git diff online, char diff, ignore whitespace diff
Tags: diff, compare, text, patch, changes, merge
Popular Text & Data tools
- jq Playground & Filter BuilderInteractive jq expression tester, filter builder, and JSON transformer powered by WebAssembly.
- Base64 Encode/DecodeEncode and decode Base64 strings, files, and data URIs instantly.
- CSV to JSONConvert CSV/TSV to JSON and JSON to CSV with type inference and multiple output formats.
Text Diff Checker is also known as: Online Text Diff Checker, Code Comparison Tool Online, Side-by-Side Diff Viewer, Unified Diff Generator, Git Patch Generator Online, File Difference Checker, Online Diff and Merge Viewer, Word Level Diff Checker.
How to Text Diff Checker Online
Paste the original or baseline version of your text or code into the left editor panel (ORIGINAL).
Paste the updated or candidate version into the right editor panel (MODIFIED).
Click "Run Diff" or press ⌘↵ (Ctrl+Enter) to execute the Myers diff comparison algorithm instantly.
Switch between "Split View" (side-by-side synchronized columns) and "Unified View" (single-column git diff style) using the layout toggle or ⌘⇧L.
Adjust granularity between line, word, or character level to inspect intra-line token edits and typos.
Toggle comparison modifiers such as "Ignore Whitespace" (⌘⇧W) or "Ignore Case" to eliminate non-functional noise.
Click "Copy Patch" (⌘⇧C) or download a standard .patch file to apply changes directly via git apply or GNU patch.
Text Diff Checker Features
Side-by-side split view with synchronized scrolling, gutter line numbers, and paired change blocks.
Unified diff view using standard +/- change notation matching git diff and patch specifications.
Intra-line word-level diffing: isolates and highlights exact modified words within replacement lines.
Character-level precision diffing: pinpoints single-character typos, punctuation shifts, and regex tweaks.
Configurable context lines: display from 0 to 50 unchanged surrounding lines per diff hunk.
Whitespace normalization: filter out leading indentation changes, trailing spaces, and CRLF vs LF differences.
Case-insensitive diff mode: match text regardless of letter casing while preserving original code rendering.
Longest Common Subsequence (LCS) similarity scoring: real-time percentage breakdown of textual parity.
Standard GNU patch and git apply compatible unified output export with customizable file header labels.
Automated language syntax heuristic detection for JSON, YAML, SQL, TypeScript, HTML, CSS, and Markdown.
Quick swap shortcuts (⌘⇧S) to invert original and modified inputs without manual copy-pasting.
Zero-latency 100% client-side execution: no text or code is ever transmitted to remote servers.
Supported Formats & Dialects
The Text Diff Checker supports 6 syntax formats and dialects for accurate parsing and processing.
- Unified Diff Format (diff -u / Git Patch)
- The universal single-column patch standard displaying hunk headers (@@ -start,count +start,count @@), removed lines prefixed with -, added lines prefixed with +, and contextual lines with leading spaces.
- Side-by-Side Split Diff (Two-Pane Comparison)
- Dual-column visual comparison showing original text on the left and modified text on the right, keeping unchanged context aligned horizontally with synchronized scrolling.
- Word-Level & Token Inline Diff
- Intra-line difference analysis that tokenizes changed lines into words and punctuation, highlighting exact word substitutions with deletions strikethrough and additions highlighted.
- Character-Level Precision Diff
- Fine-grained intra-line comparison that highlights single-character edits, variable renaming suffixes, off-by-one indices, and spelling corrections within a line.
- Whitespace-Agnostic Diff (diff -w / -b)
- Comparison mode that ignores changes in spaces, tabs, and indentation, preventing noisy diffs caused by auto-formatters, Prettier, or editor tab-to-space reformatting.
- Case-Insensitive Diff (diff -i)
- Comparison mode that normalizes uppercase and lowercase letter differences when evaluating textual changes while retaining original letter casing in the output.
In-Depth Technical Guides
All Guides.env File Formatting & Escaping: Multiline Secrets, Quotes & 12-Factor Config
Master .env formatting rules, resolve multiline string and certificate escaping bugs, manage .env precedence, and prevent secret leaks in CI/CD.
De-minifying Production Stack Traces: Source Map Resolution Guide
Resolve minified JavaScript bundle errors back to original TypeScript source code using VLQ-decoded source maps, hidden source maps, and stack trace resolvers.
GitHub Actions YAML Workflow Debugging: The Top 10 Syntax & Runtime Pitfalls
A comprehensive developer guide to identifying and fixing GitHub Actions YAML syntax errors, matrix build bugs, expression interpolation traps, and concurrency race conditions.
How to Read, Deconstruct, and Understand Complex Regular Expressions
Master the art of reading cryptic regular expressions by breaking patterns down into visual abstract syntax trees, grouping constructs, lookarounds, and quantifiers.
ISO 8601, Unix Timestamps & Timezones: Zero-Discrepancy Time in Distributed Systems
Master epoch timestamps, millisecond vs microsecond precision, RFC 3339 / ISO 8601 formatting, UTC storage rules, and prevent subtle timezone bugs across databases and APIs.
JSON Formatting & Validation Best Practices: Production Guide
Master JSON formatting, RFC 8259 compliance, JSON Schema Draft 2020-12 validation, safe 64-bit integer handling, and high-throughput Node.js streaming.
Kubernetes YAML Validation: The 10 Most Common Manifest Mistakes
Diagnose and fix syntax errors, missing resource limits, selector mismatches, and schema validation failures in Kubernetes manifests before deployment.
Mastering Git Merge Conflict Resolution: 3-Way Diff, Diff3 Markers & Rebase Workflows
Resolve Git merge and rebase conflicts with confidence. Master standard vs diff3 conflict markers, 3-way merge logic, and conflict prevention strategies.
Migrating from Docker Compose to Kubernetes: Complete Translation Guide
Translate Docker Compose stacks into production-ready Kubernetes manifests. Map services to Deployments, host volumes to PVCs, and env files to ConfigMaps.
Protobuf Debugging: Reading Wire-Format Errors & Binary Streams
A developer guide to Protocol Buffers wire format, decoding varints, resolving tag mismatches, and debugging corrupt binary gRPC and Kafka streams.
Regex Catastrophic Backtracking: How to Detect, Debug, and Prevent ReDoS
Understand NFA regular expression engine backtracking, diagnose exponential runtime traps, and fix Regular Expression Denial of Service (ReDoS) vulnerabilities.
Repairing Malformed & AI-Generated JSON: Field Guide to Syntax Recovery
Learn how to repair broken JSON from LLM outputs, APIs, and configs. Master automated AST recovery for trailing commas, single quotes, bare keys, and truncated streams.
TOML Configuration Syntax, Arrays of Tables & Parsing: The Complete Developer Guide
Master TOML v1.0.0 configuration grammar, understand arrays of tables vs inline tables, parse Cargo.toml and pyproject.toml manifests, and serialize TOML across runtimes.
Visual Text Diffing, Unified Diff Syntax & Git Patch Workflows
Master code diff algorithms (Myers, Patience, Histogram), unified diff patch anatomy (@@ coordinates), side-by-side vs inline comparison, and patch workflows.
XML Formatting, Validation & XXE Prevention: The Production Engineering Guide
Master XML formatting standards, well-formedness rules vs XSD validation, namespace resolution, CDATA handling, and server-side XXE attack prevention.
Related Standards & RFC Specifications
All StandardscamelCase is a compound word writing convention where each constituent word begins with a capital letter without delimiter spaces, standard in JavaScript and modern software.
A diff is a data comparison algorithm and output format displaying line-by-line insertions, deletions, and modifications between text files.
Dotenv is a key-value configuration file convention standardized by the Twelve-Factor App methodology for injecting environment variables into application runtimes.
The IANA Time Zone Database (tzdb / Olson database) is the canonical global standard for historical and current timezone boundaries, UTC offsets, and Daylight Saving Time rules.
ISO 8601 is the international standard covering the exchange of date- and time-related data, establishing an unambiguous, lexicographically sortable date format.
JSON Patch is an IETF standard (RFC 6902) format for expressing a sequence of atomic operations to modify a target JSON document.
A merge conflict occurs in distributed version control when concurrent, divergent modifications target the same file lines or structure and cannot be resolved automatically.
Semantic Versioning is a universal three-component versioning specification (MAJOR.MINOR.PATCH) that communicates breaking API changes and compatibility.
A stack trace is a structured report of the active execution call stack frames generated by runtimes when an unhandled error, exception, or panic occurs.
TOML is a minimal, human-readable configuration file format engineered for unambiguous semantics and direct mapping to hash tables.
WebAssembly is a portable, low-level binary code format that executes at near-native speed inside web browsers, Node.js, and serverless edge runtimes.
Pre-built Automation Pipelines
Chain Text Diff Checker with other utilities in a multi-step visual workflow.
Base64 Decode → JSON Format
Decode a Base64 string and pretty-print the JSON inside it.
CSV → JSON → YAML
Convert CSV data to JSON, then to YAML format.
JSON Format → TypeScript Schema
Format JSON and generate TypeScript/Zod schema from it.
Example Input & Output
Sample ReferenceInteractive Example: Text Diff Checker in ActionShow example
Sample Input (diff)
Original: const greeting = "Hello World";
Modified: const greeting = "Hello DevFlow";
const version = "2.0";Sample Output
@@ -1,1 +1,2 @@
- const greeting = "Hello World";
+ const greeting = "Hello DevFlow";
+ const version = "2.0";What happened:
Computes line-by-line and character-level unified diffs between two files or code snippets with syntax highlighting.
Frequently Asked Questions
- How does the Myers difference algorithm calculate the minimal edit script?
- The Myers difference algorithm (published by Eugene W. Myers in 1986) models string and line comparisons as finding the shortest path on an edit graph. The grid vertices represent pairs of positions in the original and modified texts: horizontal edges denote deletions (cost = 1), vertical edges denote insertions (cost = 1), and diagonal edges denote identical matches (cost = 0). Myers computes the Longest Common Subsequence (LCS) using an O((N+M)D) breadth-first search heuristic, where N and M are the file lengths and D is the size of the minimal edit script. This guarantees the smallest, most human-readable set of additions and removals.
- What is the difference between split (side-by-side) and unified diff views?
- Split (side-by-side) view divides the screen into two parallel columns: the original file on the left and modified file on the right. Unchanged lines remain aligned horizontally, making it intuitive to visually trace wide refactoring, multi-column data, and large block shifts. Unified diff view consolidates all modifications into a single continuous stream of lines using "-" for deletions, "+" for additions, and " " (space) for context lines. Unified view is the standard format used by Git, GitHub pull requests, and patch files because it is compact and easy to parse programmatically.
- How does intra-line word-level and character-level diff highlighting work?
- While standard diff tools only indicate that an entire line has changed, intra-line diffing pairs consecutive removed and added lines and runs a secondary sub-diff algorithm. Word-level diffing splits the line by word boundaries and whitespace, highlighting only the specific modified words or tokens. Character-level diffing compares every individual Unicode code point, which is particularly useful for spotting off-by-one numbers, changed variable prefixes, single punctuation fixes, or subtle typos.
- What is the unified diff hunk syntax (@@ -start,count +start,count @@)?
- A hunk header describes the coordinate ranges of a modified block. The syntax "@@ -A,B +C,D @@" indicates that the original file hunk starts at line A and spans B lines, while in the modified file the hunk starts at line C and spans D lines. If B or D is omitted, the count defaults to 1. Patch utilities use these coordinates and the surrounding context lines to locate where edits should be applied, even if line offsets have shifted due to other changes in the target file.
- How can I apply an exported unified diff .patch file using git apply or GNU patch?
- You can copy the generated unified diff patch or save it as a ".patch" file. To apply it in a Git repository, run "git apply path/to/changes.patch" (or "git apply --check" to verify application without touching files). In standard UNIX/Linux environments, you can use the GNU patch utility: "patch -p1 < changes.patch" or "patch original_file.txt changes.patch".
- How does the ignore whitespace option handle indentation and line endings (CRLF vs LF)?
- When "Ignore Whitespace" is enabled, the diff engine strips leading indentation spaces/tabs, collapses multiple consecutive spaces into a single space, and ignores differences between Windows (CRLF, \r\n) and Unix (LF, \n) line breaks. This prevents entire files from showing as completely changed when a codebase is reformatted with Prettier, ESLint, Black, or converted across operating systems.
- What is the difference between a 2-way diff, a 3-way diff, and merge conflicts?
- A 2-way diff compares two static versions directly (Original vs Modified). A 3-way diff compares two diverged branches (HEAD vs Incoming) against their common ancestor commit (Merge Base). When both branches modify the same line differently relative to the base, a merge conflict occurs. If you have conflict markers in your code (<<<<<<<, =======, >>>>>>>), you can use our companion Git Conflict Resolver tool to inspect and resolve 3-way diffs interactively.
- How is the similarity percentage score calculated?
- The similarity score uses the Longest Common Subsequence (LCS) formula: Similarity = (2 * matching characters / (total characters in original + total characters in modified)) * 100. A score of 100% indicates byte-for-byte identical content, while 0% indicates completely disjoint texts. This metric helps developers quickly assess the blast radius of a refactor or detect minor vs major document revisions.
- How can I compare structured data like JSON, YAML, and SQL without false diffs?
- Structured formats like JSON and SQL can look drastically different due to key reordering or line-wrapping differences. For best results with structured files, format and normalize both versions using our JSON Formatter or SQL Formatter before diffing. This aligns keys and syntax structures so the diff engine highlights semantic value changes rather than formatting discrepancies.
- Is my proprietary code or confidential configuration uploaded to any server?
- No. The DevFlow Text Diff Checker runs 100% locally in your browser using pure JavaScript WebAssembly and memory buffers. Your proprietary source code, API keys, credentials, and text files never leave your device and are never sent over the network.
Related Developer Tools
- Git Conflict ResolverVisually resolve Git merge conflicts by picking current, incoming, or both versions.
- Stack Trace AnalyzerParse, format, and analyze error stack traces with root cause isolation.
- XML FormatterFormat, beautify, validate, minify, and convert XML to JSON with syntax highlighting.
- JSON Repair ToolRepair and fix malformed JSON data from AI outputs, API responses, and copy-paste.
- JSON FormatterPrettify, minify, and validate JSON data instantly.
- JSONL ConverterConvert between JSONL (JSON Lines / NDJSON) and standard JSON arrays with auto-detection.
- JSON to C# ClassConvert JSON to C# classes with System.Text.Json or Newtonsoft serialization.
- Regex TesterTest, debug, and explain regular expressions with real-time match highlighting.
- Regex ExplainerBreak down any regex into plain English, token by token.
- Lorem Ipsum GeneratorGenerate placeholder text in multiple formats and styles instantly.
- SQL FormatterFormat, minify, and validate SQL queries with dialect support.
- Markdown PreviewPreview and render Markdown with GFM, math, Mermaid diagrams, and export options.
- Text Case ConverterConvert text between 20+ case formats: camelCase, snake_case, kebab-case, Title Case, and more.
- Env File Parser & ConverterParse, validate, and convert .env files between JSON, YAML, Docker, and Kubernetes formats.
- TOML ConverterConvert between TOML and JSON formats with syntax validation, key sorting, and auto-direction detection.
- YAML ConverterConvert between JSON and YAML with validation, formatting, and multi-document support.