Find Duplicate Images & Videos

Select a folder to scan. Supports images (JPG, PNG, GIF, WebP) and videos (MP4, WebM, MOV).

Starting...
0 items

📐 How dHash Duplicate Detection Works — Complete Guide

Everything you need to know about finding and cleaning up duplicate files with the dHash (Difference Hash) algorithm. Scroll down for step‑by‑step instructions, tips, and answers to common questions.

100% Private — Your Files Never Leave Your Computer Everything runs inside your browser. No uploads, no accounts, no tracking. Close the tab and all data is gone.

🔍 What This Tool Does

Sakarto looks inside your images and videos to detect duplicates — not just files with the same name. dHash compares the gradient (brightness difference) between adjacent pixels to produce a 256‑bit fingerprint. Files with matching gradient patterns are grouped together, making it highly robust to brightness or exposure adjustments.

Gradient‑Based Hashing

Compares adjacent pixels to capture brightness transitions. Highly robust to global brightness and exposure changes.

256‑Bit Fingerprint

A 16×16 grid of gradient comparisons produces a compact binary hash. Two files are compared by counting differing bits (Hamming distance).

Web Worker Processing

All image hashing runs in a background Web Worker via OffscreenCanvas, keeping the browser tab fully responsive during scanning.

Fast Mode for JPEG

Reads the embedded EXIF thumbnail instead of the full image — 5–10× faster with near‑identical accuracy for most photos.

🧠 How the dHash Algorithm Works

Difference Hash (dHash) builds a fingerprint by summarising the brightness transitions of the image rather than absolute pixel values. Here's what happens step by step:

  1. Resize to 17×16 Pixels

    Each image is drawn onto a 17×16 pixel canvas. The extra column is required so we can compare each pixel to the one immediately to its right. In Fast Mode, JPEG files use their embedded EXIF thumbnail.

  2. Convert to Grayscale

    Each of the 272 pixels is converted to a grayscale value using the luminance formula: 0.299×R + 0.587×G + 0.114×B. Color information is discarded; only brightness matters.

  3. Compare Adjacent Pixels

    For each of the 16 rows, we compare the 16 adjacent pixel pairs (pixel 0 vs 1, 1 vs 2, ..., 15 vs 16). If the left pixel is brighter than the right pixel, the bit is set to 1; otherwise, it is set to 0.

  4. Build the 256‑Bit Hash

    The 16 rows of 16 comparisons are concatenated into a single 256‑bit binary string. This string is the dHash fingerprint, describing the coarse brightness pattern of the whole image.

  5. Compare Using Hamming Distance

    To compare two files, their 256‑bit hashes are XOR'd bit by bit. The number of positions where the bits differ is the Hamming distance. A distance of 0 means identical hashes. The similarity threshold slider controls the maximum Hamming distance allowed for two files to be grouped as duplicates.

  6. Aspect Ratio Pre‑Check

    Before any hash comparison, Sakarto checks that the two files have similar aspect ratios. Pairs where proportions differ by more than 10% are skipped. This prevents a tall portrait from matching a wide landscape even if their gradient patterns coincidentally align.

  7. Videos — Multi‑Frame Averaging

    For video files, 3 frames are extracted at 1.5‑second intervals. Each frame is hashed separately. The 3 binary hashes are combined by majority vote per bit to produce a single representative hash for the whole file. Video scanning pauses if you switch browser tabs.

Why is dHash more robust to brightness changes than aHash? aHash compares each pixel to the <em>overall average</em> brightness of the image. If you globally brighten an image, many pixels that were previously below average become above average, changing the hash. dHash compares each pixel only to its <em>immediate neighbour</em>. A global brightness shift affects both pixels equally, so their relative relationship (which one is brighter) remains unchanged, preserving the hash.

🎚️ Understanding the Hamming Threshold Slider

The Similarity Threshold slider (0–50) controls how many bits two hashes can differ and still be grouped as duplicates. It is the most important control on this page.

Low values (0–5) — Very strict

Only nearly identical files match. Use for finding exact copies and directly re‑exported versions. Very few false positives. May miss files with significant compression differences.

Medium values (6–20) — Balanced (default: 10)

Catches re‑saved copies, different resolutions of the same image, heavy JPEG compression, and noisy re‑scans of photos. The default of 10 is a good starting point. dHash tolerates more variation than aHash at the same threshold.

High values (21–50) — Loose

Groups images with broadly similar coarse brightness distributions. Because dHash is already a coarse descriptor, high thresholds can produce a lot of false positives — use with care and always review before deleting.

Re‑clustering is instant. When you release the slider, all already‑scanned hashes are re‑grouped using the new threshold in a background Web Worker — no re‑scanning needed. The scan only runs once per folder.
Lower = stricter. The slider measures the maximum number of differing hash bits allowed. A value of 0 means “accept only identical hashes.” A value of 50 means “accept up to 50 bit differences out of 256.”

✅ What It Finds — and What It Might Miss

✅ Finds Well
  • Exact byte‑for‑byte copies
  • The same photo at different resolutions
  • Re‑saved copies in different formats (JPEG → PNG → WebP)
  • Heavily compressed or low‑quality JPEG versions
  • Scanned photos with sensor noise or print grain
  • Re‑encoded files with visible compression artifacts
  • Screenshots of the same image
  • Videos with broadly similar key‑frame brightness
⚠️ May Struggle With
  • Heavily cropped versions (large area removed changes gradients entirely)
  • Rotated or mirrored images
  • Images with heavy colour filters or dramatic brightness edits
  • Fine details that differ only at the pixel level within blocks
  • Images with large text or watermarks overlaid
  • Two images that share an overall brightness structure by coincidence
dHash is an excellent first‑pass filter for large collections. Run it first for speed and noise‑tolerance, then use pHash or Color Signature on smaller batches where you need more precision, or ORB for rotated or perspective‑warped copies.

📋 Step‑by‑Step: How to Use Sakarto dHash

Step 1

Select a Folder to Scan

Click 📁 Select Folder to Scan to open a native folder picker (Chrome / Edge). Or drag and drop a folder onto the page. In Firefox or Safari, use the file input fallback.

Enable Fast Mode for JPEG‑heavy libraries. It reads the embedded EXIF thumbnail instead of the full image — 5–10× faster, with the same duplicate detection accuracy in almost all cases.
Step 2

Wait for the Scan

A progress bar shows how many files have been processed. dHash is one of the fastest algorithms in Sakarto — gradient comparison is very computationally light. Duplicate groups appear live as they're found. You can start reviewing before the scan finishes.

Step 3

Adjust the Similarity Threshold

After the scan, use the Similarity Threshold slider to tune how strict matching is. Releasing the slider re‑clusters all results instantly in a background worker — no re‑scan needed. Start at the default of 10. Because dHash is a coarse algorithm by design, it often catches everything useful at lower thresholds than you might need with other algorithms.

Step 4

Review the Duplicate Groups

Results are shown in numbered groups. Each group contains files that look similar to each other.

  • Click a card to select it (blue border)
  • Ctrl+Click (or Cmd+Click on Mac) to add to the compare list (purple border)
  • Click the 🔍 icon on hover to preview full size
  • Right‑click any card for the context menu
  • Click & drag on empty space to box‑select multiple cards
Step 5

Compare Side‑by‑Side

Ctrl+Click two or more cards, then click ⚖️ Compare in the toolbar. A modal opens with full metadata (dimensions, size, type, path) and a similarity percentage for each pair. For 3+ files, a pairwise similarity matrix is shown. Use this to verify borderline matches before acting — dHash can occasionally group images that share a brightness structure without being true duplicates.

Step 6

Take Action — Move, Delete, or Copy

Select files and use the toolbar buttons. With Queue Mode on (recommended), files are staged for review first:

📋 Copy Copy filename(s) to clipboard
📂 Move Stage for move to a named folder
🗑️ Delete Stage for permanent deletion
⚖️ Compare View selected files side‑by‑side
Step 7

Queue Mode — Review Before You Commit

When Queue Mode is enabled (the default), clicking Move or Delete stages files in a queue instead of acting immediately. Switch to the Move Queue or Delete Queue tab in the sidebar to review what's staged, remove individual files, then execute when ready.

With Queue Mode disabled, a confirmation dialog appears and the operation runs immediately after you confirm.

🏛️ Quick Reference — Buttons & Controls

🏛️ Quick Reference — Buttons & Controls
Button / ActionWhat it does
🔄 New SearchReload the page and start a fresh scan
📋 Copy (N)Copy selected filenames to clipboard. N = count selected.
📂 Move (N)Move selected files or stage them in the Move Queue
🗑️ Delete (N)Delete selected files or stage them in the Delete Queue
✕ Deselect AllRemove selection from all cards
⚖️ Compare (N)Open the compare modal for Ctrl+clicked files. Needs 2+.
🔇 VideosToggle mute/unmute for all video cards
Queue Mode checkboxWhen checked: stage files for review before executing. Recommended.
Fast Mode checkboxUse EXIF thumbnail for JPEG scanning — much faster. On by default.
Scan Images checkboxInclude or exclude image files from the scan
Scan Videos checkboxInclude or exclude video files from the scan
Similarity Threshold sliderMaximum Hamming distance for grouping. Lower = stricter. Re‑clusters on release.
Click cardSelect / deselect the file
Ctrl + Click cardAdd / remove from compare list (purple border)
Click & drag (empty area)Box‑select multiple cards at once
Ctrl + dragAdd to existing selection with box
Right‑click cardContext menu: Copy / Move / Delete / Compare
🔍 hover iconOpen full‑size preview with metadata and action buttons
Hover video cardAuto‑play the video clip

⭐ What Users Say

Based on 156 reviews

"I have thousands of old JPEGs from various cameras and scanners — different qualities, lots of compression artifacts. dHash found duplicates that aHash missed completely. The gradient approach really works."

"This saved me hours of manual sorting. I scanned my entire photo archive of 25,000 files — dHash found 900 duplicate groups in under 4 minutes. The threshold slider let me fine‑tune the results perfectly."

"dHash is my go‑to first pass for messy collections. It catches all the obvious duplicates and handles varying image quality really well. I then use Compare to verify the borderline cases."

"I run a media archiving service and dHash is my secret weapon for processing large client collections. The noise tolerance is remarkable — images that have been re‑encoded 5 times still get grouped correctly."

💡 Tips for Best Results

Back Up First

Always back up your files before deleting anything. Deleted files bypass the recycle bin and cannot be recovered.

Use dHash as a First Pass

dHash is ideal for quickly filtering a large collection down to candidate groups. Once you have the groups, use Compare to verify each one before acting.

Start Stricter Than You Think

Because dHash is inherently a coarse descriptor, even a threshold of 5–8 will catch many obvious duplicates. Start low and raise only if you're missing known copies.

Always Use Compare for Borderline Groups

Two images that share a coarse brightness structure can match at moderate thresholds without being true duplicates. Use Ctrl+Click → Compare to view them side‑by‑side before deciding.

Move, Don't Delete

Use Move to a “Sakarto‑Duplicates” folder instead of deleting outright. Review the staged files over a few days before permanently removing anything.

Need More Precision? Try pHash

If dHash is grouping images you consider different, switch to <strong>pHash</strong> (DCT‑based) or <strong>Color Signature</strong> for tighter matching that distinguishes fine details better.

⚠️ Known Limitations

dHash is a coarse descriptor — it can over‑match.

Because brightness is compared only to immediate neighbours, two genuinely different images that share a similar overall brightness layout can produce the same or very similar hashes. This is less of a problem at low thresholds, but at values above 15 you should always use Compare to verify groups before acting.

Color is not compared — only brightness.

Like aHash, dHash converts everything to grayscale before processing. Two images with identical brightness patterns but completely different colours will produce the same hash. If colour accuracy matters, use <strong>Color Signature</strong> instead.

Rotation and mirroring break matching.

A rotated or mirrored version of an image will have different gradient directions, producing a very different hash. For rotation‑tolerant matching, use <strong>ORB Feature Matching</strong>.

No undo for file deletion.

The File System Access API bypasses the OS recycle bin. Deleted files are gone permanently. Use Queue Mode to review before executing — it exists for exactly this reason.

Video scanning pauses when you switch tabs.

Browsers throttle background video decoding. Video processing pauses when the tab is hidden and resumes automatically when you return. Image hashing (in the Web Worker) is unaffected and continues at full speed.

Move and Delete require Chrome or Edge.

The File System Access API is only available in Chrome 86+ and Edge 86+. Firefox and Safari can scan and display results but cannot move or delete files. Use “Download List” to export results in those browsers.

🔒 Privacy & Security

Zero network activity after page load. Open DevTools → Network tab and verify: no outbound requests during any scan, hash computation, or file operation.
No accounts, no cookies, no analytics. The only localStorage data saved is your OS detection and checkbox preferences. No file names, paths, or hashes are ever saved or transmitted.
Folder access is scoped and session‑only. Permission is granted only for the specific folder you select, lasts only while the tab is open, and is revocable at any time from browser site settings.
Purely static — no backend. Sakarto is HTML, CSS, and JavaScript. There is no server, no database, and no API receiving your data.

❓ Frequently Asked Questions

How is dHash different from aHash, and when should I choose it?
Both are brightness‑based perceptual hashes compared using Hamming distance, but they encode brightness differently. aHash shrinks to 16×16 individual pixels and compares each pixel to the overall average brightness of the image. dHash compares each pixel only to its immediate neighbour. A global brightness shift affects both pixels equally, so their relative relationship remains unchanged, preserving the hash. Choose dHash when your duplicates have varying brightness or exposure levels.
Two clearly different photos are being grouped together. How do I fix it?
dHash is intentionally a coarse descriptor. Two photos with a similar broad brightness layout — both mostly bright sky above and dark ground below, for example — can produce matching hashes even if they show completely different scenes. Lower the similarity threshold slider to 3–6 to require hashes to be much closer before files are grouped. If false positives still occur at low thresholds, switch to pHash (frequency‑domain encoding, more discriminating) or Color Signature (also compares colour, not just brightness) for finer‑grained matching.
I know two files are duplicates but they aren't being grouped. What should I try?
First, raise the threshold slider toward 15–20. Second, check aspect ratios — pairs where one file's proportions differ from the other by more than 10% are excluded by the pre‑check before hashing runs. A portrait version will never match a landscape version regardless of threshold. Third, if one file is rotated or heavily cropped, dHash won't match it — try ORB Feature Matching, which is the only algorithm that handles geometric transformations.
Why is dHash described as “robust to brightness changes”? What counts as a brightness change?
In this context, “brightness change” means a global shift in exposure or brightness (e.g., an image that was brightened in post‑processing). Because dHash compares each pixel only to its immediate neighbour, a global brightness shift affects both pixels equally, so their relative relationship (which one is brighter) remains unchanged, preserving the hash. It does not protect against local brightness edits (like dodging/burning) or heavy colour grading.
What does Fast Mode do, and does it affect dHash accuracy?
Fast Mode reads the small EXIF thumbnail embedded in JPEG files (typically around 160×120 pixels) instead of decoding the full image. This is 5–10× faster with no meaningful accuracy cost for dHash, because dHash averages brightness over large blocks and is already insensitive to fine detail. The main reason to turn Fast Mode off is if your JPEG files were saved without EXIF thumbnails — some cameras and image editors strip them — in which case Fast Mode falls back to reading the full image anyway.
Why does video scanning pause when I switch tabs?
Browsers stop processing video elements when a tab is hidden, to conserve battery and CPU. Sakarto uses the Page Visibility API to detect this and automatically pauses video frame extraction. It resumes immediately when you return to the tab. Image hashing runs in a background Web Worker, which is not affected by tab visibility — images continue scanning at full speed no matter which tab you're looking at.
Can I recover files after deleting them?
No. The File System Access API's remove() method permanently deletes files without using the OS Recycle Bin or Trash. Queue Mode is enabled by default for exactly this reason: it stages files for review before anything is actually deleted. Use the full‑size preview icon and the Compare modal to verify each group before executing a deletion. If you're unsure, use Move instead of Delete — moved files go to a “Sakarto‑Duplicates” subfolder you can review and manually restore from.
What file types are supported?
Images: JPEG, PNG, GIF, WebP, BMP. Videos: MP4, WebM, MOV, MKV. Files over 40 MB are silently skipped. HEIC/HEIF, SVG, RAW formats (CR2, NEF, ARW, DNG), and TIFF are not currently supported — browsers cannot natively decode these formats. Convert them to JPEG or PNG before scanning if needed.
Does this work on Firefox or Safari?
Scanning, hash computation, result display, and the Compare modal all work in Firefox and Safari. Move and Delete are the exception — they require the File System Access API, which is only available in Chrome 86+ and Edge 86+. In other browsers, run the full scan, review groups in the Compare modal, and use Download List to export a report so you can handle the files manually in your OS file manager.