📑 Code Diff Viewer
Compare code with syntax highlighting, character-level diffs, and multiple view modes. All client-side.
Last updated: November 8, 2026 · By the BoltQuickTools team
Compare two versions that are not in a repository
A config file copied from a server, a snippet from a chat message and the version on your disk rarely sit in the same Git history. Paste both here and you get a coloured diff without creating a repository or opening an editor.
Steps
- Paste into Original and Modified. Sample Data fills both with a short demo.
- Pick the language from the dropdown. It controls colours only and has no effect on what counts as changed.
- Tick Ignore whitespace or Ignore case if you need them, then click Compare.
- Switch between Side-by-Side, Unified and Inline. Unchanged lines more than three away from a change are folded behind a bar you can click to open.
- Copy Patch copies the result in unified diff form.
Example
Put five lines, const a = 1; through const e = 5;, each ending in a newline, into Original, and the same text with const b = 20; into Modified. The bar reports +1 addition, -1 deletion and 5 unchanged, and Copy Patch gives:
--- original
+++ modified
@@ -1,6 +1,6 @@
const a = 1;
-const b = 2;
+const b = 20;
const c = 3;
const d = 4;
const e = 5;
A changed line counts as one addition and one deletion. Within it, the characters that differ get a brighter highlight.
Things to watch for
- The patch may need a hand edit. A newline at the end of the input is treated as one more, empty, line. That is the sixth line of the hunk above, holding a single space. GNU
patchapplied this example with fuzz, whilegit applyrejected it. Delete that last line and lower both counts in the@@header by one, or make the change in Git if you have it. File names are alwaysoriginalandmodified, and there is no "no newline at end of file" marker. - A final newline is a real difference here.
afollowed by a newline againstaalone reports one deletion. - Options need another Compare. Changing the language or a checkbox does not refresh the result. Switching view does re-run the comparison and uses whatever is in the boxes at that moment.
- Ignore whitespace collapses runs and trims line ends, but does not remove spaces.
a = 1anda=1still count as different. - Ignored lines count as unchanged. Unified, Inline and the patch show only the Original wording of those lines.
- Changed lines are paired by position. If two lines are replaced with three, the first two pairs are compared character by character even when unrelated, so the highlights can look noisy.
- Colours work one line at a time. The middle lines of a multi-line comment or string are coloured as ordinary code.
- Very large, very different inputs can stall the tab. The algorithm keeps a copy of its working array for each edit step, so memory grows quickly with the size of the input and the number of changes. Comparing unrelated files of many thousands of lines is the worst case.
How is this different from the text diff page?
Both compare line by line with the same kind of algorithm. The text diff checker highlights changed words and suits prose. This one adds syntax colours, three layouts and patch output. If you are comparing JSON where key order should not matter, the JSON diff compares structure, which a line diff cannot do.
Why does identical input show no "identical" message?
You get +0 additions, -0 deletions and a single folded bar such as 3 unchanged lines. That is the signal that the two inputs match.
Does my code get uploaded?
The comparison runs in this page's JavaScript, and the tool's code makes no network request with your text. Apart from the tool, the page requests Google web fonts and the site's analytics script, plus ad scripts if you accept them.