← Back to blog

Reverse Image Search with aHash: The Fastest Way to Find Copies of a Reference File

Upload a reference image or video and Sakarto finds all similar copies using aHash (Average Hash) — the fastest algorithm for large folders. Perfect for finding resized, re-compressed, and format-converted copies of a specific file. Free, browser-based, and 100% private.

Sakarto aHash reverse search interface showing reference pinned and protected with matched files below

The duplicate finder is great when you don’t know what you’re looking for. It scans a folder and automatically groups everything similar. But what if you already know exactly which file you want copies of?

That’s where Reverse Image Search comes in. Instead of grouping everything, you upload one reference file first. Sakarto processes it immediately, then scans your chosen folder and returns only the files that look like that specific reference. The reference is pinned at the top with a protected badge—it can never be accidentally moved or deleted.

With the aHash (Average Hash) algorithm, it’s the fastest way to find copies of a specific reference. aHash is the simplest and quickest algorithm in Sakarto’s toolkit—it shrinks every image to 16×16 pixels, converts to grayscale, and produces a 256-bit fingerprint based on average brightness. It reliably finds resized, re-compressed, and format-converted copies of your reference in milliseconds per file.


What makes aHash reverse search different from other algorithms?

All hash-based algorithms—Color Signature, dHash, pHash, wHash, and BlockHash—produce a hash and compare using Hamming distance. But aHash is the fastest because it uses the simplest operation: shrink to 16×16, convert to grayscale, compare each pixel to the overall average brightness, and produce a 256-bit binary hash.

The trade-off is precision. aHash only captures broad brightness structure. It discards colour, fine detail, and gradient direction. Two images with similar brightness distributions—even if they show completely different subjects—can produce similar hashes at loose thresholds. But when you’re looking for copies of a specific reference, speed often matters more than absolute precision. aHash can scan 10,000 images in under a minute, making it the ideal first pass for large folders.


How reverse search works

The standard Find Duplicate Images & Videos workflow scans a folder and compares every file against every other file. That’s O(n²) complexity—fine for a few hundred images, but it gets slower as the folder grows.

Reverse Search does something much smarter. It fingerprints your reference once, then compares each folder file only against that reference. That’s O(n) complexity—linear scaling. A folder of 10,000 images takes roughly the same time per file as a folder of 100. The scan speed depends only on the number of files, not how many of them are similar to each other.

This makes reverse search the faster choice for large folders where you already know what you’re looking for.


The reference protection system

The reference file is treated differently from every other file in the scan. When you upload it, Sakarto immediately:

  1. Computes its fingerprint using aHash
  2. Shows a thumbnail preview so you can confirm the right file was loaded
  3. Pins it at the top of the results as soon as scanning starts
  4. Displays a blue REFERENCE badge on the card
  5. Prevents it from being moved or deleted—Move and Delete buttons are disabled on the reference card

This last point is critical. If you’re using reverse search to find copies of a file you want to keep, you don’t want to accidentally delete the original. The reference protection system makes that impossible.


How the aHash algorithm works

The aHash algorithm follows a straightforward pipeline. Here’s exactly what happens when you run a reverse search:

Step 1: Process the reference file immediately

When you upload your reference file, Sakarto processes it right away—before you even select the folder to search. The image is shrunk to 16×16 pixels, converted to grayscale, and its 256-bit hash is computed. The reference card appears immediately with a blue REFERENCE badge, confirming that your file is loaded and ready.

Step 2: Shrink each folder file to 16×16

For each image in the scanned folder, Sakarto draws it onto a 16×16 canvas. This normalises all images to the same size—a 12‑megapixel photo and a 200‑pixel thumbnail both become the same 16×16 grid. In Fast Mode, JPEG files use their embedded EXIF thumbnail instead of the full image, making scans 5–10× faster.

Step 3: Convert to grayscale and compute the average

Each of the 256 pixels is converted to a single brightness value using the standard luminance formula. The average brightness across all 256 pixels is calculated. This single number becomes the threshold for the entire image.

Step 4: Generate the 256-bit hash

Each pixel is compared to the average. Brighter pixels become 1, darker become 0. The result is a 256-bit binary string—the image’s fingerprint. Two images with similar brightness structures produce similar hashes.

Step 5: Compare against the reference using Hamming distance

To compare a folder file against your reference, Sakarto XORs their 256-bit hashes bit by bit. The number of positions where the bits differ is the Hamming distance. An aspect-ratio pre-check first discards pairs where proportions differ by more than 10%. If the Hamming distance is at or below the threshold, the file is added to the results.

Step 6: Reference pinned first, matches rendered live

The reference card always appears at position 0 with a blue REFERENCE badge. Each matching file is rendered as a card immediately when found—you see results appear live without waiting for the full scan.


What aHash reverse search finds well

Type of copyHow well it worksWhy
Exact copies of your reference✅ ExcellentThe hash will be identical.
Reference saved at different resolutions✅ ExcellentResizing to 16×16 removes resolution differences.
Re-exported copies in different formats (JPEG → PNG → WebP)✅ ExcellentCompression changes pixels but rarely changes which pixels are above or below average brightness.
Re-compressed or lower-quality versions✅ Very GoodQuality changes preserve overall brightness distribution.
Screenshots of the reference image✅ Very GoodScreenshots preserve brightness structure.
Videos sharing key visual scenes with the reference✅ GoodVideo frames are averaged.
Copies with minor brightness or contrast adjustments✅ GoodSmall adjustments change a few bits but remain close.
Heavily colour-graded or filtered copies⚠️ May missColour shifts often change brightness distributions too. Try Color Signature or pHash.
Rotated or mirrored versions❌ Won’t findA 90° rotation changes the position of every pixel in the 16×16 grid. Use ORB.
Heavily cropped versions (over 30% removed)❌ Won’t findRemoving a large portion changes the brightness distribution.
Black-and-white vs. colour versions✅ May matchBoth convert to grayscale, so they may match if luminance structure is preserved.

Understanding the Hamming threshold slider

The threshold slider determines how strictly a folder file must match your reference to be considered a copy. Lower values = stricter matching.

Threshold rangeWhat it doesWhen to use
0–5 (Very strict)Only near-identical hashes match. False positives are very rare.Finding exact copies and very close re-exports of your reference.
10–15 (Balanced)Catches resized, re-compressed, and reformatted copies.Default and recommended. Good starting point for most reverse searches.
16–25 (Loose)Includes more approximate brightness matches. More false positives.If you’re missing copies that look similar but have been significantly edited.
30+ (Very loose)Groups images with broadly similar brightness distributions.Only use for exploration. Expect many false positives—always preview before acting.

Tip: Start at 10. If you’re missing copies you know exist, raise the threshold. If you’re getting too many false positives, lower it.


How to use aHash reverse search: step by step

Step 1: Select your reference file

Click Choose Reference File in the left panel. Select any image or video from your computer. A preview appears immediately so you can confirm you picked the right file. Sakarto processes the reference file right away—computing its hash before you even select the folder. This means the search starts instantly once you pick a folder.

Tip: The reference file does not need to be inside the folder you’re about to scan. It can be from anywhere on your computer.

Once a reference file is loaded, the Choose Folder to Search button becomes active. Click it to open a native folder picker (Chrome/Edge). Or drag and drop a folder onto the page. The folder count shows how many files were found. The Start Search button activates once both the reference file and a folder are selected.

Tip: Enable Fast Mode in the toolbar if you’re scanning many JPEG files—it reads embedded thumbnails and is 5–10× faster than loading full images.

Click 🔍 Start Search. The reference file card appears immediately at the top of the results with a blue REFERENCE badge. A progress bar shows how many files have been scanned. You can switch browser tabs during the search—image processing runs in a background Web Worker and continues uninterrupted. Video processing pauses when the tab is hidden and resumes when you return.

Step 4: Adjust the threshold if needed

Use the Similarity Threshold slider to tune matching sensitivity. Releasing the slider triggers an instant re-search using already-computed hashes—no re-scan needed. If expected copies are missing, raise the threshold. If too many unrelated files appear, lower it.

Step 5: Review matches as they appear

Every time a matching file is found, it appears as a new card next to the reference. The header count updates live. Once the scan finishes, a final summary shows the total number of similar files found.

  • Click a card to select it (blue border)
  • Ctrl+Click (Cmd+Click on Mac) to add to the compare list (purple border)
  • Click the 🔍 icon on hover to preview full size with metadata
  • Right‑click any card for the context menu (the reference card has Move/Delete grayed out)
  • Click & drag on empty space to box‑select multiple result cards

Step 6: Compare reference vs. match side‑by‑side

Ctrl+Click the reference card and one or more match cards, then click ⚖️ Compare in the toolbar. A modal opens showing all selected files side‑by‑side with their dimensions, file size, path, and a similarity percentage. For 3+ files, a full pairwise similarity matrix is shown. Similarity percentages above 80% are shown in green, 50–80% in amber, and below 50% in red—giving you a quick visual indicator of how close each match is to your reference.

Step 7: Act on matches—Move, Delete, or Copy

Select the files you want to act on (not the reference—it’s protected) and use the toolbar. With Queue Mode on (recommended), files are staged first:

  • 📋 Copy — copy filename(s) to clipboard
  • 📂 Move — stage matches for move to a named folder
  • 🗑️ Delete — stage matches for permanent deletion
  • ⚖️ Compare — view selected files side‑by‑side

Warning: Deletions are permanent. The File System Access API bypasses the recycle bin. Always use Queue Mode to review before executing. The reference file cannot be deleted or moved.

Step 8: Queue Mode—review before you commit

When Queue Mode is enabled (the default), clicking Move or Delete stages files rather than 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.


Reverse Search vs. Find Duplicates: which to use?

Reverse SearchFind Duplicates
What it doesFinds copies of one specific reference fileGroups all similar files in a folder
ComplexityO(n) — each file compared against referenceO(n²) — all files compared against each other
SpeedFaster for large foldersSlower for large folders
Reference protectionYes — reference pinned and cannot be deletedNo — all files are treated equally
Best forYou know exactly which file you’re looking forYou want to see every duplicate group in a folder
When to use”I need to find every copy of this specific photo""I need to clean up my entire photo library”

Recommendation: Use both. Run Find Duplicates to see the big picture. Then use Reverse Search for specific important files to clean up their copies without risking the originals.


Sakarto gives you seven visual algorithms for a reason—each one handles a different type of duplication problem. Here’s when to pick aHash over the others:

Color Signature — colour accuracy

Color Signature is the only algorithm that compares actual colour.

Use aHash instead: Speed is your priority and colour accuracy doesn’t matter. aHash ignores colour, making it much faster than Color Signature.

BlockHash — noise tolerance

BlockHash averages brightness over blocks, making it tolerant of compression noise.

Use aHash instead: Your reference’s copies are clean and you need maximum speed. aHash is faster than BlockHash for most use cases.

dHash (Difference Hash) — brightness and exposure-adjusted copies

dHash encodes gradient directions and handles exposure shifts well.

Use aHash instead: Your reference’s copies aren’t dramatically exposure-adjusted. aHash handles minor brightness changes and is much faster.

pHash (Perceptual Hash) — format conversions and watermarks

pHash uses the Discrete Cosine Transform to extract low‑frequency structural data—the most precise hash algorithm.

Use aHash instead: You need speed for a very large folder. pHash is more accurate but significantly slower than aHash.

wHash (Wavelet Hash) — speed and quality balance

wHash uses the Haar Wavelet Transform—similar quality to pHash at lower CPU cost.

Use aHash instead: You need the absolute fastest search possible. wHash is faster than pHash but still slower than aHash.

ORB (Feature Matching) — rotation, cropping, and perspective

ORB is the only algorithm that handles rotation, cropping, and perspective distortion.

Use aHash instead: Your reference’s copies are not rotated or heavily cropped. aHash is 100× faster than ORB for this use case.

aHash — speed specialist

aHash is the fastest algorithm for reverse search. Use it when speed is your priority and you want to find resized, re-compressed, and format-converted copies of your reference.

Use aHash when: You have a very large folder (10,000+ files) and speed is your primary constraint. You’re looking for resized, re-compressed, or format-converted copies of your reference.


AlgorithmBest forColour‑aware?Handles rotation?Handles cropping?Speed
Color SignatureSame colour palette, social media re‑uploads✅ Yes❌ No❌ NoFast
aHashLarge folders, speed priority❌ No❌ No❌ NoFastest
BlockHashHeavily compressed JPEGs, noisy images❌ No❌ No❌ NoVery Fast
dHashBrightness/exposure‑adjusted copies❌ No❌ No❌ NoVery Fast
pHashFormat conversions, watermarks, precision❌ No❌ No❌ NoFast
wHashSpeed + quality balance❌ No❌ No❌ NoFast
ORBRotated, cropped, perspective‑warped❌ No✅ Yes✅ YesSlower

Privacy: your files never leave your device

Like every Sakarto tool, the reverse image search runs entirely in your browser:

  • Zero network activity after page load. Open DevTools → Network tab and verify: no outbound requests during any search, compare, or file operation. Your reference file and folder contents are never transmitted anywhere.
  • No accounts, no cookies, no analytics. The only localStorage data is your OS detection and checkbox preferences. No file names, paths, or scan results are ever saved.
  • 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 any data from you.

Frequently asked questions (aHash reverse search specific)

“Does my reference file need to be inside the folder I’m scanning?”

No—select the reference from anywhere on your computer. If it also lives inside the scanned folder, Sakarto detects and skips it automatically using a combination of filename, file size, and last‑modified timestamp, so it won’t appear as a false match to itself. You can safely scan a folder that contains your reference file without any special setup.

”Why is the reference card shown before I’ve even selected a folder?”

Sakarto computes the reference hash immediately when you upload the file—before any folder scanning starts. This serves two purposes: you can see and verify the file you selected (and preview it), and the reference hash is fully ready the moment you pick a folder so scanning begins instantly with no delay. All cards that appear after you select a folder are actual matches from the scan—the reference card is always pinned at position 0 as a visual anchor.

”Why does aHash reverse search work differently from the aHash duplicate finder?”

The hashing algorithm is identical—both resize to 16×16, convert to grayscale, and produce a 256‑bit hash. The difference is in the comparison step. The duplicate finder compares every file against every other file (O(n²)), which is why it can be slow for large folders. Reverse search compares every folder file against only your one reference (O(n)), which is much faster and naturally produces results sorted by similarity to your specific file. Use the duplicate finder when you want to find all clusters of similar files; use reverse search when you already know which file you’re looking for copies of.

”A copy of my reference isn’t appearing. What should I try?”

Work through this checklist: first, raise the threshold slider toward 15–20. Second, check that the copy has a similar aspect ratio to your reference—pairs where one file’s proportions differ from the other by more than 10% are excluded by the pre‑check before hashing even runs. Third, consider the type of edit: aHash handles re‑compression, resizing, and minor brightness adjustments well, but fails for rotated or heavily cropped copies (the brightness grid shifts entirely). For rotated copies, switch to ORB Reverse Image Search. For exposure‑adjusted copies, try dHash Reverse Image Search which is specifically designed for that case.

”I’m getting too many unrelated images in my results. How do I reduce them?”

Lower the threshold slider—this requires folder files to have fewer differing bits vs the reference before being shown as a match. aHash is intentionally a coarse descriptor, so at higher thresholds it can match photos that merely share a similar brightness distribution without being actual copies of your reference. Starting at threshold 5–8 and raising from there is a good approach. If false positives persist even at very strict thresholds, switch to pHash Reverse Image Search, which encodes frequency‑domain content and is significantly more discriminating.

”How do I decide which file to keep when I find a match?”

Ctrl+Click the reference card and a match card, then click Compare. The modal shows both files side by side with exact dimensions, file size, format, and a similarity percentage. As a general rule: keep the largest file size (more bytes = more image data = better quality), or the highest resolution if file sizes are similar. If one is lossless (PNG, TIFF) and the other is compressed (JPEG), the lossless version is usually worth keeping. If both are JEPGs, the one with the higher file size has a higher quality setting. The similarity percentage gives a sense of how close the match is—values above 90% typically mean the images are perceptually near‑identical.

”What’s the best quality reference file to use for the most accurate results?”

Use the highest‑quality, uncompressed version available—a lossless PNG or high‑resolution JPEG at the original quality. A heavily compressed reference (e.g. a thumbnail or a 64k JPEG from a messaging app) will produce a noisier hash, which can cause both missed matches (genuine copies score slightly above threshold) and false positives (unrelated files happen to resemble the degraded hash). If your best available reference is lossy, try raising the threshold slightly to compensate.

”Can I recover files after deleting them?”

No. The File System Access API’s remove() method permanently deletes files without going through the OS Recycle Bin or Trash. The reference file is always protected and cannot be deleted or moved regardless. For all matched files, use Queue Mode: stage them in the Delete Queue, preview each one with the full‑size preview icon, compare them against the reference in the Compare modal, and only execute the deletion when you’re certain.

”Does this work on Firefox or Safari?”

Reference processing, folder 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 (Chrome 86+ and Edge 86+ only). In other browsers, complete the search, review results, and use Download List to export a report, then manage files manually in your OS file manager.


Final thoughts

aHash reverse search is the tool you reach for when you need maximum speed. It’s the fastest way to find copies of a specific reference image or video across a large folder. It reliably finds resized, re-compressed, and format-converted copies while ignoring colour and fine detail.

It’s particularly effective for:

  • Large folder searches. When you have 10,000+ images and need results fast.
  • First‑pass discovery. Run aHash to quickly find obvious copies, then use pHash or Color Signature for a second pass on the results.
  • Finding resized and re-compressed copies. aHash handles these reliably.
  • Quick verification. When you just need to confirm whether copies of a reference exist in a folder.

Where aHash falls short—rotated, colour‑graded, or heavily cropped copies—other Sakarto algorithms fill the gap. Use ORB for rotated or cropped copies, pHash for precision, or Color Signature for colour‑aware matching.

But for speed, nothing beats aHash. It’s the tool you reach for when your folder is too big and your time is too short.

Ready to find every copy of your reference image or video at lightning speed?

May 24, 2026
⏱ 20 min read
🇬🇧 English