This topic describes how to use the WinMerge File Compare window to compare and merge text files. To understand the basic concepts about differences discussed here, we suggest you read Overview of file comparing and merging first. See Comparing in hexadecimal format for related information about hex files.
You can start a file compare operation from either the WinMerge window or a Command Prompt window.
Click → . Use the Select Files or Folders dialog to specify the left and right source files to compare. For more details about the Select Files or Folder dialog, see Opening files and folders.
Run WinMergeU.exe, which is in your WinMerge install directory. In your command arguments, include the left and right files to compare. For more information about using the command line, see Command line.
The File Compare window displays compared files in two File panes, side by side. The WinMerge toolbar and context menu provides functions for viewing, navigating, and merging differences. The screenshot below shows a comparison of two versions of a file.

The left and right File panes show the text contents and differences of the two files being compared. The File panes are the main area for navigating and merging differences, and also allow you to edit the text directly. This section describes the features that support these actions, and ways that you can customize the File panes.
The header at the top of each File pane shows the full path of the source file. The left and right file names are also identified in the header of the Compare Window, above the File panes.
One of the File panes is always active (indicated by the dark header background); the other is inactive and has a lighter header bar. You can edit only in the active pane (as described in File pane editing features). Click in either side to make it active and make the other side inactive.
An asterisk (*) before the filename in the header indicates that there are unsaved changes in the file.
The header bar's context menu has shortcuts that are useful for copying and pasting file information:
WinMerge highlights several types of differences in the File panes. The Colors page in the Options dialog defines a set of background and text colors for most difference types, with variations indicating their state: unselected, selected, or deleted. This section describes how each of the basic difference types is detected and displayed.
A difference block contains one or more contiguous lines that are different. The default difference background color is gold, but blank lines are marked with the deleted color.
For this and other screens in this section, we enabled
View line numbers to show which lines in the
source files are compared.

This comparison detects three difference blocks:
The first difference is a single line.
The blank line in file2 has no
corresponding blank line in file1.
WinMerge treats the missing blank line as a deleted
difference, marked here with the default gray color.
The last difference block includes two lines.
This color marks content that you have configured WinMerge to ignore. In contrast to difference blocks, ignored content is not compared, it is simply highlighted to help you see what has been ignored. Ignored differences include:
Blank lines, if you have enabled Ignore blank
lines in the Options dialog Compare page.
Differences that match patterns in line filters that you have defined (see Using Filters to learn how).
The next example repeats the previous comparison, this time
with Ignore blank lines enabled. There are now
only two differences. The blank line on the right side is marked
with the Ignored Differences color.

Moved differences are identical lines found in different
locations in the compared files, if Moved block
detection is enabled in the Options dialog Compare page.
The next screenshot repeats the previous comparison, this time
with moved block detection enabled.

Notice that the two identical lines (containing
a and c) that are in
different locations are marked with the default orange moved
color. Another effect of moved block detection in this case is
that the last two lines are now two separate differences instead
of a single difference block.
In some cases, showing moved differences can make it easier to visualize changes in files. However, too many moved lines might make your comparison hard to navigate. Use your own judgement!
WinMerge can mark the text that is changed with difference blocks. Line differences are marked with the word difference color. See Line difference highlighting for details.
WinMerge tries to align similar lines within difference
blocks when you enable Align similar lines in the
Options dialog Compare page. What does “similar”
mean? Generally, this feature works best in simple cases, for
example where lines that have strong similarities. When detected,
similar lines are adjusted to align in the File pane. The next
figure shows comparisons of the same two files, before and after
enabling the Align similar lines option:
Disabled:
|
Enabled:
|
In the second comparison, the lines “mice” and “mice and a” are detected as similar. WinMerge adds blank lines in the display to make these lines appear at the same level within the difference block.
Sometimes it's useful to highlight not just difference blocks, but also the text within them that is changed. You can disable or enable them in two ways:
Set all View line differences options in the
Options dialog Editor page.
Click → to toggle line differences on or off.
Remember that WinMerge navigation and merging functions (like Next Difference or Copy Left) work on difference blocks, not on line differences within them.
This section describes how line differences are detected and marked. Note that the effect of these options is also affected by your current whitespace settings in the Options dialog Compare page.
The following examples show how word-level line differences are displayed with each of the whitespace settings:
Example 1. Line differences with Whitespace: Compare
WinMerge detects all different words and spaces:

Example 2. Line differences with Whitespace: Ignore change
Multiple spaces and tabs are treated the same as a single space. In the example, the extra space between the last two words is not marked:

Example 3. Line differences with Whitespace: Ignoring all
No spaces between words are compared, so these lines are treated as identical:

A character-level line difference includes the first and last different characters in a word, and all the characters between them. A single character-level difference can span adjacent words. The following example illustrates:

As with word-level line differences, character
highlighting varies according to how WinMerge is configured to
detect word breaks. In the example, the extra space after the
word cure in file2 is
highlighted only if whitespace is compared.
Words and characters in line differences can be separated by whitespace, or by a combination of whitespace and punctuation. Whitespace (the default) is the typical choice for comparing most text files. All the preceding line difference examples use whitespace to break words and characters.
In some cases it's useful to break at punctuation. For
example, the next screenshot compares a comma-separated list. To
highlight meaningful line differences, we have enabled
Break at whitespace or punctuation in the Options
dialog Editor page.

Although WinMerge is a not a full-featured editor or IDE, it does provide basic editing functions, like Undo and Redo, Find and Replace, and Go to. These basic editing tasks are often needed during merging (for example, to change text within differences). You can edit in the active File pane (remember, click in a pane to make it active). Changes are not written to a file until you save a pane to a result file.
WinMerge editing features also include syntax highlighting. This optional feature supports several file formats, and you can configure the colors used. Note that syntax highlighting is not applied within differences, as the preceding screenshot shows.
Make sure that Automatic rescan is enabled, as described in Rescanning files. If it is not, manually refresh your view (press F5) before and after editing a file, to ensure that WinMerge difference detection is up to date.
You can choose fonts for the File pane by clicking → . WinMerge supports only fixed width fonts.
Here are font suggestions for using WinMerge with East Asian languages:
The File panes have optional gray margins that show line numbers and some symbols. To show or hide the margins, clicking → . If you are using multiple File Compare windows, you can control margins for each window independently. The margin can show any or all of these features:
Line numbers, if → is enabled.
Bookmarks, if → is enabled. A bookmark is a blue circle, in the margin next to a line, that you can make WinMerge remember and return to.
To set a bookmark on a line, double-click in its margin (or press Ctrl+F2). The same action deletes an existing bookmark.
To navigate bookmarks, click → and choose or .
Double-click a single bookmark to delete it (or press Ctrl+F2).
Click → → to delete all bookmarks.
Word wrap arrow symbols, if → is enabled.
The following screenshot shows a margin with bookmarks and word wrap enabled. Without line numbers, the margin width is minimal.

The next screenshot shows a margin with bookmarks and line numbers enabled. Notice that the margin is wider. In fact, the margin is wide enough for the largest line number. Thus, the margins for large files with many lines can be quite wide.

The WinMerge toolbar and menus provide a range of functions to navigate, select, and merge differences within files.
WinMerge shortcuts have the same names and buttons whether you open a Folder Compare or File Compare window. However, the functions behave differently: with a File Compare window, the functions operate on differences within files, not on differences within folders.
The difference functions you can use depend on your context, which often changes as you work. This means that a function is available only when its operation is possible for a given location or other condition in your WinMerge environment. For example, if you click in a line of text within a difference, you might notice several navigation and merge buttons become enabled in the toolbar. If you click in another area of text that is not within a difference, these functions become unavailable.
Difference functions are available in the WinMerge toolbar,and also through these alternate mechanisms:
WinMerge menus, especially
Context menus within the File Compare window (when you right-click in text)
Keyboard shortcuts
Difference functions are described in Navigating differences and Merging differences, later in this topic. Quick start and Overview of file comparing and merging provide examples of comparing and merging.
→ (or press F9) restores these WinMerge 1.7.1 single keyboard shortcuts for difference merging and navigating functions:
Up and Down keys for the
Previous Difference and Next
Difference functions.
Copy Left and Copy
Right functions.Merge mode omits the Alt key for these common operations (making them quicker to use than the normal mode). Note that the Shift and Alt Arrow key combinations work in merge mode in the same way as normal mode.
Merge mode is indicated in the status bar by the text Merge.
When you compare three text files and specify a merge output path
(for example, when a version control tool starts WinMerge with the
/o command-line option), the Merge Result pane opens at
the bottom of the File Compare window. It works like the merge output
window in KDiff3: the three File panes show the compared files
read-only, and the Merge Result pane contains the merge result, which
you can edit freely. This requires the Merge Result pane option to be
enabled in the Compare/Merge page of the Options dialog.
When you open a two-way conflict file with → , WinMerge keeps the two source panes side by side and opens the Merge Result pane when it is enabled. Each differing block starts unresolved because a two-way conflict file has no common base. Choose the left or right source to resolve a block. In this mode the toolbar buttons are numbered and , and Ctrl+Shift+1 and Ctrl+Shift+2 choose the left and right source, respectively. Unresolved blocks are saved using the standard two-sided conflict markers.
When the pane opens, every difference initially starts
unresolved, shown as a compact
<Merge Conflict> or
<Unresolved Difference>
placeholder line.
If an automatic merge is requested — with the
/al, /am or /ar
command-line option, or with the command — non-conflicting differences are resolved
automatically according to the selected merge target, and only true
conflicts, where both sides changed the same lines relative to the base,
remain unresolved.
To resolve a difference, select it and choose the desired source from
the top-level menu. Two-way merge
sessions offer and
; three-way sessions also offer
. You can also use the Merge
Result pane context
menu, or the / /
toolbar buttons. Each command toggles that
pane's lines for the current difference (or all differences covered
by the current selection): selecting several panes
combines their lines in the order you select them (useful when both
sides added something and the merge should keep both), and deselecting
all panes makes the difference unresolved again. You can also type
corrections directly into the Merge Result pane, except on unresolved
differences: those must be resolved with a Choose command before
their text can be edited. Conflicts whose sides differ only in white
space are marked as
(Whitespace only).
The pane's margin shows where every line came from:
1, 2
or 3 for a line taken from the left,
middle or right pane (matching the toolbar buttons),
? for an unresolved conflict section, and
m for a difference modified by hand.
The pane's status bar shows how many differences are still unresolved.
While the pane is open, and
(Alt+Shift+Down /
Alt+Shift+Up)
jump to the next or previous difference that still needs a decision,
skipping the ones already resolved.
Use → → , the Save toolbar button, or
Ctrl+S
to save the result to the output path. WinMerge warns if unresolved
differences remain. Unresolved conflicts are saved as standard
conflict sections — never as placeholder text — so the file keeps all
versions of the disputed lines and can be finished later in any
editor or merge tool; unresolved non-conflicting differences are
saved with their automatic merge content, keeping the output free of
conflict markers that no version control system would produce.
Reopening the output path itself does not resume from these conflict
sections: WinMerge always rebuilds the merge result from the three
compared files, so a version control tool that starts WinMerge again
with the /o command-line option (for example
git mergetool) gets a fresh merge every time,
regardless of what the output file already contains. To pick up an
earlier, partially resolved conflict file instead, use
→ : WinMerge parses its conflict sections
and restores them as unresolved differences, keeping any text that was
already resolved. WinMerge also prompts about an unsaved merge result
when the window is closed — also when the pane itself has been hidden
in the meantime. By default every line is saved with its own original
line ending, so the output differs from the sources as little as
possible (for example, producing minimal diffs in version control);
you can change the output line endings to Windows, Unix, or classic
Mac style from the Merge Result pane's status bar. The encoding
follows the side that changed it, and the save honors the backup-file
option and any file packer plugin the files were opened with.
You can also start a merge in any three-way text comparison with → (differences start unresolved) or → (non-conflicting differences are resolved automatically). While a merge session is active, you can show and hide the pane with → . To end the merge session and restore the normal editable three-pane behavior, choose → . WinMerge prompts to save if the merge result has unsaved changes, and restores the panes' original read-only states and headers.
The base pane (common ancestor) for automatic merge resolution is determined by either command-line options or the keyboard focus:
When using command-line options:
Merge to left pane (/al):
left = merge target, middle = theirs, right = base
Merge to middle pane (/am):
left = theirs, middle = merge target, right = mine
Merge to right pane (/ar):
left = base, middle = theirs, right = merge target
When using UI-based merge operations (Start Merge Session or Auto Merge): The base pane is determined by the current keyboard focus:
Left pane focused: left = mine, middle = theirs, right = base
Middle pane focused: left = theirs, middle = base, right = mine
Right pane focused: left = base, middle = theirs, right = mine
The Location pane, to the left of the File panes, maps the entire length of the compared files into two vertical bars (corresponding to the left and right File panes). It is especially useful for working with files that are too long to easily navigate in the File panes.
The Location pane shows several kinds of items:
Each difference block in the File panes is indicated in the Location pane by a horizontal line across each vertical bar. The thickness, color , and locations of these lines are clues about of the size (number of lines), types and distribution of all differences in the files. For example, the color of a line is the same as the color of the corresponding difference block. The Location pane in the preceding screenshot shows many basic differences (gold) and some empty difference blocks (gray).
If you have selected a difference, the Location pane marks the current difference line with a pair of small triangles on either side of the vertical bars. If you navigate to another difference, the pointer moves up or down with the location. Scrolling the File pane does not change the location of the difference pointer (or any of the difference lines) in the location pane.
The area of the files currently visible in the File panes is indicated by a shaded (translucent) view bar over the Location pane. The area bar's height and location correspond to the portion of the files that is visible in the scroll region. For example, you might see the bar expand or shrink if you change the height of your File panes. This synchronization of the Location pane view bar and File panes enables quick navigation, and some useful actions:
When you scroll the File panes, the view area in the Location pane moves with it.
Conversely, you can drag the view area bar in the Location pane up or down to scroll the File panes. This scrollbar thumb action is very handy for navigating long files.
Click anywhere in the Location pane to jump to the corresponding location in the File panes.
Moved differences are identical lines in different locations. They are shown only if the Enable moved block detection is checked in the Options dialog Compare page. See Difference highlighting for more details about moved differences in the File pane. The Location pane draws a line connecting moved differences in the left and right location bars. For example:

The Location pane's context menu contains these shortcuts:
: Moves the cursor to the top of the file.
: Moves the cursor to a line you specify (described in Navigation functions).
: Turns off moved difference color for moved blocks.
: Turns on moved difference color for all moved blocks.
: Turns on moved difference color only for current selected moved difference.
The Diff pane shows the contents of the two sides of a selected difference.
When you select a difference, the two versions are loaded in the upper and lower sides of the Diff pane. In this way, the Diff pane confirms which lines are included in a difference, and lets you examine them in isolation from the rest of the file.
You can merge differences directly in the Diff pane by right-clicking in either the top or bottom side and choosing or .
Each File pane contains a status bar at the bottom. The status bar contains several panes with different types of information about the document and your location in it:
Ln: Line number in the source file.
Col: Column location of the cursor and the total number of columns in the line.
Col counts tabs as
n spaces, where
n is the number of characters defined
as the Tab size in the Editor page of
WinMerge options (4 by default).
Ch: Character location of cursor and the total number of chars in the line.
Ch counts tabs as single tab characters.
EOL: Linefeed style of the current line (shown only when the Preserve original EOL option is enabled in the Editor page of WinMerge options).
RO is shown in the pane if the file is set to read-only (as described in Protecting files). Otherwise the pane is empty.
Codepage number for ANSI files, Unicode encoding type for Unicode files.
EOL style of the file: Win for Windows/DOS files (CRLF), Unix (LF), Mac (CR), or Mixed.
When the per-line EOL style is used, the file EOL style is not shown (this pane is blank).
When a File Compare window is open, the WinMerge window status bar shows one of these messages about the compared files:
Identical: The files contain no differences
n Differences
Found: The number of differences detected, displayed only
when no difference is selected.
Difference x of
n: The selected difference's
sequence number in the total number of differences, starting with
1.
This section describes how to navigate and select differences in the File Compare window. Note that when you select a difference, it is always selected in both or all three File panes.
To save time, enable Automatically scroll to first difference in the General page of WinMerge options. Then you don't have to manually navigate to the first difference and select it.
Here are the functions for navigating differences in the File Compare window, and their shortcuts in the toolbar and menus:
Enabled if you have clicked in (or selected) text within a difference in a File pane. Selects the word differences within the line. For example:

If you want to select the difference block itself, use Current Difference instead.
Shortcuts:
button, → , F4, context menu in File pane
within a difference.
Selects the next difference below your current cursor location in the document (not necessarily relative to the current difference). Use to step through differences sequentially from any point. Available except when the last difference is currently selected.
Shortcuts:
button, → , Alt+Down (or Down in merge mode).
Selects the previous difference above your current cursor location (not necessarily relative to the current difference). Use to step backwards sequentially through differences. Available except when the first difference is currently selected.
Shortcuts:
button, → , Alt+Up (or Up in merge mode).
Use this to begin comparing or merging differences, or to locate the first difference from any other location. Available except when the first difference is currently selected. You can also select a difference by double-clicking its text.
Shortcuts:
button, → , Alt+Home.
This function has two modes of action:
Shortcuts:
button, → , Alt+Enter.
Enabled except when the last difference is currently selected.
Shortcuts:
button, → , Alt+End.
Enables you to jump to either a line number or a difference number (for example, difference 2 is the second difference). Opens the Go to dialog, where you specify the number, which file to use (either the left or right), and the type of location (either line or difference).
The Go to line number can be useful when you need to merge the same change from one file to several target files. Jumping to a particular difference can be quicker than using to search text, or stepping through differences.
Shortcuts: → , Ctrl+G, context menu in File pane and Location pane.
Enables to jump to the moved from/to of current diff on the other panel (2 panes).
Shortcuts: Ctrl+Shift+G, context menu in File pane and Diff pane.
Enables to jump to the moved from/to of current diff on the other panel (3 panes).
Shortcuts: Ctrl+Shift+G, context menu in File pane and Diff pane.
Enables to jump to the moved from/to of current diff on the other panel (3 panes).
Shortcuts: Ctrl+Alt+G, context menu in File pane and Diff pane.
See Merge functions.
Merging copies differences from one File pane to the other: either left to right, or right to left. This is different from directly editing text using WinMerge's editing functions (described earlier in this topic).
By default, the Automatic rescan option is enabled in the Editor page of WinMerge options. Rescanning keeps your compare and merge operations up to date. Without rescanning, WinMerge differences does not detect changes that might occur to files while you are comparing them, for example in an external editor.
Rescanning occurs when you perform certain actions (like merging a difference or editing a file) during a file compare. If a file has changed, WinMerge displays a dialog advising you that another application has updated the file, and asks whether you want to reload the file.
Click to reload the file before proceeding, or to ignore the changes and work with the earlier loaded version of the file.
If Automatic rescan is disabled, or if you
suspect that a file might have changed, we strongly advise that you run
before
performing any merge operation: click → or the
toolbar button, or press
F5.
If a merge result looks incorrect, click → or press Ctrl+Z to undo the merge. Then rescan the files and try merging again.
The merging functions can implicitly select differences based on a cursor location or text selection. For example, if you click anywhere in a difference and then click the toolbar button, the entire difference block is merged. This makes it easy to merge many small differences. Similarly, if you select text that spans all or part of multiple differences, all the included differences are merged with a single merge command.
If the result of a merge operation is not what you expected, you can click to reverse the operation.
Here are the merge functions and their shortcuts in the toolbar and menus:
Copies one or more difference from left to right. Note that differences do not need to be fully selected: At its simplest, this means replacing text in the target difference with text in source difference. But because differences can also contain empty lines, new lines may be created or removed.
Shortcuts:
button, → , Alt+Right (or Right in merge mode), context
menu in File pane within a difference, and in Diff pane.
Copies the current difference from the right to the left File pane. See Copy Right description for details.
Shortcuts:
button, → , Alt+Left (or Left in merge mode), context menu
in File pane within a difference, and in Diff pane.
Merges the current difference from the right to the left File pane, then selects the next difference (if one exists). Equivalent to Copy Right and Next Difference in one step.
Shortcuts:
button, → , Ctrl+Alt+Right, context menu in File pane within a difference.
Merges the current difference from left to right, then selects the next difference (if one exists). Equivalent to Copy Left and Next Difference in one step.
Shortcuts:
button, → , Ctrl+Alt+Left, context menu in File pane within a difference.
Copies all differences from the left to the right File pane.
Use to synchronize two files with one command. Similarly, you can
back out the entire merge by clicking the
Undo or pressing Ctrl+Z.
Shortcuts:
button, → , Alt+Left, context menu in File pane within a difference.
Copies all differences from the right to the left File pane. Effectively, replaces the content of the left File pane. See similar to All Right.
Shortcuts:
button, → , Alt+Left, context menu in File pane within a difference.
Rescans files to update differences. Use after changes are made to files, if automatic scanning is disabled (see Rescanning files for details).
Shortcuts:
button, → , F5.
You can use WinMerge to resolve conflict files that some version control systems produce during their merge operations. A conflict file is created when a merge encounters differences that cannot be automatically resolved. It is a single file containing the incompletely merged content of the two files. WinMerge separates the conflict file into separate files and opens those files in file Compare window. You can then use WinMerge's compare and merge functions to resolve the conflicts and save the merged result file.
Click → , and use the Open dialog to select the conflict file in your file system. The conflict file opens in the File Compare window:
The left File pane file header is titled, Theirs File. This side represents the file that is usually in the version control system's repository. This file usually cannot be edited, so WinMerge sets the left File pane to be read-only. This means that differences can be merged only from this file to the other file.
The right File pane is titled, Mine File. This side is the working copy of the file. All changes should be done to this file, which is the result file.
The Mine File side is set to modified after opening conflict file (you will notice the asterisk in the File pane header). This allows you to save the file quickly if the it does not require any changes. It also ensures that you do not forget to resolve the files. If you choose not to save the file, the original conflict file is not modified.
Use all the normal compare and merge functions described earlier in this topic to resolve the conflicts in the Mine File pane.
When you are done, click Ctrl+S to save the Mine File side as the result file. By default, the new version overwrites the original conflict file. Alternatively, you can click → → , and choose a different file name.
Many version control systems allow you to configure an external merge tool. If yours does, you might be able to have your version control system launch WinMerge automatically when a merge conflict occurs.
You can also open a conflict file from the WinMerge command line,
which accepts three filename parameters: Theirs,
Mine, and optionally, Resolved (if you
want a different result file from the conflict file). For more
information, see Command line. Single path to the
conflict file is also accepted in command line.