Reverse Image & Video Search — pHash

Upload a reference file and select a folder to search for similar images and videos using pHash (Perceptual Hash) matching.

Step 1 — Select Reference File

Choose a single image or video file to use as reference

Step 2 — Select Folder to Search

Select a folder containing images/videos to search.

Ready
0 items

🔬 How pHash Reverse Image Search Works — Complete Guide

Upload one reference image or video and Sakarto scans a folder to find everything perceptually similar to it using Perceptual Hash (pHash). Particularly effective for re‑compressed, resized, and lightly edited copies. The reference card is always pinned first and protected from move or delete.

100% Private — Your Files Never Leave Your Computer All DCT computation and matching runs locally in your browser. No uploads, no accounts, no tracking. Close the tab and all data is gone.

🔁 What Is Reverse Image Search?

Reverse Image Search lets you say “find me all copies and similar versions of this specific file.” You choose one image or video as your reference, then Sakarto scans a folder and compares every file against it using the pHash frequency fingerprint.

pHash reverse search is particularly valuable when your copies may have been re‑compressed, exported at different resolutions, lightly colour‑graded, or mildly sharpened — exactly the kinds of edits that are common in photo workflows. Because pHash encodes the low‑frequency perceptual structure of the image rather than raw pixel values, it is stable across a wide range of these transformations. The reference card is always pinned at position 0 with a blue REFERENCE badge and cannot be moved or deleted.

Frequency‑Based Matching

Encodes the dominant structural frequencies of the reference. Stable across re‑compression, resizing, mild colour grading, and sharpening.

Scan Any Folder

Select a folder and Sakarto computes a pHash for every image and video in it, comparing each against your reference using Hamming distance on the 64‑bit DCT hash.

Reference is Protected

The reference card is always pinned first. It cannot be moved or deleted. All file operations apply only to matched results.

Live Results

Matches appear card by card as each file is processed. No need to wait for the full folder to finish before you can start reviewing.

🧠 How the pHash Algorithm Works

Both the reference and every folder file go through the same pHash pipeline. In reverse search, each folder file is compared only against the reference — not against each other — making it faster than the folder duplicate finder for large collections.

  1. Process the Reference File Immediately

    When you select your reference image or video, Sakarto immediately computes its pHash: resize to 32×32, convert to grayscale, apply a 2D DCT, extract the top‑left 8×8 low‑frequency coefficients, and threshold against their mean to produce a 64‑bit hash. A thumbnail preview appears so you can confirm the correct file was loaded.

  2. Resize Each Folder File to 32×32

    For each image in the scanned folder, Sakarto draws it onto a 32×32 canvas. In Fast Mode, JPEG files use their embedded EXIF thumbnail — faster with near‑identical accuracy since pHash's DCT operates on low‑frequency structure that survives thumbnail compression. Videos use 3‑frame majority‑vote averaging.

  3. Grayscale → 2D DCT → Extract 8×8 Low‑Frequency Coefficients

    Each pixel is converted to grayscale using 0.299×R + 0.587×G + 0.114×B. A separable 2D DCT is applied to the 32×32 matrix. The top‑left 8×8 = 64 coefficients representing the dominant low‑frequency structure are extracted. These are then thresholded against their own mean (excluding the DC component) to produce a 64‑bit binary hash.

  4. Compare Against the Reference Using Hamming Distance

    The folder file's 64‑bit hash is XOR'd against the reference hash. The number of differing bits 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 as a match.

  5. 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 the moment it is found. The result count and header update live during the scan.

  6. Re‑Search on Threshold Change

    If you adjust the similarity threshold slider, the search re‑runs against all already‑computed hashes in a background Web Worker — no re‑scanning needed. The reference card always stays pinned at position 0 regardless of the threshold.

O(n), not O(n²). In the folder duplicate finder, every file is compared against every other. In reverse search, each folder file is compared only against the reference — much faster for large folders, and all results are pre‑sorted by relevance to your specific reference file.

🎚️ The Similarity Threshold Slider

The Similarity Threshold slider (0–50) controls the maximum number of hash bits that can differ between a folder file and the reference for that file to appear in results. Adjusting it re‑filters results instantly against already‑computed hashes — no re‑scan needed.

Low values (0–5) — Very strict

Only near‑identical perceptual structures match the reference. Finds exact copies and directly exported versions with very few false positives.

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

Catches resized copies, re‑compressed versions, mild colour corrections, and similar edits. The default of 10 is well‑calibrated for pHash's 64‑bit hash space and a good starting point for most searches.

High values (21–50) — Loose

Includes files with broadly similar perceptual structure to the reference. Always preview before acting at these values.

Lower = stricter. The slider measures the maximum number of differing hash bits allowed. A value of 0 means “only identical frequency patterns match.” A value of 10 means “accept up to 10 bit differences out of 64.”

✅ What It Finds — and What It Might Miss

✅ Finds Well
  • Exact copies of the reference at any resolution
  • The same file re‑saved in a different format
  • Heavily re‑compressed JPEG versions
  • Copies with mild colour grading or colour profile changes
  • Versions with slight sharpening or noise reduction
  • Lightly cropped versions preserving major structural content
  • Screenshots of the reference image
⚠️ May Struggle With
  • Rotated or mirrored copies of the reference
  • Heavily cropped versions where major structures are removed
  • Dramatic colour transformations that remap overall luminance
  • Stylised versions (extreme filter effects, posterise, watercolour)
  • Very heavy JPEG compression at quality 1–5
For rotated or perspective‑distorted copies of your reference, use ORB Reverse Image Search. For copies that differ mainly in brightness or exposure, dHash Reverse Image Search is more sensitive to those specific changes. For colour‑critical matching, try Color Signature reverse search.

📋 Step‑by‑Step: How to Use pHash Reverse Image Search

Step 1

Select Your Reference File

Click Choose Reference File. Pick any image or video from your computer — it does not need to be inside the folder you're about to scan. Sakarto immediately computes its pHash and shows a thumbnail preview so you can confirm the correct file was selected.

Supported formats: JPEG, PNG, GIF, WebP, BMP (images) and MP4, WebM, MOV, MKV (videos). Files over 40 MB are not supported as reference files.

Step 2

Select the Folder to Search

Once your reference hash is ready, click Choose Folder to Search. A native folder picker opens (Chrome / Edge), or drag and drop a folder onto the page. If your reference is inside the scanned folder, Sakarto automatically skips it (matched by filename, size, and last‑modified date).

Step 3

Start the Search

Click 🔍 Start Search. A progress bar shows how many files have been processed. The reference card appears immediately at position 0 with a blue REFERENCE badge. Matching files appear live as the scan runs.

Image hashing runs in a background Web Worker — you can switch tabs freely. 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 sensitivity. Releasing the slider triggers an instant re‑search on already‑computed hashes. The default of 10 is a good starting point for pHash. If you're looking for heavily re‑compressed or colour‑graded copies, try raising it slightly toward 15–18.

Step 5

Review the Results

The reference card is pinned at position 0. All matched files follow. Use preview and compare to verify before acting:

  • Click a match card to select it (blue border)
  • Ctrl+Click the reference + a match, then click ⚖️ Compare to see them side‑by‑side with a similarity percentage
  • Click the 🔍 icon on hover to preview full size
  • Right‑click any card for the context menu (Move/Delete are disabled for the reference card)
Step 6

Act on Matches — Move or Delete

Select match cards and use the toolbar with Queue Mode on (recommended). The reference cannot be moved or deleted.

📋 CopyCopy filename(s) to clipboard
📂 MoveStage for move to a named subfolder
🗑️ DeleteStage for permanent deletion
⚖️ CompareView files side‑by‑side with similarity %
Step 7

How the Reference File is Protected

The reference card at position 0 is protected throughout the session. Move and Delete are silently blocked if you include the reference in a selection. The context menu grays out Move and Delete for the reference card. In the Compare modal, the reference card shows only a Copy button. This cannot be overridden.

🏛️ Quick Reference — All Controls

All toolbar buttons, checkboxes, and keyboard shortcuts for reverse search
Button / ActionWhat it does
Choose Reference FileSelect the image or video to search for. pHash is computed immediately on selection.
Choose Folder to SearchSelect the folder to scan. Activates after reference hash is ready.
🔍 Start SearchBegin scanning. Reference card appears immediately; matches render live.
🔄 New SearchReload the page and start fresh with a new reference file
📋 Copy (N)Copy selected filenames to clipboard
📂 Move (N)Move match files or stage in Move Queue (reference excluded)
🗑️ Delete (N)Delete match files or stage in Delete Queue (reference excluded)
✕ Deselect AllRemove selection from all cards
⚖️ Compare (N)Open compare modal for Ctrl+clicked files. Needs 2+.
🔇 VideosToggle mute/unmute for all video cards
Queue Mode checkboxStage files for review before executing. Recommended on.
Fast Mode checkboxUse EXIF thumbnails for JPEG hashing — faster with no meaningful accuracy loss.
Similarity Threshold sliderMaximum Hamming distance allowed. Lower = stricter. Re‑searches on release.
Click match cardSelect / deselect (blue border)
Ctrl + Click cardsAdd to compare list (purple border). Works on reference card too.
Click & drag (empty area)Box‑select multiple match cards at once
Right‑click cardContext menu. Move & Delete are disabled on the reference card.
🔍 hover iconOpen full‑size preview. Reference card shows “REFERENCE FILE” label.
Hover video cardAuto‑play the video clip

⭐ What Users Say

Based on 134 reviews

"pHash reverse search found duplicates that other tools completely missed — re‑compressed JPEGs, watermarked versions, even photos that had been resized and colour‑corrected. The DCT approach is genuinely impressive."

"I uploaded a specific photo and pHash found every version across my archive — different formats, quality levels, even some that had been lightly edited. The frequency‑domain approach is rock solid."

"pHash reverse search is my go‑to for finding copies of a specific file. It catches subtle duplicates that aHash misses, and the false positive rate is much lower. A fantastic all‑rounder."

"I had a logo image and needed to find all variations across thousands of documents. pHash found them all in seconds. The live results view is perfect for large folders — I can start reviewing before the scan finishes."

💡 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.

pHash is Your All‑Rounder Reference Algorithm

For finding re‑compressed, resized, or lightly edited copies of a specific reference file, pHash is usually the best starting point before trying more specialised algorithms.

Choose a High‑Quality Reference

Where possible, use an unedited or high‑quality version of the file as your reference. A reference that is itself very heavily compressed may have a less distinctive hash.

Compare Before Deciding

Ctrl+Click the reference and a match, then click Compare to see exact similarity %. pHash's frequency‑domain similarity percentage is a meaningful indicator of how perceptually close two images are.

Use Fast Mode for JPEG Folders

Fast Mode reads EXIF thumbnails instead of full images — 5–10× faster. pHash's DCT discards high‑frequency detail anyway, so thumbnail quality differences have no meaningful effect on the resulting hash.

Not Finding an Expected Match?

Raise the threshold slightly. If the copy was rotated, switch to ORB Reverse Image Search. If the copy differs mainly in brightness, try dHash Reverse Image Search which is more sensitive to those specific changes.

⚠️ Known Limitations

Rotation and mirroring break matching.

A rotated version of the reference changes the spatial arrangement of DCT coefficients significantly. A mirrored copy reverses the coefficient layout. For rotation‑tolerant matching, use ORB Reverse Image Search.

Colour is not compared — only luminance structure.

pHash converts to grayscale before the DCT. A colour version and a desaturated version of the same reference will match perfectly if their luminance structures are similar. If colour accuracy is important for your search, use Color Signature reverse search.

Reference file does not need to be in the scanned folder.

The reference is loaded independently from anywhere on your computer. If it happens to be inside the scanned folder, Sakarto detects and skips it automatically — matched by filename, file size, and last‑modified timestamp.

No undo for file deletion.

The File System Access API bypasses the OS recycle bin. Use Queue Mode to review before executing. The reference file cannot be deleted regardless.

Move and Delete require Chrome or Edge.

The File System Access API is available only in Chrome 86+ and Edge 86+. Firefox and Safari can run the search and display results but cannot move or delete files.

🔒 Privacy & Security

Zero network activity after page load. All DCT computation and matching runs locally. Open DevTools → Network tab during a search: zero outbound requests to any server.
No accounts, no cookies, no analytics. The only localStorage data saved is your checkbox preferences. No file names, paths, reference files, or hashes are ever saved or transmitted.
Folder access is scoped and session‑only. Permission is granted only for the folder you select, lasts only while the tab is open, and is revocable from browser site settings.
Purely static — no backend. Sakarto is HTML, CSS, and JavaScript. There is no server, no database, and no API endpoint receiving data from you.

❓ Frequently Asked Questions

Why is pHash the recommended all‑round choice for reverse image search?
pHash encodes the dominant low‑frequency content of an image using a Discrete Cosine Transform — the same mathematical operation JPEG compression uses internally. Low‑frequency DCT coefficients represent the structural “essence” of the image (broad shapes, overall luminance distribution, dominant lines) and are extremely stable across edits. Re‑compression, format conversion (JPEG→PNG→WebP), mild colour grading, sharpening, light watermarks, and slight resizing all affect high‑frequency detail while leaving the low‑frequency structure almost unchanged. aHash is faster but more sensitive to compression noise. dHash is better specifically for exposure‑adjusted copies. ORB handles rotation but is much slower. pHash hits the best balance of stability, precision, and speed for the widest range of typical photo duplicates.
Does my reference file need to be inside the folder I'm scanning?
No — select it from anywhere on your computer. Sakarto skips the reference automatically if it appears inside the scanned folder, matched by filename, file size, and last‑modified timestamp. The reference is always pinned at position 0 and protected from deletion regardless.
A copy of my reference isn't appearing in results. What should I try?
First, raise the threshold toward 15–18. Second, check aspect ratios — pairs differing by more than 10% are excluded by the pre‑check before hashing runs. Third, consider the type of edit: pHash handles re‑compression, format conversion, mild colour grading, and light watermarks well. It does not handle rotation (try ORB), heavy cropping that removes more than ~30% of the image (structural content shifts too much), or very extreme brightness changes that clip large areas to white or black (try dHash for brightness‑adjusted copies). Fourth, confirm the copy decodes successfully — a corrupted or unsupported format produces a garbage hash.
Can pHash find a watermarked version of my reference photo?
Usually yes — watermarks are high‑frequency content (text and logos have sharp edges and fine detail). pHash uses only low‑frequency DCT coefficients and essentially ignores high‑frequency content entirely. A logo overlay in the corner, a semi‑transparent text watermark across the image, or a copyright notice along the edge will typically produce zero or very few bit differences in the pHash compared to the unwatermarked original, so the match will appear even at strict thresholds. Very large watermarks that cover a significant fraction of the image (more than ~40%) can shift enough low‑frequency content to start affecting the hash — in that case, try a slightly looser threshold.
How does pHash handle JPEG re‑compression better than aHash?
JPEG compression works by applying a DCT to the image and discarding small high‑frequency coefficients during encoding. Each time a JPEG is re‑saved, the encoder reconstructs pixel values from the stored (partially discarded) DCT data, meaning individual pixel values change slightly with each re‑save. aHash reads individual pixel values, so these small changes can flip bits and cause mismatches. pHash directly computes the DCT and reads the low‑frequency coefficients — the same values JPEG preserves most faithfully. Re‑saving a JPEG multiple times barely changes pHash's input data, making it much more stable for re‑compressed copies than aHash.
How do I decide which file to keep when comparing a reference to a match?
Ctrl+Click the reference and the match card, then click Compare. The modal shows both files side by side with dimensions, file size, format, and a pHash similarity percentage. Values above 90% typically mean the images are perceptually near‑identical. Values of 80–90% may indicate visible but minor differences worth inspecting. As a rule: keep the largest file size (more data = better quality), or the highest resolution if sizes are similar. If one is lossless (PNG, TIFF) and the other is JPEG, the lossless version is worth keeping. For watermarked vs. unwatermarked copies, keep the unwatermarked version if quality is otherwise equal.
Why does video scanning pause when I switch tabs?
Browsers throttle video element processing when a tab is hidden. Sakarto detects this and pauses video frame extraction, resuming when you return. Image hashing runs in a background Web Worker unaffected by tab visibility — images keep scanning at full speed regardless of which tab is active.
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. The reference file is always protected. For matched files, use Queue Mode: stage, preview each one with the full‑size preview icon, compare against the reference in the Compare modal, then execute only when certain.
Does this work on Firefox or Safari?
Reference processing, folder scanning, DCT computation, result display, and the Compare modal all work in Firefox and Safari. Move and Delete require the File System Access API (Chrome 86+ and Edge 86+ only). In other browsers, complete the search and use Download List to export a report for manual file management.