Large File Diff

Compare two large local files line by line or byte by byte, with whitespace, line-ending and encoding options and a downloadable report.

Your inputs and files stay in your browser

Files

Original file

Any local file. It stays on this device.

Changed file

Any local file. It stays on this device.

Both files are read in a Web Worker in 1 MiB blocks. Each line is kept only as a hash, and the text on screen is read back from the files. Nothing is uploaded or saved.

Differences

Choose an original and a changed file to see the changed lines or byte ranges.

On this page

Large File Diff compares two local files that are too big for a text box: multi-gigabyte logs, CSV exports, SQL dumps or builds. Text files are compared line by line, binary files byte by byte, and the result is a virtualized table of changes plus a downloadable report.

Detailed Functionality

Both files are read in 1 MiB blocks inside a Web Worker. Instead of keeping the text, every line becomes a 64-bit hash, so a file costs about 8 bytes per line. The whitespace and line-ending options are applied while hashing: compare exactly, ignore trailing whitespace, ignore changes in the amount of whitespace, or ignore it all; CRLF and LF can count as the same line ending. UTF-8 and UTF-16 are hashed as Unicode characters, so the same text saved in both encodings matches. Legacy encodings such as Windows-1251 or Shift_JIS are compared by their bytes.

The line matcher first skips the common beginning and end, then anchors on lines that occur exactly once in both files (patience diff) and aligns the gaps with the Myers algorithm. A gap that would take too long is shown as one replacement block, and the page says so. Only the rows on screen are read back from the files, so scrolling through millions of changed lines stays light.

Binary mode compares the bytes in blocks and lists every differing range with its offset, length and the first 16 bytes of each side; a size difference becomes the last range. The text report is a unified diff (.diff); the binary report is a CSV. Both are streamed to the chosen file.

Practical Examples

Two log files: a 2-million-line log against a copy where 40 lines changed level from INFO to WARN shows 40 removed and 40 added lines in separate hunks with three lines of context each.

Windows and Unix copies: a CRLF file against its LF copy reports no differences while the line-ending option is on; turn it off and every line differs.

Reformatted indentation: choose Ignore changes in amount, and lines that differ only in spaces or tabs between words are treated as equal.

Firmware images: in binary mode, two builds that differ in a version string and a checksum show two short ranges with the old and new bytes in hex.

How to Use This Tool

  1. Choose the files

    Drop or choose the original and the changed file. The comparison starts as soon as both are selected.

  2. Set the options

    Choose Detect, Text lines or Binary bytes, the encoding, the whitespace rule and whether line endings count. Choose Compare to run again with new options.

  3. Read the changes

    The summary counts removed and added lines and hunks. Use Previous change and Next change to jump between hunks, and change Context lines to show more or fewer unchanged lines around them.

  4. Download the report

    Download a unified diff for text, or a CSV of byte ranges for binary files.

Tips and Best Practices

  • Detect switches to binary when either file has a NUL byte in its first 8 KiB, unless it starts with a UTF-16 BOM.
  • Lines are compared by hash. Two different lines with the same 64-bit hash are extremely unlikely, and the table always shows the real text.
  • Reordered blocks of text appear as a removal and an addition, as in diff -u.
  • Cancel stops the worker at once; the files stay selected.
  • For a quick look at two short snippets, Text Diff Viewer highlights changed words inside lines.

Help shape what comes next

What should we improve next?

Choose one suggestion. These are ideas, not promised features.

Choose one option

The vote sends only the selected choice as an anonymous count. It contains no input, file data, URL, cookie or identifier and is not stored in this browser. Reloading the page allows another vote.