Compare Two Files
Compare two files and get one verdict: identical or not. The page checks the sizes first, then an MD5, SHA-1 or SHA-256 hash of each file — or it steps through every byte in 4 MiB windows and reports where the first difference sits. File names and dates play no part, and nothing is uploaded.
How to use
- Pick file A and file B: Drop two files on the box or click to choose them. Any type is accepted and no size limit is applied. You can add them one at a time, because the box stays on screen: the first file becomes A, the second becomes B. A third file is refused as a whole batch with a note, so remove one with ✕ first. Swap A/B changes which is which.
- Choose how to compare them: Leave the hash algorithm on SHA-256 for a normal check, or switch to MD5 or SHA-1 when you need to match a value published in one of those. Tick Byte-exact comparison to skip hashing and have the offset of the first differing byte reported instead; that disables the algorithm menu, because this route does not use one. Changing either option clears the previous verdict and keeps your files.
- Compare, then keep the result: Click Compare files and watch the progress line. While it runs, the last button reads Cancel; the cancel signal is checked before and after each 4 MiB slice, so it takes effect at the next checkpoint rather than mid-read. When the verdict appears you can copy either hash, use Copy result summary, or Download comparison report (CSV).
How this page compares two files
Compare two files locally by size and SHA-256, or choose byte-exact comparison. Different sizes produce an immediate “different” result without reading file content. Equal-sized files are read in 4 MiB chunks; byte-exact mode reports the first differing offset, counted from zero. Files are not uploaded.
Every run ends in one verdict, with the reason named underneath it: the sizes, the two hashes, or the byte pass. File names, folders, extensions and modified dates do not affect the verdict. The result cards show each file's name and size, plus its hash when calculated. Two copies of the same 652-byte archive saved under different names come back identical, with matching hashes on both cards; a size mismatch leaves both cards without a hash, because none was calculated.
The work happens on your own device. The hashing is done by hash-wasm, a WebAssembly implementation of MD5, SHA-1 and SHA-256, which is fetched the first time a hash is actually needed and then calculates locally; the file bytes are read slice by slice straight from disk and are not sent anywhere. That is not the same thing as a page with no network traffic — the page, its code and that one WebAssembly module do come from a server — but your file content stays where it is, and the only new file this page can produce is the CSV report you ask for.
The digests are lowercase hexadecimal, in the same format the command line prints. On the 652-byte sample archive used for testing, SHA-256 came out as 1c5f6d3ed321795ad884264e9bd27f99d4759dce00f08ba55117ada517cf6eb4, character for character what shasum -a 256 printed for the same file; SHA-1 and MD5 matched shasum -a 1 and md5 -q, and an empty file produces the familiar e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 digest. So a hash copied from this page can be set next to one from sha256sum, certutil or PowerShell's Get-FileHash and compared on sight.
Hash comparison or byte-exact: which one to choose
Both routes answer the same question, and on every pair tested they reached the same verdict. What differs is how much they read and what they can tell you afterwards. The default route compares digests: once the sizes match it reads both files from start to finish, then compares two short strings. Ticking Byte-exact comparison takes the other route — no hash at all, the two files are read in matching 4 MiB windows and compared byte against byte, stopping at the first position where they disagree.
That stopping point is the practical reason to use it. Flipping a single byte at offset 100 of the 652-byte sample makes the default route report that the hashes differ and nothing more; the byte-exact route reports that the content differs from byte 100 onwards, and repeats the offset in hexadecimal. When a difference sits near the beginning of two large files, the byte-exact route also stops reading early, whereas the hash route has to finish reading both files before it has two digests to compare. The trade is that it gives you no hash to reuse, and the algorithm named in the report is then only a label.
The hash route carries one theoretical caveat: two different files could in principle produce the same digest. With SHA-256 that is not a practical worry, but a hash match is very strong evidence rather than a mathematical proof, so pick the byte-exact route when you want no room for doubt at all. Either way a size mismatch short-circuits both routes, and two empty files are reported as identical — the hash route citing two matching digests, the byte-exact route citing the byte pass it completed.
| Default (hash) | Byte-exact comparison | |
|---|---|---|
| What gets read | Sizes first; both files in full only when the sizes match | Matching 4 MiB windows, stopping at the first difference |
| Algorithm | MD5, SHA-1 or SHA-256 (SHA-256 to start with) | None — the menu is disabled |
| Says where they differ | No | Yes: offset of the first differing byte, in decimal and hexadecimal |
| Gives a hash you can reuse | Yes, one per file, each with a copy button | No |
| Collision caveat | Theoretical | None |
Both routes agreed on every sample pair tested; they differ in reading and in detail.
What the verdict tells you, and what it does not
The answer is a yes or a no about bytes, not an opinion about content. There is no side-by-side view, no line-by-line diff and no list of changes: the most detail on offer is the offset of the first differing byte in byte-exact mode. If you need to establish that two files are the same, that is enough. If you need to see what changed, this is not the page for it.
Nothing is interpreted either, because nothing is decoded. A photo exported twice from the same original — once as JPEG, once as an optimised PNG — is reported as different, which is correct even though the two look the same on screen. The same reasoning runs the other way: two damaged files whose bytes happen to match are reported as identical, so this page cannot tell you whether a file is broken.
A few boundaries are worth knowing before you start. Two files at a time, so this is not a way to find duplicates among 500. The size cap the other file tools apply is switched off here, but your browser still has to be able to open and read whatever you pick. And when the verdict rests on a size mismatch, there are no hashes to show or export, because none were calculated.
To identify a file's actual format before comparing it, use File Type Checker to inspect its header bytes.
Checking a download against a published hash
The second tab answers a different question: do the bytes you just downloaded match the hash the publisher printed next to the link? Choose the file, paste the published value, set the algorithm to match, and the page reports either a match or no match, together with the hash it actually computed. That computed value is shown in both cases, so you can line it up against the official page digit by digit.
The value you paste is checked before a single byte of the file is read. Surrounding spaces are trimmed and case is ignored, so a string copied straight off a web page is usually fine as it is. It then has to be hexadecimal and the right length for the algorithm you chose — 32 characters for MD5, 40 for SHA-1, 64 for SHA-256 — and if it is not, you get a message naming the length you pasted and the length expected, instead of waiting for a whole file to be hashed only to be told it does not match. Base64-style values, such as the sha256- form some projects publish, are not accepted, and CRC32 and SHA-512 are not among the three algorithms offered here.
Be clear about what a match proves: that the bytes you have correspond to the string you pasted. If someone replaced both the download and the hash published beside it, the check still passes — catching that needs a signature scheme such as GPG, which this page does not do. MD5 and SHA-1 both have published collision techniques, so treat them as checks for a damaged download rather than for deliberate tampering; the page says as much when an MD5 check passes. One more thing about this tab: while a check is running, its inputs are held — the expected-hash field is disabled and a file dropped on the box is refused as a whole batch with a note — so the result always belongs to the file and the value the check started with. Press Cancel first if you want to check something else.
What stays on your device afterwards
The page itself keeps nothing. The files you picked, the verdict and the hash you pasted live in the page's memory only — no local storage, no database, no cookies — so a refresh or a closed tab leaves you with an empty form and files to pick again.
Two copies can outlive the page, and both are ones you make deliberately. Download comparison report (CSV) writes a small RFC 4180 file, quoted fields and a UTF-8 byte order mark, holding the verdict, what it was based on, the algorithm, and for each side the file name, the size as shown on screen, the raw byte count, and the hash when one was calculated; in byte-exact mode a mismatch adds the offset of the first differing byte. Copy result summary puts those same rows on your clipboard. Neither carries any of your file content, but both carry file names and hashes, and this page does not go back and clear them: the CSV stays in your downloads folder, and the clipboard holds its contents until you copy something else.
Sizes on screen follow the site's own formatting rather than the hash library's. Below 1 MiB they are whole units, so a 214,657-byte file reads as 210 KB, with the exact byte count in brackets next to it; a 652-byte file reads as 652 B. The CSV repeats the byte count unformatted, so a spreadsheet can add the column up.
How this tool is checked
- The logic behind this tool is covered by 37 automated test cases (hand-checked examples, edge cases and invalid input), and they run again before every release.
- Before each release, a real browser opens this page, runs it on sample files (including a damaged one) and checks the file it produces.
- Your files are processed in your browser and are never uploaded to our server.
- Formulas, figures and definitions are checked against the sources listed at the end of this page.
Frequently asked questions
- How do I check if two files are identical?
- Pick both files, leave the algorithm on SHA-256 and click Compare files. Matching sizes plus matching hashes give you the verdict that the two files are identical; different sizes end it immediately, without any hashing.
- Can I compare two files without uploading them?
- Yes, that is how this page works. The comparison code is downloaded with the page and reads your files on your own device, so no file content is sent to a server. Only the page and its code travel over the network.
- Is there a limit on file size?
- No size cap is applied here, unlike the 50 MB limit the other file tools use. Your browser still has to be able to open and read the file, and how long a comparison takes depends on how many bytes actually get read and how fast your device is.
- Should I pick MD5, SHA-1 or SHA-256?
- SHA-256 unless you have a reason not to. Choose MD5 or SHA-1 only to match a value published in one of them: both have public collision techniques, which makes them useful for spotting a damaged file rather than a tampered one.
- The two files are the same size but the verdict says they differ. Why?
- Because the verdict is based on content, not size. Files can differ in less visible bytes, such as line endings, a byte order mark, or trailing whitespace. Tick Byte-exact comparison to find out where the first difference is.
- Can it show me what changed inside the files?
- No. The most detail available is the offset of the first differing byte, which byte-exact mode reports in decimal and hexadecimal. There is no line-by-line diff and no side-by-side view on this page.
- Will the hash match sha256sum or Get-FileHash?
- It should, because the digests are lowercase hexadecimal in the standard format. On the sample files used for testing, the SHA-256, SHA-1 and MD5 values came out character for character the same as shasum -a 256, shasum -a 1 and md5 -q printed.
- Can I compare more than two files, or a whole folder?
- No, two files at a time. A third selection is refused as a whole batch with a note rather than quietly replacing one, and in the expected-hash tab dropping several files at once is rejected too. Finding duplicates in a folder needs a dedicated duplicate finder.
Related tools
Cite this tool
Using a result in a report, paper or assignment? Copy a ready-made reference.
Gingertool. (2026). Compare Two Files [Online tool]. Retrieved November 24, 2026, from https://gingertool.com/en/file-tools/compare-two-files/
“Compare Two Files.” Gingertool, November 24, 2026, https://gingertool.com/en/file-tools/compare-two-files/. Accessed November 24, 2026.
@misc{gingertool-file-compare,
author = {{Gingertool}},
title = {Compare Two Files},
year = {2026},
url = {https://gingertool.com/en/file-tools/compare-two-files/},
note = {Accessed: 2026-11-24}
}