FlyText icon FlyText

Compare Two Text Files on Windows

You have two versions of a file and need to see what changed. Here is how to do it with editor features, not folder tools.

A familiar situation: you edited a config last week, someone else edited a copy, and now you need to know exactly what differs. You do not need a heavy suite to answer that. A capable text editor can show two files side by side and highlight the lines that do not match.

This article covers comparing two single text files on Windows: opening them together, aligning changes, and understanding the result. It focuses on the editor's own abilities, not directory-level or three-way merging, which are separate and broader tasks.

Open the two files side by side

The first step is simply to have both files visible at once. Many editors support splitting the window or opening a second pane so the left and right views sit next to each other. Manually scrolling both to the same region already reveals obvious differences in length or structure.

If your editor supports synchronized scrolling, enable it so both panes move together. That keeps corresponding lines aligned as you scan, which is far less error-prone than scrolling each pane by hand and losing your place.

  • Split view: place file A on the left, file B on the right.
  • Sync scroll: if available, lock scrolling so both panes move together.
  • Line numbers: turn them on so you can refer to specific lines when discussing changes.

Line-based diffing

Once both files are open, a diff highlights lines present in one file but not the other, and lines that exist in both but differ. This is a line-level comparison: it tells you which lines changed, not which characters within a line moved. For a first pass that is usually exactly what you need.

A good diff view also lets you jump between changes with a keystroke, so you can review only the regions that differ instead of reading both files in full. That focus is what makes the comparison fast.

View What it shows Use
Side by sidetwo files aligned by linequick visual scan
Unified diffchanged lines in one streamcopy-paste into a report
Inline highlightper-line change markersspot a typo vs a rewrite

This describes general editor diffing behavior; exact markers vary by editor.

Reading the result correctly

A diff is only as meaningful as the inputs. If the two files have different line endings (CRLF versus LF) or trailing whitespace, the comparison may flag many lines as changed when the visible content is identical. Normalize line endings or trim trailing spaces before diffing if you want a clean signal.

Watch also for Unicode normalisation. The same accented character can be stored as a single code point or as a base letter plus a combining mark, and some diff engines treat those as different even though they look identical. When a diff shows spurious changes in text with accents, encoding or normalisation is the likely cause.

Watch out: a single stray space at the end of a line can mark the whole line as changed. Trim whitespace if the noise hides real edits.

Encoding must match

If one file is UTF-8 and the other was saved as Windows-1252 or GBK, the diff may show massive differences that are really just decoding artifacts. Open both with the same encoding first, as described in our encoding guide, so the comparison reflects content rather than byte interpretation.

When a simple compare is enough

For reviewing a changed script, a modified config, or two drafts of notes, a two-file side-by-side view answers the question completely. You see what moved, what was added, and what was removed, and you can copy the needed lines from one pane to the other. This stays within the editor and needs no extra install.

If you find yourself needing to merge changes from both files into one, that is a different job. The basic two-file view tells you what differs; reconciling both directions is where a dedicated merge tool earns its place. For the everyday 'what changed' question, the editor is enough.

For everyday editing that supports this kind of view, see our lightweight Notepad replacement guide and the FlyText overview. Also relevant: lightweight VS Code alternatives.

Try it on your own files

Download the free trial and see how it behaves on real work.

Download More articles

Common questions

How do I compare two text files on Windows?

Open both in a split or side-by-side view in a text editor that supports diffing, then review the highlighted line differences.

Do I need special software to diff two files?

No. Many text editors include a basic two-file diff. You do not need a separate suite for single-file comparison.

Why does my diff show everything as changed?

Often it is mismatched line endings (CRLF vs LF) or trailing whitespace. Normalize those first for a clean result.

Why must both files use the same encoding?

If one is UTF-8 and the other Windows-1252 or GBK, the diff reflects decoding differences, not real content changes.

Is this the same as folder or three-way comparison?

No. This covers comparing two single files. Directory comparison and three-way merge are different, broader tasks.

Keep reading