Instantly compare two text snippets, code files, or JSON payloads line-by-line or word-by-word. Render side-by-side split views, generate standard unified diff patch strings, apply patches onto base text, and inspect edits with 100% browser-local privacy.
| # | Original Text | # | Modified / New Text |
|---|---|---|---|
| 1 | function calculateTotal(items, discount) { | ||
| 2 | var total = 0; | ||
| 3 | for (var i = 0; i < items.length; i++) { | ||
| 4 | total = total + items[i].price; | ||
| 5 | } | ||
| 6 | if (discount) { | ||
| 7 | total = total - (total * discount); | 1 | export function calculateTotal(items: Array<{ price: number }>, discountRate = 0): number { |
| 2 | if (!Array.isArray(items)) { | ||
| 3 | throw new TypeError("Items payload must be a valid array"); | ||
| 8 | } | 4 | } |
| 9 | return total; | 5 | |
| 6 | const subtotal = items.reduce((acc, item) => acc + item.price, 0); | ||
| 7 | const discountAmount = subtotal * Math.min(Math.max(discountRate, 0), 1); | ||
| 8 | |||
| 9 | return Number((subtotal - discountAmount).toFixed(2)); | ||
| 10 | } | 10 | } |
Paste original and modified text or upload files (`.txt`, `.js`, `.json`, `.md`, `.py`). Choose presets to test sample code revisions or config diffs.
Switch between Side-by-Side (Split) view and Unified Diff view. Toggle word/character-level inline diffing or ignore whitespace/casing differences.
Copy generated unified patch text directly, download `.patch` files, or switch to Patch Applier Mode to restore updated text from base files.
Zero network transmission. Proprietary code, draft documents, configuration files, and sensitive text stay 100% inside local browser memory.
Switch seamlessly between two-column split view with line synchronization and unified diff output with standard line numbers.
Compare text at strict line-by-line resolution or deep character/word-level diffing to highlight exact inline edits and typos.
Generate standard unified diff patch strings (`--- Original / +++ Modified`) or apply patch files onto base text to recreate target files.
Toggle options to ignore leading/trailing whitespace, ignore case differences, or strip empty lines for clean comparison.
Drag and drop `.txt`, `.js`, `.json`, `.md`, or `.py` files, or load pre-configured code revision and configuration diff samples.
Our Text Diff & Patch Checker is open source under HiMat Technology. Inspect the Myers diff algorithm, contribute feature enhancements, or star the project on GitHub.
Unlike third-party diff services that send your code or document text to remote servers, HiMat's Text Diff & Patch Checker operates 100% locally in your web browser. Neither your original text, modified code, nor generated patch files leave your device.
Our browser-local diff engine parses two text blocks line-by-line or word-by-word, calculates exact additions, deletions, and unchanged segments using a fast Myers diff algorithm, and renders visual side-by-side or unified diff views in real time.
No. The HiMat Text Diff & Patch Checker operates 100% locally in your web browser. Neither your original text, modified text, nor generated patch files leave your local device.
Yes! In Diff Mode, the tool generates standard unified `.patch` / `.diff` strings compatible with Git and Unix `patch`. In Patch Mode, you can paste a unified patch string onto original base text to reconstruct the updated text.
Yes! You can paste or upload source code in JavaScript, TypeScript, JSON, Python, HTML, CSS, SQL, YAML, and Markdown with syntax-friendly monospace rendering.
Yes, 100% free with no account registration required, no file size caps, and zero advertisements.
HiMat Technology designs and builds custom web applications, SaaS platforms, developer utilities, and AI agent automation systems with clean, maintainable architecture.
Continue with related utilities, services, and guides from HiMat.