Skip to content

Compare / Diff

Compare two files (or a file against its unsaved buffer) and see exactly what changed — line by line and character by character — in a side-by-side view, then merge individual changes across and save the result.

Starting a comparison

Every way to compare lives in the top-level Compare menu:

Command Compares
Compare ▸ Compare Two Files… Two files you pick from disk.
Compare ▸ Compare with Saved The active buffer (your unsaved edits) against the version on disk.
Compare ▸ Compare with File… The active document against a file you pick.
Compare ▸ Compare With ▸ The active document against another open tab — the submenu lists every other open document (a * marks unsaved changes) and compares the live buffers, no saving needed.
Compare ▸ Compare Folders… Two directory trees — provided by the Folder Compare plugin.
OctoEdit --diff a b (command line) Two files, in a standalone viewer window — the git difftool integration.

The editor's file-change notification also offers a Compare button, so you can review an external change before reloading.

Files are decoded by their detected encoding (UTF-8 with or without BOM, UTF-16 LE/BE, or the system ANSI codepage), so non-UTF-8 files compare correctly — and saving a merged side re-encodes to the file's original encoding, BOM included.

Reading the result

The comparison opens in a new tab with the two files side by side, and the two panes scroll together.

  • Added / removed / changed lines get a coloured whole-line background tint plus a matching strip beside the line numbers.
  • A block of two or more lines that was moved (deleted in one place, inserted unchanged in another — reindentation doesn't matter) is shown in blue on both sides instead of plain green/red, so a reshuffle isn't mistaken for an edit.
  • Inside a changed line pair, the exact characters that differ are boxed in a stronger accent colour, so a one-word edit in a long line is obvious at a glance. The highlight snaps to word boundaries where possible.
  • All of these colours follow the active theme and can be customised per theme (see Theme Editor); sensible defaults are built in for light and dark variants.

Very large comparisons (over ~1 MB) compute in the background — the panes appear immediately with a "Comparing…" summary, and the markers land when the diff finishes.

Edit ▸ Copy and Select All (and their shortcuts) act on the pane that currently holds the caret — click into a pane to choose the copy source.

Toolbar controls

Control What it does
↓ Next / ↑ Previous Jump both panes to the next/previous difference (placed about a third down the view). Also Alt+Down / Alt+Up while the compare tab has focus.
Ignore whitespace Treat lines that differ only in spacing as equal.
Ignore case Treat letter-case differences as equal.
Aligned (on by default) Pad the shorter side of each change with blank filler lines so matched regions sit exactly side by side through the whole viewport. The files themselves are never modified.
Swap sides Exchange the two sides (titles, contents, pending copies and all) and re-compare in the other direction.
Save left / Save right Write that side's text back to its file after you have copied changes into it. Enabled only while the side has unsaved copies; hidden for an in-memory side.

A summary shows the number of differences; identical files additionally show a centred "Files are identical" overlay you can't miss.

Overview ruler

The thin column at the right edge shows the whole comparison at a glance — one coloured tick per difference (green added, red removed, amber changed, blue moved), positioned proportionally to its place in the document. Click a tick (or anywhere in the column) to jump straight to the nearest difference.

Merging: copy a change to the other side

Right-click either pane to work with the difference under the click:

Menu item What it does
Copy / Select all The usual clipboard operations for the read-only panes.
Copy change to right Replaces the right side's block of this change with the left side's block.
Copy change to left The same, in the other direction.
Undo copy Reverts the most recent copy (also Ctrl+Z while the compare tab has focus).

Notes:

  • Both directions work no matter which pane of the change you right-click — including the "empty" side of a pure insertion or deletion.
  • Copied lines adopt the target file's line endings, so merging between a CRLF and an LF file never produces a mixed-endings result.
  • After a copy the comparison recomputes immediately; both viewports stay where they were.
  • A side modified by copies shows an enabled Save left/right button; saving writes the file atomically and clears the modified state. Copying into a side that has no file on disk (e.g. the unsaved-buffer side of Compare with Saved) is not possible — there would be nowhere to save it.
  • Closing a compare tab with unsaved copies asks before discarding them.

Restored with your session

A file-to-file comparison is remembered and reopened next launch. A comparison against an unsaved buffer is not restorable (the in-memory side is gone once you quit), and unsaved copies are not persisted — save them first.