How to Find Duplicate Files by Content Hash (Not Filename)
Find duplicate files by content hash, not by name. Learn why SHA matching beats filenames and how to clean a drive or photo library locally.
How to Find Duplicate Files by Content Hash (Not Filename)
Most people hunt for duplicate files the wrong way. They sort a folder by name, spot invoice.pdf and invoice (1).pdf, and assume the second one is junk. Sometimes it is. Sometimes invoice (1).pdf is a corrected version and invoice.pdf is the stale draft. Filenames lie, and they lie often, because the people and the apps that create files rename them constantly.
The reliable way to find true duplicates is to compare the actual bytes inside each file. A content hash does exactly that, and it does it fast enough to scan hundreds of files in a couple of seconds.
Why filenames are the worst way to spot duplicates
A filename is metadata. It says nothing about what the file actually contains. Three things break filename-based duplicate hunting almost immediately:
- Renamed copies. Your camera exports
IMG_4821.JPG. You copy it to a shared drive asbeach-sunset.jpg. Same photo, two names, zero overlap if you sort by filename. - Auto-numbered downloads. Browsers append
(1),(2),(3)when a file already exists. Those numbers tell you nothing about whether the contents match. - Identical names, different files. Every project folder has a
notes.txtand aREADME.md. Matching on name alone would flag dozens of unrelated files as duplicates.
Filenames are a human convenience layer sitting on top of the real data. To find duplicates honestly, you have to look underneath that layer.
What a content hash actually proves
A hash function reads every byte of a file and produces a short fixed-length fingerprint, called a digest. SHA-256 is the common choice. The important property is this: identical content yields the same hash regardless of the name, the folder, the timestamp, or the file extension. Rename a file, move it, change its modified date — the hash stays the same because the bytes stayed the same.
The reverse is just as useful. Change a single byte and the digest changes completely. So if two files share a hash, they are byte-for-byte identical, and if their hashes differ, they are not the same file. There is no "close enough" in the middle. That determinism is what makes hash matching trustworthy for cleanup decisions.
This is also why a hash will not flag visually similar photos. A JPEG exported at 90% quality and the same shot exported at 80% quality are different files at the byte level, so they produce different hashes. That is a feature, not a limitation: you get exact duplicates only, with no false matches to second-guess.
A concrete example: files grouped by hash
Say you point Duplicate File Finder at a messy export folder and select these eight files:
photo-a.jpg hash 9f2c...e1
backup/photo-a.jpg hash 9f2c...e1
sunset_final.jpg hash 9f2c...e1
report.pdf hash 4b7d...a0
report-v2.pdf hash c18e...77
report-final.pdf hash 4b7d...a0
logo.png hash 22aa...90
logo-copy.png hash 22aa...90
Group the files by their hash and the duplicates jump out immediately:
- Group
9f2c...e1— three copies of the same image under three different names (photo-a.jpg,backup/photo-a.jpg,sunset_final.jpg). Keep one, delete two. - Group
4b7d...a0—report.pdfandreport-final.pdfare identical, whilereport-v2.pdfis genuinely different. The "final" file is a literal copy of the original; the real revision isreport-v2.pdf. Filename sorting would have steered you the opposite way. - Group
22aa...90—logo.pngandlogo-copy.pngare the same image.
Notice what the hash caught that names never could: sunset_final.jpg is the same photo as photo-a.jpg, and report-final.pdf is not the latest report. You only learn both facts by reading the bytes.
Cleaning a drive or photo library
This approach scales from a single folder to a years-deep photo library. The workflow is the same:
- Select a batch of candidate files. Pick the folder you suspect has accumulated copies — camera dumps, a downloads pile, an archive of contract revisions.
- Let each file get hashed and grouped. Every file is read, hashed, and bucketed by digest. Singletons are unique; any bucket with two or more entries is a duplicate group.
- Read the cleanup report. You get the duplicate groups, the filenames in each, and the sizes, so you can see how much space is recoverable before touching anything.
- Delete copies yourself, outside the browser. The tool finds duplicates; it does not delete them. You stay in control of which copy survives.
For photo libraries specifically, hash matching is the only safe filter. Photo apps re-export, re-import, and rename relentlessly, so the same shot ends up scattered under five names across three folders. A hash collapses all five back into one group instantly. If you want to confirm a single pair before committing, File Checksum Compare gives you a focused side-by-side check of two files' digests.
Why local computation matters here
Duplicate hunting touches your most personal files: photos, contracts, tax documents, client deliverables. Uploading all of that to a server just to find copies is a bad trade. The hashing math is simple and runs perfectly well in your own browser, so there is no reason to send the bytes anywhere.
I rebuilt this habit after a slow afternoon untangling my own ~/Downloads. I had been doing it by eye — sorting by name, squinting at (1) and (2) suffixes, second-guessing every "final" file. When I switched to hashing the whole batch, the answer came back in seconds and it was unambiguous: 41 files, 12 of them exact duplicates of others, 380 MB recoverable. No uploads, no guessing, no "I think this one is the keeper." The fingerprints decided, and I just confirmed.
Browser-based hashing has one honest limit worth stating: a web page cannot crawl your disk on its own. You select the files you want to compare from the file picker, and everything from that point runs locally. That is a fair price for keeping your files on your own machine.
The takeaway
If you remember one thing, make it this: a filename is a label, a hash is the truth. Identical content produces an identical hash no matter what the file is called, so grouping by hash is the only way to find duplicates you can act on without second-guessing. Keep the computation local, read the report, and delete copies on your own terms.
Made by Toolora · Updated 2026-06-13