Text Diff Checker
Deterministic unified visual difference inspector for text and source code.
Compare two text blocks or code snippets to inspect additions, deletions, and modifications. Features unified inline view with word-level highlight granularity and patch export.
Use Text Diff Checker
Built for the task, not the page view
- Deterministic Myers O(ND) shortest edit script diff engine
- Word-level and token-level intra-line difference highlighting
- Whitespace, trailing-space, and case sensitivity toggles
- Standard Unified Diff patch generation, copying, and download
- Deliberate CRLF and LF line ending normalization
Original TextModified TextUnified DiffDiff StatisticsUnified Patch (.diff)Use it correctly
Eugene Myers O(ND) shortest edit script algorithm
The engine implements Eugene W. Myers’ classic 1986 difference algorithm ("An O(ND) Difference Algorithm and Its Variations"). By modeling line sequences on an edit graph, it mathematically guarantees the shortest sequence of additions and deletions needed to transform the original text into the modified text. Fast-path common prefix and suffix pruning eliminates identical boundaries in linear time before computing the edit script on divergent chunks.
Intra-line word and token difference highlighting
When lines are modified, standard diffs merely mark the old line as deleted and the new line as added. EveryTools pairs adjacent modified lines and executes a secondary intra-line Myers diff over word and punctuation tokens. Changed words and phrases are highlighted directly within the lines, letting you spot single-word alterations and typo corrections immediately.
Line ending normalization (CRLF vs. LF)
Windows systems terminate lines with carriage return and line feed (CRLF, \r\n), while macOS and Linux systems use single line feed (LF, \n). When sharing files across operating systems, line ending mismatches frequently cause entire files to be flagged as modified. This tool deliberately normalizes CRLF and lone CR line endings to LF before diffing, while detecting and reporting the dominant line ending convention for each document.
Whitespace and trailing space sensitivity
The "Ignore Whitespace" toggle strips all spaces and tabs when generating comparison keys, making it easy to review pure logic changes without syntactic reformatting noise. The "Ignore Trailing Spaces" toggle isolates accidental spacebar and tab padding at the ends of lines while preserving vital code indentation.
Unified diff vs. side-by-side split view
This canonical tool provides the standard unified inline diff format, displaying additions and deletions in a single continuous stream with line markers and context hunks. A synchronized dual-pane workflow is a different comparison mode and is not part of this page.
Confidential document and source code privacy
All text analysis and difference calculations execute strictly in your local browser memory using ECMAScript algorithms. Your compared documents, proprietary source code, and private drafts are never transmitted to an EveryTools transformation API or logged to remote servers. Site analytics only receives fixed UI event identifiers (such as compare, clear, or copy).
Deterministic Myers O(ND) Engine Details
This utility uses Eugene W. Myers’ 1986 shortest edit script (SES) difference algorithm. The algorithm models comparison on an edit graph where diagonal edges represent identical lines and horizontal/vertical edges represent deletions and insertions.
O(N × D) where N is total sequence length and D is the edit distance. For documents with few changes, execution runs in near-linear time.
O(D²) allocation bounded by Int32Array snapshots. Common prefix and suffix pruning reduces active problem size dramatically.
Adjacent modification chunks trigger secondary Myers token diffing, highlighting intra-line additions and deletions.
Lines exceeding 2,500 characters or 350 tokens bypass token diffing safely, guaranteeing responsive browser execution.
Text Diffing & Formatting FAQ
What is the difference between unified diff and side-by-side diff?
A unified diff combines additions, deletions, and context lines into a single vertical stream marked with + and - indicators. This is the format used by Git patches, pull requests, and command-line utilities. A side-by-side diff renders the original and modified documents in two parallel panes with synchronized scrolling, which is helpful for full document comparison. EveryTools offers different review goals. This canonical tool focuses on the unified diff workflow with intra-line word highlighting and patch export; a synchronized dual-pane comparison is not implemented on this page.
How does line ending normalization work between Windows (CRLF) and Unix (LF)?
Windows text files historically terminate lines with carriage return and line feed (CRLF, \r\n), whereas Linux and macOS files use line feed (LF, \n). When collaborating across operating systems, an accidental line ending conversion can make every single line appear modified in a naive diff. When "Normalize Line Endings" is enabled, EveryTools converts CRLF and lone CR to LF prior to computing the edit script, preventing false-positive changes while reporting the detected line ending format for both inputs in the stats bar.
How does the "Ignore Trailing Spaces" toggle differ from "Ignore Whitespace"?
Ignore Whitespace strips all spaces and tabs from the line comparison key, meaning indentation changes and inter-word spacing differences are completely ignored. Ignore Trailing Spaces only trims whitespace characters at the very end of lines, keeping indentation and code blocks intact while ignoring accidental spacebar hits at line ends.
Can I copy or download a standard Git/POSIX unified diff patch?
Yes. Clicking Copy Unified Diff copies a standard POSIX / Git compatible diff patch complete with --- original, +++ modified, and @@ -start,count +start,count @@ hunk headers. Clicking Download .diff downloads the patch as a .patch / .difffile suitable for command-line application using git apply or patch -p1.
Is my confidential source code or text private?
Yes. All diff operations execute strictly inside your local browser tab's JavaScript runtime memory. No text or code entered into this tool is ever transmitted to an EveryTools transformation API or saved to external servers. Site analytics only receives fixed UI event identifiers (such as button clicks) without text contents.