Line and character-level comparison
Added, removed and changed lines are marked in both panes; changed lines get a second, character-level highlight so a one-word edit is visible inside a long line.
Diff · Format · Validate — offline in your browser
Paste two versions of a text, a JSON document, a YAML file, a CSV table or a SQL query. DiffVault highlights every added, removed and changed line — down to the changed characters — and can hand you a unified patch. The same page formats and minifies JSON, normalises YAML, sorts and re-delimits CSV, reformats SQL, and validates JSON with an optional schema, reporting the exact line and column of each problem. No account, no upload, no server call: the work happens in this tab.
On a narrow screen each pair shows the original line first and the changed line below it.
Paste text into both panes, or load a sample, to see the comparison.
Features
Six things the tool does, all without a server.
Added, removed and changed lines are marked in both panes; changed lines get a second, character-level highlight so a one-word edit is visible inside a long line.
Switch between two aligned panes and a unified stream with @@ hunk headers. Both views come from the same diff, so the counts never disagree.
With semantic mode on, both documents are parsed and re-serialised with sorted keys, so reordered properties or different indentation stop producing false differences.
JSON with 2 or 4 spaces or minified, YAML re-indented and tidied, CSV sorted by column and converted between comma, tab, semicolon and pipe, SQL keywords upper-cased and clauses broken onto their own lines.
JSON syntax errors point at the exact position. Add a JSON Schema to check required fields, types, numeric ranges, string lengths, patterns and array sizes; CSV checks every row against the header column count.
Download the comparison as a .diff patch with standard hunk headers, or copy it and the formatted result to the clipboard in one click.
How it works
The tool is a single page; every step below happens on your device.
Pick Text, JSON, YAML, CSV or SQL. The mode changes the options and the samples, not your data.
Left is the original, right is the changed version, or load a sample pair to see the behaviour first.
Line-level marks appear immediately. Turn on ignore-whitespace, ignore-case or semantic JSON when formatting noise is not the point.
Copy or download the unified patch, or move to the Format and Validate tabs for the same text.
Coverage
One comparison engine, with format-aware extras per mode.
| Mode | Compare | Format / minify | Validate |
|---|---|---|---|
Text | Line and character diff, whitespace and case options | — | — |
JSON | Semantic comparison with sorted keys, or raw text diff | Indent 2, indent 4, minify | Syntax with line/col, JSON Schema: required, type, range, length, pattern, enum, items |
YAML | Line diff that can ignore indentation differences | Re-indent to 2 spaces, tidy colons, list markers and comments | — |
CSV | Row and cell diff | Sort by column (A→Z, Z→A), convert delimiter: comma, tab, semicolon, pipe | Column count per row against the header, unclosed quotes |
SQL | Statement diff | Keyword upper-casing, clause line breaks and indentation | — |
Formatting and validation are deliberately conservative: they tidy presentation and report what they can prove, and they never rewrite string literals or comments.
Under the hood
A longest-common-subsequence pass over lines, then a second pass over tokens inside changed lines.
The first pass compares lines by their longest common subsequence, after trimming the identical prefix and suffix. That produces the three states you see: unchanged, removed, added. A removed line immediately followed by an added line is paired as a change, so edits stay on one row instead of drifting apart.
The second pass looks inside each changed pair. It finds the common prefix and suffix of the two lines, then compares the remaining words and spaces, marking the characters that actually moved. This is why replacing one word in a long sentence highlights that word and not the whole line.
The optional ignore-whitespace and ignore-case settings only change the comparison key, never the text shown. Semantic JSON mode parses both sides and re-serialises them with sorted keys, which removes key order and indentation from the equation.
Questions
No. The diff, the formatters and the validators are JavaScript in this page. There is no fetch call, no XHR and no beacon in the tool; you can confirm it in the network panel of your browser. Only the advertising script in the page head is loaded from outside.
Yes, when semantic mode is on. Both documents are parsed, keys are sorted, and the result is compared as canonical JSON. If either side is not valid JSON the tool says so and falls back to a text diff instead of guessing.
A unified patch: a --- and +++ header, then one or more hunks with @@ -start,count +start,count @@ lines and three lines of context. It is plain text, so it opens in any editor and applies with the usual patch tools. With semantic JSON on, the patch describes the canonicalised documents (keys sorted), not the raw files.
JSON syntax errors come with a line and column from the parser. Schema errors point at the key of the offending value as it appears in your document, and each error also names the path, for example $.customer.age, so a shifted column can never hide the problem.
The page has no server limit; the practical limit is your device's memory. Comparisons above roughly four million line pairs fall back to a simpler alignment and display the first 4,000 rows, with a notice that says so.
The patch is standard unified diff text and can be applied with common tools, but treat the labels a/original and b/changed as placeholders and check the result before committing. The validators are practical checks, not a formal certification.
Honest limits
YAML normalisation re-indents and tidies text; it does not resolve anchors, tags or multi-document streams. SQL formatting is a readable layout of keyword and clause structure, not a dialect-aware parse, so unusual syntax may be spaced oddly.
Required, type, properties, items, enum, minimum, maximum, exclusive bounds, string lengths and pattern are checked. References, conditionals, allOf/anyOf/oneOf and custom formats are not.
Text is pasted or typed. That keeps the tool offline, and it means very large files are better handled by a desktop diff.
A document that passes here can still be rejected by an API with stricter rules, and formatting cannot repair invalid input. Always keep a copy of the original.