Diff

How to Compare Two Files Online (Diff Checker Guide)

By Laxmi SolutionsPublished 2 min read

A diff shows exactly what changed between two versions of a text: which lines were added, removed or edited. It's the fastest way to review a config change, check what a teammate edited, or find why two outputs differ. Here's how to read one, and how to make a diff show only the changes that matter.

Comparing two texts in the browser

  1. Open the diff editor.
  2. Paste the original version on the left and the changed version on the right.
  3. Pick the language so both sides are syntax-highlighted (or keep plain text).
  4. Read the highlighted changes, and jump between them with F7 and Shift+F7.

Both panes stay editable, so you can fix something on either side and watch the diff update as you type. The comparison itself runs in your browser.

Reading a diff

  • Red on the left: lines (or parts of lines) that were removed.
  • Green on the right: lines that were added.
  • A line with both is an edit: the darker highlight inside it marks the exact characters that changed.
  • The +N / −N counts above the panes say how many lines were added and removed in total.

Side-by-side view is easiest for edits within lines. Inline view (one column, removals above additions, like a pull request) suits long files on narrow screens. Switch between them from the toolbar.

Hide changes that don't matter

Re-indented code or trailing spaces can turn a three-line change into a wall of red and green. Two settings cut that noise:

  • Ignore Whitespace treats lines that differ only in leading or trailing whitespace as equal.
  • Format each side first, so differences in formatting style disappear and only real changes remain.
  • Word-level (advanced) diffing finds the changed words inside a line; line-level (legacy) diffing marks whole lines, which is clearer for data files where each line is one record.

Comparing JSON, YAML and config files

Structured files are where diffs help most, and also where formatting gets in the way. Two API responses with the same data can differ in key order and spacing. Format both sides as JSON first, then compare:

{
  "name": "api",
  "replicas": 3,
  "timeoutMs": 5000
}

If only replicas changed, that's now the only highlighted line. Key order still matters to a text diff, so sort keys first when the order isn't meaningful.

Sharing the result as a patch

Copy as Patch copies the difference in unified diff format, the same format git diff prints. You can paste it into a code review, a ticket or a chat, and tools such as git apply can apply it:

--- original
+++ modified
@@ -1,4 +1,4 @@
 {
   "name": "api",
-  "replicas": 2,
+  "replicas": 3,
   "timeoutMs": 5000

Lines starting with - were removed, + added, and a space means unchanged context. The @@ line gives the line numbers in each version.