How do I view a git diff with syntax highlighting?
Paste unified diff output from git diff and see it rendered with syntax highlighting, line numbers, and color-coded additions/deletions. Switch between inline and side-by-side views. The tool shows per-file stats and a total summary. Collapsible file sections help you focus. Everything runs in your browser.
--- a/config.ts
+++ b/config.ts
@@ -1,3 +1,3 @@
const config = {
- port: 3000,
+ port: 8080,
};config.ts: 1 addition, 1 deletion
const config = {
- port: 3000,
+ port: 8080,
};Git Diff Viewer
Paste unified diff output (from git diff) and view it with syntax highlighting, line numbers, and side-by-side or inline display.
Paste a unified diff above to render it with syntax highlighting and line numbers.
Tips & Best Practices
Side-by-side view is better for small changes, inline for large refactors
Side-by-side (split) view clearly shows character-level differences in modified lines, ideal for code review of small changes. Inline (unified) view is better for understanding the flow of large refactors where lines move between functions.
Whitespace-only changes hide real code changes in diffs
Reformatting indentation or switching tabs to spaces can generate hundreds of diff lines that bury actual logic changes. Use `git diff -w` to ignore whitespace changes, or configure your diff viewer to collapse whitespace-only diffs.
Review diffs file-by-file, not as one massive scroll
A 500-line diff across 20 files is overwhelming as a continuous scroll. Collapsible file sections let you review one file at a time, mark files as reviewed, and focus on the files you know are critical first.
Always diff before committing to catch accidentally staged secrets
`git diff --staged` shows exactly what you're about to commit. Review it for accidentally added .env files, hardcoded tokens, debug credentials, or console.log statements before every commit. This 10-second habit prevents security incidents.
Frequently Asked Questions
How do I read git diff output?
What is the difference between inline and side-by-side diff views?
How do I generate a git diff to paste into the viewer?
Related Inspect Tools
GitHub Actions Validator
Validate GitHub Actions workflow YAML files for syntax, triggers, job structure, step config, needs dependencies, and deprecated actions
Aspect Ratio Calculator
Calculate aspect ratios from any dimensions, resize while preserving proportions, and find equivalent sizes. Device presets for phones, tablets, monitors, and social media
XPath Tester
Test XPath expressions against XML data with real-time evaluation — select elements, filter by attributes, navigate axes, and use XPath functions
SQL Playground
Run SQL queries in your browser with a full SQLite database powered by WebAssembly — practice JOINs, CTEs, window functions, aggregations, and more