Example
Input (left vs right text)
Left: name: yutils version: 0.1.0 Right: name: yutils version: 0.2.0
Output (Unified diff patch)
--- a +++ b @@ -1,2 +1,2 @@ name: yutils -version: 0.1.0 +version: 0.2.0
Note
Standard unified diff — applicable directly with `git apply` or `patch`. The `--- a` / `+++ b` headers are filename placeholders.
Usage / FAQ
When to use
- Produce a git-apply-able patch between two pieces of text
- Ship a quick change as a patch during code review
- Review AI-suggested changes as a unified diff
- Capture cross-environment config differences as a patch
- Keep small DR fixes as a patch file
FAQ
- Q.Can I apply the result with `git apply`?
- A.Yes — it's standard unified diff. Replace the `--- a` / `+++ b` headers with the real file paths before running `git apply patch.diff`.
- Q.Can I adjust the context lines (`-U`)?
- A.Default is 3 lines (the unified default). The option is configurable — larger context reads more naturally, smaller context keeps the patch lean.
- Q.What about binary files?
- A.Text only. Binary files like images need a different tool.
Fun facts
The core algorithm behind Unix `diff` (LCS — Longest Common Subsequence) was developed in 1976 at Bell Labs by James Hunt and Doug McIlroy. McIlroy is also the inventor of the Unix pipe — it's no coincidence that `diff` came out of his lab.
Hunt-McIlroy (1976)In 1986, Eugene Myers published a faster O(ND) algorithm. Most modern diff tools (git diff by default, GNU diffutils) use this algorithm or a variant — 'Myers diff' is effectively the industry standard.
jcoglan — Myers diffThe unified diff format (`+`, `-`, `@@` lines) was added to GNU diff by Wayne Davison in 1990, back when Larry Wall's `patch` (1985) only supported context diffs. It's now the standard for every patch file, git diff, and code review.
Wikipedia — Unified diff
Related tools
- JSON Formatter / Validator
Format, validate, and minify JSON strings. Adjust indent and optionally sort keys. Runs entirely in your browser.
- String Case Converter
Convert strings between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and Title Case — all six cases shown side-by-side.
- Regex Tester
Test JavaScript regular expressions with live match results. Supports g/i/m/s/u/y flags and capture groups.
- Markdown Preview
Render Markdown to HTML side-by-side. Supports CommonMark + GFM (tables, fenced code, task lists). marked is lazy-loaded.
- HTML → Markdown
Convert HTML into Markdown. Headings, lists, links, code, tables, blockquotes. Uses the browser's DOMParser — accurate, 0 dependency.
- YAML ↔ JSON
Convert between YAML and JSON. Tolerates comments and multiline strings on the YAML side. yaml is lazy-loaded.
- Text Diff
Compare two texts and highlight added/removed lines, words, or characters.
- JSON Diff
Compare two JSON values, with optional key sorting and JSON-aware error messages.
- CSV ↔ JSON
Convert between CSV and JSON. Handles quoted fields, custom delimiters, and header rows.
- SQL Formatter
Format SQL queries with proper indentation and keyword casing. Supports PostgreSQL, MySQL, SQLite, and standard dialects.
- XML Formatter
Pretty-print or minify XML with attribute preservation. Handles SOAP, sitemaps, and config files.
- XML ↔ JSON
Convert between XML and JSON with attribute and element handling.
- Smart Paste
Paste any text and get tool recommendations — JSON, JWT, Base64, URL, UUID, Cron, and 9 more types auto-detected.
- Lorem Ipsum
Generate placeholder text in words, sentences, or paragraphs. Classic Lorem Ipsum or randomized.
- JSON Path
Query JSON with JSONPath expressions ($.store.book[*].author etc.) and inspect matches.
- JSON Schema Validator
Validate JSON data against a JSON Schema (Draft 2020-12). Powered by Ajv with format support.
- JSON Schema Generator
Generate a JSON Schema (Draft 2020-12) from a sample JSON. Infer types, required fields, and nested structures automatically.
- HTML Formatter
Beautify or minify HTML with proper indentation, attribute alignment, and configurable wrap.
- CSS Formatter
Beautify or minify CSS with proper indentation. Configurable selector and property style.
- JavaScript Formatter
Beautify or minify JavaScript with brace style and indent options. Powered by js-beautify.
- TOML ↔ JSON
Convert between TOML (Tom's Obvious Minimal Language) and JSON. Used in Cargo.toml, pyproject.toml, etc.
- INI ↔ JSON
Convert INI configuration to JSON and back. Supports sections, comments (; or #), and key=value.
- JSON → TypeScript
Generate TypeScript interfaces from a JSON sample. Nested objects become separate interfaces.
- JS Object → JSON
Convert a JavaScript object literal (unquoted keys, single quotes, trailing commas, comments) into standard JSON. Lenient parser, strict output.
- Slug Generator
Convert text into a URL-safe slug. Configurable separator, lowercase, and accent stripping.
- ASCII Tree
Convert indented text or path list into a box-drawing tree (├── │ └──).
- Mock Data
Generate fake JSON records — names, emails, UUIDs, dates, and more. 0 dependency.
- MongoDB Extended JSON
Convert MongoDB Extended JSON (EJSON) between Canonical and Relaxed forms, or strip BSON wrappers to plain JSON. Recognizes 16 wrapper types ($oid/$date/$numberLong/$numberDecimal/$binary/...).