Compare two source code files — in your browser

To compare two source files, drop both into Diffesq: you get a syntax-highlighted line diff free and unlimited, and a structural comparison that reports which functions, classes, and types changed rather than which lines moved — without uploading either file. The structural comparison is AST-aware: it parses both files and compares declarations by name and nesting, so a reformatting pass reports nothing at all.

Structural parsing covers JavaScript (including JSX), TypeScript, TSX, Python, Go, Java, and shell. Any other source file still gets the free line diff, syntax-highlighted for a much wider set — C and C++, Rust, PHP, SQL, CSS, HTML, YAML, and more.

Compare two source files

How it works

  1. Open the Diffesq workbench and drop a source file on each side.
  2. Diffesq picks a grammar from the file extension and parses both files on your device. The grammars are WebAssembly files served from this site — never a third-party CDN — and your source is never uploaded.
  3. Read the change list: declarations added, removed, or changed, each anchored to its lines in the source, with a changed signature reported separately from a changed body.
  4. Or stay on the text view — side-by-side and unified line diffs with syntax highlighting, free and complete.

What the structural comparison detects

  • Named declarations: functions and generators, classes, methods, fields, and top-level bindings — including the const handler = () => {} shape — plus TypeScript interfaces, type aliases, and enums.
  • A changed signature is reported distinctly from a changed body, so "the parameters moved" and "the implementation changed" never look the same.
  • Reformatting is not a change. Declarations are addressed by name and nesting, never by position, so a Prettier or Black run over the whole file reports nothing — and inserting one function at the top does not mark every function below it as changed.
  • Every degradation is labelled, never silent: minified and generated files are recognised before parsing and compared as text; a file that does not parse cleanly says what share of it was unrecognised; two same-named declarations fall back to the coarser change list rather than anchoring evidence to the wrong one.
  • Anonymous declarations — a default export, an IIFE — have no stable identity across versions, so they are not keyed; named declarations inside them still are.

Free vs Pro

Comparing source files as text is free, unlimited, and complete: the side-by-side and unified line diffs are syntax-highlighted and never truncated. The structural comparison — the AST-aware, declaration-level change list — is the Pro capability, along with unwatermarked exports. On the free tier a source comparison is routed to the text diff rather than served as a partial structural result, so nothing you had before is withheld.

See Pricing for plans — $2.97/month, $27.99/year, or $49 once.

Privacy

Every comparison runs locally in your browser. Your files are never uploaded — there is no server that receives them, and the page keeps working with Wi-Fi turned off. Details in the Privacy Policy.

Frequently asked questions

Which languages get the structural comparison?

JavaScript (including JSX), TypeScript, TSX, Python, Go, Java, and shell — chosen from the file extension. Every other source file compares as syntax-highlighted text, which covers a much wider set including C/C++, Rust, PHP, SQL, CSS, HTML, YAML, and Markdown.

Is comparing code free?

The line diff is free, unlimited, and full-fidelity — that has been true since source files first got syntax highlighting, and it is not being withdrawn. The structural, AST-aware comparison is the Pro capability.

Does reformatting show up as a change?

Not in the structural comparison: declarations are matched by name and nesting, so a whole-file reformat produces no changes. It does show in the line diff, because a line diff can only see lines — which is exactly what the structural view exists to fix.

Can it compare a whole repository?

Folder mode compares two directory trees file by file, reporting added, removed, and changed files in one pass. It is a comparison tool, not a version control system — there are no commits, branches, or merges.

Does it work offline?

Yes — once the page has loaded, parsing, comparing, and rendering all happen on your device. Turn off Wi-Fi and it still works.

Related