10/9/2026
How to Check If Two Files Are Bit-for-Bit Identical
You'd think checking whether two files are identical would be as simple as looking at their names and sizes. It isn't. A file renamed from "contract_final.docx" to "contract_FINAL_v2.docx" tells you nothing about its contents, and two files can share the exact same byte size while differing in a single critical character โ a changed bank account number in a spreadsheet, an altered clause in a contract, a swapped pixel region in a photo. Conversely, two files with completely different names can be bit-for-bit identical copies. The only reliable way to answer the question "are these two files exactly the same?" is to compare their contents mathematically, and that's what this guide walks through, from quick manual methods to forensic-grade verification with documented evidence.
The gold standard for file comparison is the cryptographic hash. A hash function takes a file of any size โ a 4 KB text note or a 40 GB video โ and produces a fixed-length fingerprint, essentially a digital summary of every single byte in the file. The critical property is determinism combined with sensitivity: the same file always produces the same hash, but change even one bit anywhere in the file and the hash changes completely and unpredictably. This means comparing two hashes is mathematically equivalent to comparing every byte of both files, without ever opening them. If the SHA-256 hashes match, the files are identical. If they differ by even one character, the files differ somewhere.
The most common algorithm for this today is SHA-256, which produces a 64-character hexadecimal string and is considered collision-resistant for all practical purposes โ no one has ever produced two different files with the same SHA-256 hash, and doing so deliberately is computationally infeasible. MD5 is an older algorithm you'll still encounter constantly; it's faster and produces a shorter 32-character fingerprint, and while researchers have demonstrated deliberate MD5 collisions, it remains perfectly fine for detecting accidental corruption or casual tampering. CRC32 is the weakest of the three โ it's really an error-detection checksum rather than a security tool โ but it's quick and useful for spotting download corruption. For anything with legal, evidentiary, or security implications, SHA-256 is the one to use, ideally alongside a secondary algorithm for redundancy.
On Windows, you can compute a hash without installing anything. Open PowerShell and run Get-FileHash followed by the file path โ for example, Get-FileHash "C:\Downloads\installer.exe" โ and it returns the SHA-256 hash by default. You can specify the algorithm too: Get-FileHash "file.zip" -Algorithm MD5. Then simply run the same command on the second file and compare the two strings. On macOS and Linux, the equivalent commands are shasum -a 256 filename and md5sum filename, typed into the Terminal. Once you have both hash strings, compare them character by character, or paste them into a text editor side by side. A practical tip: hash strings are long and it's easy to miss a difference near the middle, so it helps to compare them programmatically โ in PowerShell you can store both results and use a simple equality check, and on Linux you can pipe both through diff. The moment the hashes match, you have your answer.
There are situations where manual hashing gets tedious fast. Verifying one downloaded file against the checksum published on a vendor's website is a five-second job. Verifying a folder of 300 photos recovered from a failing drive, or reconciling two backups that should be mirror images, is not. This is where dedicated verification tools earn their keep. FilesAudit, for instance, lets you upload a file and instantly computes its SHA-256, MD5, and CRC32 hashes alongside a full metadata extraction, covering more than 200 supported file formats from images and videos to archives, CAD drawings, and executables. Because all three hash values are presented together, you can compare a file against a published checksum regardless of which algorithm the source used. For bulk local work โ say, hashing an entire archive without uploading anything โ the FilesAudit Desktop App handles unlimited files on your own machine, which matters when the files are confidential or simply too large to move.
Let's ground this in a few realistic scenarios. First: verifying a software download. Reputable vendors publish the SHA-256 hash of their installers on the download page. After downloading, hash the file yourself and compare โ if they match, the file survived the transfer intact and matches what the vendor released. If they don't, delete it; the file is either corrupted or, worse, swapped for something malicious. Our related guide on checking whether an EXE file is original or tampered with goes deeper on this specific case. Second scenario: confirming backups. Before trusting a backup of family photos or company records, hash a sample of files on both the source and the backup copy. Matching hashes prove the copy is faithful in a way that "the copy dialog finished without errors" never can. Third: detecting duplicate files. If you're cleaning up a drive stuffed with years of accumulated downloads, hash everything and group files by their SHA-256 values โ identical hashes mean identical files regardless of name or folder, so you can safely delete the extras. Fourth: evidence preservation. When a journalist receives a leaked document or a lawyer takes custody of a client's files, hashing everything immediately creates a fingerprint of the evidence as received; any later modification, accidental or deliberate, becomes detectable.
One subtlety trips people up constantly: identical content does not always mean identical files. The hash covers every byte of the file, including embedded metadata, and metadata can change without the "real" content changing at all. Re-save a JPEG in a different photo editor and the image pixels may be untouched, but the editor writes its own software tag into the EXIF block โ new file, new hash. Copy a file through a system that alters timestamps stored inside the container, or round-trip a DOCX through a different word processor, and the same thing happens. So when hashes differ, the next question becomes where they differ, and that's a metadata question. Inspecting the internal properties โ creation software, modification timestamps, edit history fields โ often explains the discrepancy immediately. Dedicated guides like the ones for JPG metadata show exactly which fields tend to change between versions of the same image. FilesAudit's reports are built for precisely this kind of two-layer analysis: the hashes tell you whether the files match at all, and the extracted metadata helps explain what changed if they don't.
It's also worth knowing what hash comparison cannot tell you, because overstating it undermines otherwise solid verification work. A matching hash proves two files are byte-identical โ nothing more. It does not prove a file is authentic, original, or legally owned by anyone. It does not tell you who created the file, when it was truly created (internal timestamps can be edited), or whether the content itself is truthful. A hash becomes powerful only when anchored to something trusted: a checksum published by the software vendor, a fingerprint recorded at the moment evidence was collected, or a timestamped report generated when the file was first received. That's why professional workflows pair hashing with documentation โ a generated PDF report capturing the file's hashes, extracted metadata, and the time of analysis creates a record you can reference months later in an audit or dispute. This is technical evidence that supports verification and due diligence; the legal interpretation of that evidence remains a matter for lawyers and courts.
To pull it all together into a practical workflow, keep it simple. For a one-off check, use the built-in tools: Get-FileHash on Windows, shasum -a 256 on macOS and Linux, and compare the outputs. Prefer SHA-256 for anything that matters; treat MD5 as a convenience and CRC32 as a corruption check only. When hashes match, you're done โ the files are identical, full stop. When they don't match, resist the urge to conclude "tampered" and instead inspect the metadata to find the innocent explanation first, since re-saves and format conversions are far more common than malice. For recurring needs โ audits, evidence handling, intellectual property protection, compliance records โ move to a tool that documents the result rather than just displaying it, so the verification itself becomes reproducible and shareable. And whenever you receive an important file, hash it and record the value immediately. That five-second habit is what turns "I think this is the same file" into "I can prove it."