Diff Viewer

UtiliStudio Workspace Tool

Spot differences between text files, configuration snippets, and structured payloads. Features side-by-side split view, intra-line highlighting, and JSON normalization.

Compare text, code, and JSON structures directly in your browser
Open in full workspace
Loading Diff Viewer…

Key Capabilities

Side-by-Side & Unified Comparison

Compare documents using a dual-pane split layout for visual alignment or switch to a unified diff view for compact code reviews.

Intra-Line Word Highlighting

Pinpoint character and word modifications within modified lines using granular Myers LCS difference analysis.

JSON & XML Semantic Normalizers

Sort JSON object keys alphabetically and normalize XML attribute ordering to avoid false difference positives caused by whitespace.

Change Region Navigation

Jump seamlessly between added, modified, and removed chunks with detailed statistics on total insertions and deletions.

How to Use Diff Viewer

1

Paste original and modified text

Enter your base document into the left pane and the modified version into the right pane.

2

Select comparison mode & options

Toggle between side-by-side and unified views, and configure whitespace or case sensitivity rules.

3

Review highlighted differences

Examine added green lines, removed red lines, and specific intra-line word changes.

4

Navigate changes & export

Use chunk navigation controls to step through edits and inspect summary insertion and deletion tallies.

Practical Examples

Comparing JSON Configuration Files

Detect added environment variables, modified port settings, and removed deprecated properties between releases.

Input (Raw / Unformatted)
Original:
{
  "service": "billing",
  "port": 3000,
  "debug": true
}

Modified:
{
  "service": "billing",
  "port": 8080,
  "ssl": true
}
Output (Formatted & Indented)
Diff Summary:
- Modified: "port": 3000 → 8080
- Removed: "debug": true
+ Added: "ssl": true

Diff Viewer Guide

What a diff shows

A diff describes the smallest practical set of changes that turns one text into another: which lines were removed, which were added, and which stayed the same. Comparing two versions by eye works for a handful of lines but quickly becomes unreliable, while a diff highlights every change, including a single changed character in a long configuration file.

Diffs are at the heart of version control. Every Git commit, pull request review, and patch file is a diff. The same technique is useful well outside code: comparing contract revisions, API responses from two environments, or exported settings before and after an upgrade.

How diff algorithms work

Most diff tools are built on the idea of a longest common subsequence: find the longest sequence of lines that appears in both texts in the same order, then report everything else as insertions or deletions. Eugene Myers published an efficient algorithm for this in 1986, and it remains the default in Git and many other tools because it finds a minimal edit script quickly for typical inputs.

A minimal diff is not always the most readable one. When code blocks are moved or many lines are similar, such as closing braces, the algorithm can align the wrong lines. Variants such as patience diff and histogram diff first anchor on lines that are unique in both files, which often produces output that matches how a person thinks about the change.

Side-by-side, unified, and intra-line views

A side-by-side view places the original and modified text in two columns with matching lines aligned, which is the easiest way to review changes in context. A unified view merges both versions into one column, marking removed lines with a minus and added lines with a plus. It is the format of patch files and of git diff output, and it is more compact for long files.

Line-level diffs only tell you that a line changed. Intra-line highlighting goes a step further and marks the exact words or characters that differ within a changed line. This is invaluable when a long line differs by one value, such as a port number or a feature flag.

Reducing noise in comparisons

Many differences are not meaningful. Trailing whitespace, changed indentation, Windows versus Unix line endings, and letter case can make two equivalent files look completely different. Options that ignore whitespace or case let the real changes stand out.

Structured formats need special care. Two JSON documents can contain identical data while differing in key order and formatting, so a plain text diff reports changes on almost every line. Normalizing both sides first, by parsing and re-serializing them with sorted keys and consistent indentation, reduces the diff to genuine differences in values. The same applies to XML attribute order and formatting.

When reviewing a long diff, navigate change by change rather than scrolling, and read deletions as carefully as additions. Removed lines are where accidental regressions most often hide.

Practical comparison workflows

Comparing configuration across environments is one of the most valuable uses of a diff. Export the settings from staging and production, normalize their format, and compare them before a release: missing feature flags, different timeouts, and outdated endpoints show up immediately.

For API work, capture the response of the same request before and after a change and compare them to see exactly which fields were added, removed, or changed. For documents, compare drafts to review an editor's changes or to confirm that only the intended clauses of an agreement were modified. In each case, removing irrelevant differences such as timestamps or request IDs first keeps attention on the changes that matter.

Common Use Cases

Code & Pull Request Review

Inspect diffs between local working files and upstream branches before submitting commits or pull requests.

Configuration Auditing

Detect inadvertent parameter alterations between development, staging, and production environment configs.

API Payload Comparison

Compare actual API responses against expected fixtures to verify payload shape fidelity.

Copy & Content Revisions

Track editorial additions, deletions, and phrasing adjustments between draft iterations of technical articles.

Frequently Asked Questions

Which diff algorithms does the engine use?

The comparator uses a pure TypeScript implementation of the Myers Longest Common Subsequence (LCS) algorithm to produce concise line and intra-line word diffs.

Can I normalize JSON payloads before comparing?

Yes. Enabling the JSON Normalizer formats and sorts object keys alphabetically so that harmless property reordering does not register as differences.

How does Diff Viewer highlight intra-line edits?

The comparator performs line-level diffing and then computes character- and word-level edits within modified lines, highlighting specific token insertions and deletions.

Related Guides

Related Developer Tools

Ready to use Diff Viewer?

The tool is at the top of this page, or open it in the full workspace with tabs, favorites, and Ctrl+K search.