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).
Related Tools
Regex Tester
Test regular expressions online. Live match highlighting, capture groups, and support for JavaScript flags (g, i, m, s, u, y).
Regex Replace
Find and replace text with a regular expression online. Supports every JavaScript flag (g, i, m, s, u, y), all backreferences ($1..$9, $&, $`, $', $<name>), and escape sequences (\n, \t) in the replacement. Live match-by-match preview and diff. 100% local.
Text to Speech
Convert text to spoken audio using your browser's built-in Speech Synthesis API. Pick from all voices installed on your OS, adjust rate, pitch, and volume. No account, no download, no upload — 100% local.
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.