Skip to content

Code Diff

A code diff tool shows which lines were added, removed, or left unchanged between an original paste and a changed paste. This page runs a line-oriented longest-common-subsequence (LCS) compare entirely in your browser. Nothing is uploaded or written to localStorage. It is not a git binary diff, not a three-way merge, and not a remote compare API.

Updated

Paste the original text on the left and the changed text on the right — or press Load example. The tab computes a line-oriented LCS diff and lists added (green), removed (red), and unchanged lines with old/new line numbers. Copy exports a unified +/- view. Closing the tab clears both panes; nothing is uploaded or written to localStorage.

The algorithm matches whole lines (after normalizing CRLF to LF). It is not Myers/git binary packing, not a character-level highlight inside a line, and not a claim that the result matches `git diff` hunk headers. For huge multi-megabyte dumps, prefer a local CLI diff — this page is for typical snippets and config-sized pastes.

Code Diff workspace

Line diff

Paste the original (left) text or code. Diff runs in this tab — nothing is uploaded.

Paste the changed (right) text or code. Line-oriented LCS; not a git binary diff.

Diff result

Paste original and changed text above, or press Load example. Added lines are green, removed lines are red, unchanged lines stay neutral.

Line-oriented LCS only — not a git binary diff, not a merge tool, and not a remote compare API. Closing the tab clears both panes; nothing is written to localStorage.

How does the Code Diff work?

  1. 1. Paste original and changed

    Put the older version in Original and the newer version in Changed. Load example fills a small fictional JavaScript sample.

  2. 2. Diff locally

    The tab runs a line-oriented LCS compare. Nothing is uploaded and no remote compare API is called.

  3. 3. Read added / removed / unchanged

    Green lines were added, red lines were removed, neutral lines match. Old and new line numbers sit beside each row.

  4. 4. Copy the unified view

    Copy exports a +/- unified text of the same result. Closing the tab drops both panes. Need formatting instead? Use JavaScript Formatter or CSS Formatter on this hub.

Questions about Code Diff

What does this Code Diff tool do?
It compares an original paste with a changed paste using a line-oriented longest-common-subsequence (LCS) algorithm. You see added, removed, and unchanged lines with old/new numbers, and you can copy a unified +/- view. Everything runs in your browser — no signup and no upload.
Does it upload my code?
No. Diffing is pure in-page JavaScript. There is no account, no server-side compare API, and no file upload. Pastes stay in this tab until you clear them or close the page. We do not write source text to localStorage or send it to a remote diff service.
Is this the same as git diff?
No. This page uses a simple line-oriented LCS for readable side-by-side results. It does not emit git hunk headers, does not handle binary files, and does not run three-way merges. For repository history, use git locally; this tool is for quick paste compares.
Why is there no /code-diff-checker/ or /diff-checker/ second URL?
One canonical address with a trailing slash: /developer/code-diff/. Queries like "code compare", "file diff", or "code compare online" can land here. We do not publish stub alias slugs that would split the address people and search engines should share, and we do not leave empty checker URLs that 404.
Does it highlight character changes inside a line?
v1 is line-oriented: if any character on a line changes, the whole line is treated as removed on the left and added on the right. Intra-line character highlighting may ship later without a second URL. Whitespace-only changes still count as different lines.
How is this different from JavaScript Formatter on this hub?
JavaScript Formatter pretty-prints or minifies one JavaScript paste. Code Diff compares two pastes and shows what changed. They share the same privacy rule (local only) but solve different jobs — this page does not format JS, and JavaScript Formatter does not diff two versions.
Can it handle very large files?
The page is meant for typical snippets and config-sized pastes. Multi-megabyte dumps can strain browser memory because the LCS table grows with line counts. There is no upload size limit, because nothing is uploaded — the limit is your browser's memory and responsiveness. For huge files, prefer a local CLI diff.
Is anything stored in localStorage?
No. Original and changed text live in React state for this tab only. Closing the tab clears them, and we do not mirror pastes into localStorage or cookies. Hosting logs may show that you requested the page URL, not the code you typed.

These tools run in your browser. Page Utils does not store, upload, or write to localStorage the keys, tokens, or text you paste. Results are a convenience aid, not legal, tax, or security advice.