Skip to content

Image hash

Perceptual hash (aHash, pHash, dHash) for finding visually similar images without a server.

Computes three classic perceptual hashes for one image, or compares two. Unlike MD5/SHA, perceptual hashes produce similar fingerprints for visually similar images — even if they differ in size, format, compression level, gamma or minor retouching. aHash (Average): downscale to 8×8 grayscale, compare each pixel against the mean → 64 bits. Fast, but sensitive to contrast. pHash (Perceptual): downscale to 32×32 grayscale, run a 2D DCT, take the top-left 8×8 block of low frequencies (overall shape), exclude the DC component, compare the remaining 63+1 values to the median → 64 bits. The most robust to resizing and colour change. dHash (Difference): downscale to 9×8 grayscale, compare adjacent pixels in each row → 64 bits. Robust to gamma correction. Each hash is shown as a 16-character hex string. When two images are loaded, the tool reports the Hamming distance between hashes (number of mismatching bits out of 64): 0 — essentially identical, ≤6 — almost certainly the same image (resize / new compression), 7-15 — same subject with different processing, ≥16 — different. Useful for: finding duplicates in a local photo library without uploading to Google Photos / iCloud; spotting a slightly modified copy of a known image; quickly checking whether two shots are the same frame or two takes from the same series. No vendors, plain JavaScript. Processing happens in the browser, files never leave your device.