KDiff3: How to Install It, Compare Folders, and Use It with Git
Install on Windows, Mac, or Linux, compare and merge files and folders, and make KDiff3 your Git mergetool.
Quick Answer
KDiff3 is a free, open-source tool from KDE that compares and merges two or three text files or folders on Windows, macOS, and Linux. Install it with winget install KDE.KDiff3, brew install --cask kdiff3, or sudo apt install kdiff3, then run kdiff3 old.txt new.txt for files or kdiff3 folderA folderB for folders. For Git, run git config --global merge.tool kdiff3 and then git mergetool.
KDiff3 has been around since 2002 and is still maintained in KDE’s GitLab. At the time of writing (December 2026) the current release is 1.12.6. This guide covers the jobs people actually install it for: reviewing two versions of a file, resolving merge conflicts, and checking two folder trees against each other.
Install KDiff3 on Windows, Mac, and Linux
# Windows (winget)
winget install KDE.KDiff3
# macOS (Homebrew; Apple Silicon and Intel builds)
brew install --cask kdiff3
# Debian / Ubuntu
sudo apt install kdiff3
# Fedora
sudo dnf install kdiff3
# Arch
sudo pacman -S kdiff3
# Any distro with Flatpak
flatpak install flathub org.kde.kdiff3You can also download the installer directly from download.kde.org/stable/kdiff3/, which hosts the Windows .exe, both macOS .dmg files, and the source tarball. Use these official sources. Third-party download sites often host old 0.9.x builds from the SourceForge era, which the project no longer supports.
Compare Two Files
kdiff3 old.txt new.txtKDiff3 opens the files side by side. Changed lines are coloured, and the exact characters that changed inside a line are highlighted too, which is the feature most people remember it for. The summary bar at the top counts the differences; use the toolbar arrows (or Ctrl+Down / Ctrl+Up) to jump between them.
Running it with no arguments opens a dialog where you pick the files. If both files share a name in different folders, you can shorten the command: kdiff3 v1/config.ini v2 compares v1/config.ini with v2/config.ini.
Two settings that save a lot of noise are under Settings → Configure KDiff3 → Diff: ignoring white space changes and ignoring comments. Use them when you only care about changes in meaning, not formatting.
Three-Way Merge
A three-way merge takes a common ancestor (the base) and two edited versions, and produces one result. The first file is always treated as the base:
kdiff3 base.txt mine.txt theirs.txt -o merged.txtThe top half shows the three inputs (A, B, C) and the bottom half shows the output. KDiff3 solves every change that only one side made, and stops on real conflicts, where both sides changed the same lines. For each conflict, click A, B, or C in the toolbar to choose which version goes into the output, or type in the output pane directly. Save to write merged.txt.
In scripts, add --auto: if every conflict can be solved automatically, KDiff3 writes the output and exits without showing a window, and it only opens the window when a person needs to decide.
Compare Two Folders with KDiff3
# Compare two folder trees
kdiff3 backup/ project/
# Merge two folders into a third
kdiff3 folderA folderB -o merged-folderThe directory window lists every file from both trees, marks files that differ or exist on only one side, and opens a line diff when you double-click a file. In a directory merge, each row also shows the action KDiff3 plans to take (copy, delete, merge), and you can change it before running the merge.
Check the file comparison mode
In the directory settings KDiff3 can compare file contents, or “trust” size and modification date to go faster. Its own option names mark the trust modes as unsafe: two files with the same size and date can still have different contents. Keep content comparison on when the result matters, for example after a migration or before deleting one copy.
For a quick check without installing anything, the free Folder Compare tool lists missing, added, and changed files between two folders. Other built-in ways to do it are in our guides for Windows and Linux.
Use KDiff3 with Git (mergetool and difftool)
Git has built-in support for KDiff3, so the setup is two lines:
git config --global merge.tool kdiff3
git config --global diff.tool kdiff3
# After a merge stops with conflicts
git mergetool
# Review changes file by file, or whole trees at once
git difftool
git difftool --dir-diff main featuregit mergetool opens each conflicted file as a three-way merge: base, your version (local), and the incoming version (remote). Resolve, save, close, and Git moves to the next file. git difftool asks before each file; add -y to skip the prompt.
“kdiff3 is not available” means Git cannot find the program. Tell it where the executable is:
# Windows: find the exe, then use forward slashes in the path
where.exe /R "C:\Program Files\KDiff3" kdiff3.exe
git config --global mergetool.kdiff3.path "<path printed above, with / instead of \>"
# macOS: Homebrew already adds kdiff3 to your PATH; for a manual .dmg install
git config --global mergetool.kdiff3.path /Applications/kdiff3.app/Contents/MacOS/kdiff3Set difftool.kdiff3.path the same way if you use git difftool. Git also keeps a .orig backup of each conflicted file after a merge; turn that off with git config --global mergetool.keepBackup false.
KDiff3 Command-Line Options
| Option | What it does |
|---|---|
| -o, --output file | Write the merge result to file. Implies -m (merge). |
| -m, --merge | Merge the inputs instead of only comparing them. |
| -b, --base file | Name the base (common ancestor) file explicitly. |
| --auto | Skip the window if every conflict can be solved automatically. Needs -o. |
| --noauto | Always show the window, even when --auto is set. |
| --L1 / --L2 / --L3 name | Display name for input 1 (base), 2, and 3 instead of the file path. |
| --cs setting=value | Override one config setting for this run, e.g. --cs AutoAdvance=1. |
| --confighelp | List every config setting with its current value. |
Options come from the KDiff3 1.12 man page. A few flags (-u, --query, --html, --abort) are accepted but ignored, so other tools that pass them do not break.
KDiff3 Limits and Alternatives
- Text only. KDiff3’s README lists binary comparison as temporarily disabled. For images, PDFs, or archives, compare hashes: the free Compare Files tool gives a SHA-256 identical-or-different answer for two files up to 10 MB each, and this guide covers the command-line ways.
- No saved baseline. A folder comparison is live: it compares two trees as they are now. It does not record a snapshot you can check a backup against next month.
- Dated interface. It works, but it looks its age. If that bothers you, the alternatives below are worth a look.
Common alternatives:
- Meld: free, simpler interface, two- and three-way file and folder compare. Git supports it with
-t meld. - WinMerge: free and Windows only. See our WinMerge comparison.
- FileMerge: ships with Xcode on Mac. See how to use FileMerge, or the full list of diff tools for macOS.
- VS Code:
code --diff a.txt b.txtif it is already your editor.
KDiff3 answers “which lines changed?”. A different question comes up after copying a project to a new drive, restoring a backup, or moving files to a NAS: “did every file arrive intact, and what changed since last time?” FolderManifest is built for that. It records every file with its path, size, dates, and SHA-256 hash, compares two folders or a folder against a saved manifest, and lists exactly which files were added, removed, or changed, with a report you can keep. It runs locally on Windows 10/11, macOS, and Linux. It is not a text merge tool, so for the line-by-line step KDiff3 is still the right choice.
Frequently Asked Questions
What is KDiff3?
KDiff3 is a free, open-source diff and merge tool from the KDE project. It compares two or three text files or folders, shows differences line by line and character by character, merges them automatically where it can, and gives you an editor for the conflicts it cannot solve. It runs on Windows, macOS, and Linux.
Is KDiff3 free and safe?
Yes, it is free software under the GNU GPL v2, maintained by KDE. Install it from the official sources: download.kde.org, winget (KDE.KDiff3), Homebrew (kdiff3 cask), Flathub, or your Linux package manager. Avoid third-party download mirrors, which often bundle old versions or extra installers.
How do I use KDiff3 as my Git merge tool?
Run git config --global merge.tool kdiff3, then git mergetool after a merge stops with conflicts. Git has built-in support for kdiff3, so no extra command line is needed. If Git says kdiff3 is not available, set git config --global mergetool.kdiff3.path to the full path of kdiff3.exe.
Can KDiff3 compare two folders?
Yes. Run kdiff3 folderA folderB, or choose two folders in the open dialog. KDiff3 lists every file in both trees, marks files that differ or exist on one side only, and opens a line diff when you double-click a file. Add a third folder or -o target to run a directory merge.
Does KDiff3 work on Mac?
Yes. KDE publishes macOS builds for Apple Silicon (arm64) and Intel (x86_64), and Homebrew installs them with brew install --cask kdiff3, which also puts a kdiff3 command on your PATH so Git finds it. For a manual .dmg install, point mergetool.kdiff3.path at /Applications/kdiff3.app/Contents/MacOS/kdiff3.
Can KDiff3 compare binary files?
Not reliably. KDiff3 is built for text, and its current README lists binary comparison as temporarily disabled for stability reasons. For images, archives, or executables, compare hashes instead, for example with Get-FileHash, shasum -a 256, or a free online SHA-256 compare tool.
KDiff3 vs Meld: which should I use?
Both are free and compare files and folders two-way or three-way. KDiff3 is stronger at three-way merges with automatic conflict solving and a built-in conflict editor; Meld has a simpler interface and a clean folder view. If you mostly resolve Git conflicts, KDiff3 is the better fit; if you mostly review changes, try Meld.
Verify Whole Folders, Not Just Lines
Record every file with its SHA-256 hash, then check any copy, backup, or migration against it. Windows, Mac, and Linux. 7-day free trial, no card required, 30-day money-back guarantee.
