FormatterHQ

File Diff – Compare Two Files

Load two text files, such as configs, scripts or CSV exports, and see their differences side by side or in one unified column, with the changed characters highlighted.

Loading tool…
Ready.

How to use the File Diff - Compare Files

  1. Load the first file on the left and the second on the right with Open file, drop a file on either side, or paste the contents.
  2. Pick Side by side or Unified view, and tick Collapse unchanged to keep only three lines of context around each change.
  3. Tick Ignore whitespace or Ignore case if formatting differences should not count.
  4. Review the changes, step through them with Prev and Next, and copy either file's text with Copy.

File diff: compare files without the command line

Developers reach for diff or git diff to compare files, but those need a terminal and the files on the same machine. This file diff tool runs in the browser: load or paste two versions and the differences are highlighted line by line. Tick Collapse unchanged and it keeps three lines of context around each change, just like diff -u, so you can focus on what changed in long files.

Example: two configuration files

Original file              Changed file
server:                    server:
  port: 8080                 port: 8080
  host: 0.0.0.0              host: 127.0.0.1
database:                  database:
  driver: mysql              driver: mysql
  host: localhost            host: localhost
  pool: 5                    pool: 20
                             timeout: 30
logging:                   logging:
  level: info                level: info

The tool marks two changed blocks. In the first, the host line is highlighted on both sides. In the second, pool: 5 became pool: 20 and a timeout line was added below it. The summary in the toolbar reads 2 changes +3 −2: two blocks, three lines on the changed side and two on the original side.

Typical file comparisons

  • Configuration drift – compare .env, YAML, INI or nginx.conf files from staging and production.
  • Script versions – see what a colleague changed in a shell or Python script sent by email.
  • Data exports – compare two CSV exports to find new, deleted or edited rows.
  • Documentation – review edits to Markdown or plain-text files.
  • Generated files – check what a code generator or dependency update changed in a lock file.

Creating and applying a patch

This page shows the comparison on screen and does not write a patch file. When you need one, the command-line tools create it from the same two files and apply it to the original:

diff -u original.conf changed.conf > changes.patch
patch original.conf < changes.patch
# or, inside a Git repository:
git apply changes.patch

In the patch, lines starting with - exist only in the first file, lines with + only in the second, and lines with a leading space are unchanged context. The @@ header gives the line ranges in each file.

Options

  • View – Side by side for reading in two columns, or Unified for one column with each removed line shown above the text that replaced it.
  • Collapse unchanged – fold long unchanged stretches and keep three lines around each change, or leave it off to see the whole file.
  • Ignore whitespace / Ignore case – hide changes that do not matter, such as re-indentation, trailing spaces or capitalization.

Line endings are normalized, so a file saved on Windows compares cleanly with the same file from Linux.

When a diff looks bigger than it should

  • Re-indentation. Switching from tabs to spaces or changing the indent width marks every line as changed. Tick Ignore whitespace to see only real edits.
  • A byte order mark. If only the first line differs and it looks identical, one file probably starts with an invisible UTF-8 BOM.
  • Reordered lines. A line-based diff reports a moved block as a deletion plus an addition. For lists or CSV rows where order does not matter, sort both files first.
  • Different encodings. A file saved as UTF-16 or Windows-1252 may show accented characters as changed. Re-save both files as UTF-8 before comparing.

Which diff tool should you use?

For quick pasted snippets, the diff checker offers the same comparison with plain Original and Changed labels. For JSON documents where key order does not matter, the JSON diff compares structure instead of lines. Files are read and compared locally; nothing is uploaded.

Frequently asked questions

Which file types can I compare?
Any text-based file: source code, configuration, CSV, Markdown, logs, SQL and so on. Binary files such as images, PDFs or Word documents cannot be compared as text.
What is a unified diff?
It is the standard patch format used by diff -u and Git. Removed lines start with a minus sign, added lines with a plus sign, and unchanged context lines with a space.
Can I download a patch file?
No. The comparison is shown on screen only. To get a patch, run diff -u on the two files and save its output, then feed that file to the patch command or run git apply inside a repository. Adjust the file names in the patch header if the tool cannot find the file.
Are my files uploaded?
No. The files are read and compared entirely in your browser, which makes the tool safe for private configuration and code.

Last updated October 3, 2026

Related tools