↔️ Utilities

Diff Viewer

Compare two texts side-by-side with line-by-line diff highlighting. Clearly shows additions , deletions and modifications . Works with plain text, JSON, YAML, configs and code.

🅐 Original
🅑 Modified
Tip: Paste JSON or YAML into both sides and format them first using the Format Converter to get a clean structural diff rather than a whitespace-heavy one.
📖 How to Use This Tool
1
Paste original on left, modified on right
2
Diffs highlight: green=added, red=deleted, yellow=changed
3
Toggle Side-by-side or Unified mode
4
Enable Ignore case or Ignore whitespace
📝 Examples
K8s diff
Input: replicas: 2 → 5
Output: Yellow highlight on changed line

Wiring Diffs Into Review Workflows

This viewer is built for pasting two arbitrary blocks of text that don't live in a Git repository — a live API response, a config fetched from a running server, output copied from a support ticket — situations where git diff has nothing to compare against. That makes it a natural companion to, not a replacement for, source-controlled review workflows: use it to spot-check drift between a deployed configuration and what's checked into Git, or to compare two versions of an object pulled from different environments before deciding whether a change needs to be committed at all. Once a difference is confirmed here and needs to become a tracked change, the actual fix still belongs in a pull request reviewed through your normal Git-based process, where the diff is versioned, attributed, and auditable — this tool is for the investigation step before that, not a substitute for it.

Walking Through a Config Drift Diff

Suppose you're investigating config drift on a load balancer. You fetch the live configuration through its API and paste it into the left pane, then paste the version checked into Git on the right. The viewer splits each input into an array of lines and runs a longest-common-subsequence algorithm to find the maximal set of unchanged lines. A line present only in the live config — say timeout: 60 — is marked as deleted, shown in red, while the Git version's timeout: 30 is marked as added, shown in green, directly below it.

Because both lines share the word "timeout:", the viewer's secondary word-level pass highlights only the 60 versus 30 token as changed rather than flagging the entire line, letting you spot the exact value drift in a 200-line config in seconds instead of reading line by line. If the two files instead differed only by an extra blank line inserted near the top, every subsequent line would otherwise misleadingly appear "changed" purely due to the shift — which is exactly why line-based diffing, rather than naive character-position comparison, is the right approach for structured configuration files.

Diffs That Lie: Where Comparisons Go Wrong

How This Relates to git diff and diff -u

The algorithm underneath this viewer is the same longest-common-subsequence approach that powers the Unix diff utility, introduced in 1974, and by extension git diff. The practical difference is scope, not math: git diff and diff -u compare two versions of a file that both exist as identifiable objects — commits, working-tree versions, or files on disk — and output a unified patch format with +/- line prefixes designed to be applied back with patch or reviewed in a terminal. This tool compares two arbitrary pasted blocks that were never files at all, and renders the result as a two-column visual comparison rather than an appliable patch — useful specifically when you want to see a difference, not generate a patch file to apply it.

Diffing Large Files Without Choking the Browser

Line-by-line LCS comparison scales roughly with the product of the two inputs' line counts in the worst case, so pasting two multi-thousand-line files can noticeably slow the comparison down compared to the near-instant result you get on a typical 50-200 line config file. In practice, most DevOps use cases — comparing a Kubernetes manifest, a Terraform plan section, or a load balancer config — stay well within a range where this is imperceptible, since these files rarely run past a few hundred lines. For genuinely large files, such as a multi-megabyte log dump, it's faster and more useful to pre-filter down to the relevant section with grep or a log-search tool before pasting into the diff viewer, rather than asking a browser tab to render a wall of thousands of mostly-identical lines.

Frequently Asked Questions

What diff algorithm does this tool use?

The tool uses a line-by-line comparison algorithm based on the longest-common-subsequence (LCS) approach — the same fundamental algorithm underlying Unix diff and Git's diff engine. It identifies added, deleted, and modified lines between the two inputs. For lines that are present in both texts but with small changes, the viewer applies a secondary word-level diff pass that highlights exactly which tokens within the line were modified, providing precise change identification that is far more useful than just knowing a line changed.

Can I compare Kubernetes YAML files?

Yes. This tool works with any text-based format including YAML, JSON, XML, HCL (Terraform), shell scripts, and plain text. It is particularly useful for comparing before and after versions of Kubernetes manifests — paste the output of kubectl get deployment myapp -o yaml alongside the version from your Git repository to immediately see any configuration drift. The word-level highlighting makes it easy to spot a changed image tag, resource limit value, or environment variable in a lengthy manifest without scanning every line manually.

What is the difference between unified diff and side-by-side diff?

A unified diff (like the output of git diff) shows both old and new content in a single column, using + and - prefixes to indicate additions and deletions — it is compact and works well in terminals and code review systems that render it with colour. A side-by-side diff places the original and modified versions in two parallel columns, making it much easier to visually track which specific lines changed and how, especially in files where edits are scattered across many locations. Side-by-side is generally preferred for reviewing configuration changes, while unified diff is the standard for Git commits and pull requests.