Runs 100% in your browser — nothing is uploaded
Formatters & Minifiers

Code Diff Viewer

Compare two blocks of code or text line-by-line, word-by-word, or character-by-character.

Code Diff Viewer
Client-side

About this tool

The Code Diff Viewer compares two pieces of text — paste the original in one panel and the modified version in the other — and highlights exactly what changed. Three comparison modes are available: Line (best for comparing whole files or config blocks), Word (best for prose or single-line changes), and Character (best for spotting a single typo or subtle formatting difference).

Added content is highlighted in green, removed content in red with a strikethrough, so you can scan a diff visually without reading a raw patch format. A stats line summarizes the total lines added and removed, computed consistently from a line-level diff regardless of which view mode you're currently looking at — so switching between Word and Character views for closer inspection doesn't change the headline numbers.

A Copy button grabs a standard unified-diff-style text rendering, ready to paste into a commit message, code review comment, or bug report — even if you were viewing the Word or Character mode when you copied it. This tool is useful for comparing two versions of a config file, reviewing a colleague's pasted code snippet against your own, checking what changed between two API responses, or diffing translated strings. Everything runs locally using the same diffing library (Myers diff algorithm) that powers many desktop diff tools — no file is uploaded anywhere.

FAQ

What diff algorithm does this use?
It uses the diff npm package, which implements the Myers diff algorithm — the same general approach used by git diff and most desktop diff tools — to find the minimal set of changes between two texts.
What is the difference between Line, Word, and Character mode?
Line mode treats each line as the unit of comparison — good for config files or code blocks. Word mode compares word-by-word, ideal for prose or a single changed line. Character mode compares individual characters, useful for spotting a single-letter typo.
Why do the "lines added/removed" stats stay the same when I switch modes?
The stats are always computed from a line-level diff internally, independent of which view mode you're looking at. Switching to Word or Character mode is purely a visual zoom-in for the same underlying change.
What format does the Copy button produce?
It copies a unified-diff-style plain text rendering, with unchanged lines prefixed by a space, added lines prefixed by +, and removed lines prefixed by -, computed from the line-level diff.
Is there a size limit on what I can compare?
No hard limit is enforced, but very large inputs (tens of thousands of lines) may take longer to diff and render, since the entire comparison and highlighting happens in your browser tab.