Side-by-Side Diff Viewer Online
View your git diff output in a side-by-side layout with the old version on the left and new version on the right. Paste any unified diff above and switch to Side by Side view mode.
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.
Why use side-by-side diff view?
Side-by-side diff view displays the old and new file versions in parallel columns, making it easier to see exactly what changed at each line. It is the preferred view for code reviews because you can scan corresponding lines horizontally. Inline view is better for small changes or narrow screens, while side-by-side excels for refactoring and multi-line changes.
// JavaScript — render side-by-side diff view
function sideBySide(oldLines, newLines) {
const pairs = [];
let oldIdx = 0, newIdx = 0;
while (oldIdx < oldLines.length || newIdx < newLines.length) {
const oldLine = oldLines[oldIdx] || "";
const newLine = newLines[newIdx] || "";
if (oldLine === newLine) {
pairs.push({ left: oldLine, right: newLine, type: "same" });
oldIdx++; newIdx++;
} else {
if (oldIdx < oldLines.length)
pairs.push({ left: oldLine, right: "", type: "removed" });
if (newIdx < newLines.length)
pairs.push({ left: "", right: newLine, type: "added" });
oldIdx++; newIdx++;
}
}
return pairs;
}How to read a side-by-side diff
In side-by-side view, the left column shows the original file and the right column shows the modified version. Deleted lines appear highlighted in red on the left with an empty slot on the right. Added lines appear highlighted in green on the right with an empty slot on the left. Modified lines show the old version in red (left) and new version in green (right) on the same row.
Frequently Asked Questions
When should I use side-by-side vs inline diff view?
Use side-by-side view for code reviews, refactoring comparisons, and when you need to see old and new versions simultaneously. Use inline view on narrow screens, for small single-line changes, or when you want a compact view of the diff. Most code review tools default to side-by-side for desktop and inline for mobile.
Can I use side-by-side view with any diff format?
This tool accepts unified diff format (the output of git diff). Paste your diff text and select 'Side by Side' from the view dropdown. The viewer automatically pairs deleted and added lines for parallel display. Context lines appear on both sides.
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