Duplicate Photo Finder
Operator: Abdulla Al Fahad. How tools are built and checked
Duplicate photos come in two kinds. Some are byte-for-byte copies, from importing the same card twice or saving the same attachment under three names. Others are different files that show the same picture: a resized copy that came back from a messaging app, an edit saved over again, or one shot exported at two qualities. A comparison of names or sizes misses the second kind.
This tool finds both. It fingerprints every file for exact copies and builds a compact signature of what each picture looks like, so look-alikes group together even when their bytes differ. You choose which copy to keep in each group. To see exactly what differs between two look-alikes, the Image Diff Checker on this site overlays them.
Key features
- Exact duplicates by SHA-256 and look-alikes by perceptual hash
- Average, gradient or perceptual hash, with a tolerance of 0 to 16 bits
- A suggested keeper per group that you can change
- A CSV of keep and remove decisions, and a ZIP of the pictures to keep
File fingerprints and perceptual hashes
Drop a folder or choose one, or add individual files. Sub-folders are included, up to 1,500 pictures per scan. JPG, PNG, WEBP, GIF, BMP and AVIF are read, other files are ignored and counted, and a picture that cannot be decoded is reported instead of stopping the scan.
For each picture the tool computes a SHA-256 of the file's bytes and three 64-bit perceptual hashes. You pick which hash to use, with pHash as the default, and a tolerance from 0 to 16 bits, with 6 as the default. Results export as a CSV listing every group with a keep or remove mark, or as a ZIP of everything you are keeping, up to 1 GB in total. A browser tab cannot delete files, so removal is done by you.
How it works
Each picture is drawn onto a 128 x 128 white canvas, converted to gray with Rec. 601 weights, and averaged down to 32 x 32. The aspect ratio is not preserved, so a picture and its resized copy squash the same way.
From that 32 x 32 thumbnail come three hashes. The average hash shrinks it to 8 x 8 and sets a bit for each cell brighter than the mean. The gradient hash sets a bit when a pixel is brighter than its right-hand neighbor. The perceptual hash takes a 2D discrete cosine transform, keeps an 8 x 8 block of low frequencies after the overall brightness term, and sets a bit for each coefficient above the median.
Two pictures are compared by Hamming distance, the number of the 64 bits that differ. Pictures are linked when their SHA-256 matches or their distance is at or under the tolerance, and a group is a connected cluster, so a chain of similar pictures lands in one group. The suggested keeper is the picture with the most pixels, then the biggest file, then the first path.
Common use cases
- A 600-photo import folder where 40 shots also came back through a messaging app as 1600 x 1200 copies of about 210 KB. Resized copies behave like the 256 x 192 row above, at 0 bits, so they group next to the 4032 x 3024 originals, and marking the 40 small copies for removal frees about 8 MB (40 x 210 KB).
- Two exports of the same 1,200-photo album, one JPG and one WEBP. Exact copies only finds nothing, because the bytes differ, while pHash at tolerance 6 groups each pair.
- A designer's export folder holding logo-v2.png, logo-v2-final.png and logo-final-FINAL.png. SHA-256 groups them as exact copies despite the three names.
How to use this tool
- Drop a folder of pictures, or choose files.
- Wait for the fingerprints, then pick a method and a tolerance, or tick Exact copies only.
- In each group choose which copy to keep, then download the CSV list or the ZIP of pictures to keep.
Example
A synthetic 640 x 480 test scene of soft shapes, compared with edited versions of itself
edit pHash dHash aHash
resized to 256 x 192 0 0 0
re-saved with noise, +6 brightness 0 0 0
heavier edit, noise 10, +25 brightness 4 0 1
cropped to 95 percent 4 5 4
cropped to 85 percent 20 13 9
mirrored 32 32 24
a different scene 32 30 33What that means at the default pHash tolerance of 6
grouped resize, re-save, heavy edit, 95% crop
not grouped 85% crop, mirror image, other sceneTips for best results
- Start at the default tolerance of 6. On the test scene above, resizes and re-saves land at 0 to 4 bits and an unrelated scene at 30 or more, so the tolerance can rise a long way without joining different pictures. At 20 the 85 percent crop joins under pHash, and the other scene is still 12 bits away.
- Try the other hashes when pHash misses. On the 85 percent crop dHash and aHash were steadier than pHash, at 13 and 9 bits against 20, while pHash stayed at 4 on the heavier edit where dHash stayed at 0.
- Read the suggestion as a starting point. The keeper is the largest by pixels, then by file size, which is wrong when the larger file is the over-sharpened or watermarked edit.
- Tick Exact copies only to see just the byte-identical files first. It ignores how pictures look, so it is the quick safe pass before a look-alike scan.
Common pitfalls
A chain links up: if A is within tolerance of B and B of C, all three land in one group even when A and C are further apart. Lower the tolerance if a group looks too large.
A scan reads at most 1,500 pictures, so a 3,000-photo library needs two runs, and a pair split between runs is not found. Scan one year or one event folder at a time.
Letterboxed and unletterboxed versions of a picture squash differently, because the aspect ratio is not kept, and can fall outside the tolerance.
The page cannot delete files. Use the CSV to remove the marked ones yourself in a file manager.
Best practices
- Work through a library in chunks of one year or one event. It keeps each scan under the 1,500-picture cap and keeps groups small enough to review.
Which edits the hashes follow, and which they do not
A hash describes the broad shape of light and dark in a picture, so it survives changes that leave that shape alone and fails when the shape moves. From the test scene above:
- Resizing and recompression leave the shape alone: 0 bits
- Brightness and noise changes barely move it: 0 to 4 bits
- Cropping moves the shape in proportion to what is removed: 4 to 5 bits at 95 percent, 9 to 20 at 85 percent
- Mirroring or turning a picture changes it completely: 24 to 32 bits, about the same as an unrelated picture
Frequently asked questions
Which hash is best?
pHash is the best all-round choice and the default. dHash is good at resized copies, and aHash is the fastest and loosest. If pHash groups too little, try the others at the same tolerance.
Will it match the same photo saved as PNG and JPG?
Yes with the look-alike methods, since both give nearly identical thumbnails. Exact copies only will not, because the bytes differ.