Code Diff — Side-by-Side with Syntax Highlighting
Compare two code snippets side-by-side or in unified view, with syntax highlighting for JavaScript, TypeScript, Python, Go, Rust, Java, C#, SQL, CSS, HTML, JSON, YAML, and shell. Ignore whitespace / case options. 100% local.
Last updated:
Comments| 1 | − | function greet(name) { | 1 | + | function greet(name = "world") { |
| 2 | − | if (!name) { | 2 | + | // Default parameter added in ES2015 |
| 3 | − | return "Hello, world"; | 3 | + | return `Hello, ${name}`; |
| 4 | − | } | |||
| 5 | − | return "Hello, " + name; | |||
| 6 | } | 4 | } | ||
| 7 | 5 |
Frequently Asked Questions
How is this different from the plain Text Diff tool?
Text Diff is optimised for arbitrary text (config, logs, notes) with a single-view line diff. Code Diff adds syntax highlighting for 14 languages, a side-by-side view, and options to ignore whitespace / case — so reviewing a refactor or a copy-pasted snippet is easier on the eyes.
Which languages have highlighting?
JavaScript, TypeScript, Python, Go, Rust, Java, C#, SQL, CSS, HTML/XML, JSON, YAML, Shell/Bash, and plain text. The tokenizer identifies keywords, strings, comments, and numbers — enough to make code readable in the diff view.
Can this replace git diff?
For quick two-snippet comparisons — yes. For real code reviews you still want git diff (it understands renames, follows history, integrates with hunks). Use this when the two things you're comparing don't live in a git repo yet (paste from a chat, a PR review email, or a coworker's screen).
Try Next
Regex Tester
Test regular expressions online with live match highlighting, capture-group and named-group output, and every JavaScript flag (g, i, m, s, u, y). Free, no signup, no ads — runs entirely in your browser.
Related Tools
XML Formatter
Format, beautify, and validate XML documents online. Handles namespaces, CDATA sections, and mixed content.
SQL Formatter
Format and beautify SQL queries. Supports SELECT, JOIN, subqueries, CTEs, and multiple SQL dialects.
Case Converter
Convert text between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, Title Case, and more.
Text Diff
Compare two text snippets side-by-side and highlight the differences. Word- and line-level diff, everything runs in your browser.
Word Counter
Count words, characters, sentences, paragraphs, and reading time in any text. Includes a byte-size estimate for storage planning.
Markdown → HTML
Convert Markdown to HTML with a live preview. Supports GitHub Flavored Markdown (tables, task lists, strikethrough, code fences). Free, no signup, runs entirely in your browser.