Compare Two Images by Perceptual Hash (pHash) Online

Perceptual hashes of PNG / JPEG images (aHash, dHash, pHash, blockhash), Hamming distance between two images, and grouping of up to 200 near-duplicates.

Free tool: 20 requests per minute.

Result

Press “Run” to see the result.

Perceptual hashes stay almost the same when a picture is resized, re-compressed, converted or lightly edited, so they find duplicate and near-duplicate images where a file checksum fails. action=hash (one image: file, file_base64 or url) returns aHash, dHash and pHash (64 bits, 16 hex digits, the definitions of the Python imagehash library) and blockhash (256 bits, blockhash.io); known (a list of hashes you keep) returns the ones within threshold.

action=compare takes two images (a + b, file + file2 or url + url2) or two hashes (hash1 + hash2) and returns the Hamming distance, a similarity score and a verdict per algorithm (identical_hash, near_duplicate, similar, different; default thresholds 10 / 64 bits and 40 / 256 bits). action=group takes images (up to 200: URLs, base64 strings or {id, url | base64 | phash} objects) and returns groups of near-duplicates with the number of unique images.

pHash uses a 32×32 discrete cosine transform of the image reduced by area averaging. Crops, rotations and mirror images are not matched. PNG and JPEG are decoded (up to 12.5 megapixels); convert WebP / HEIC first. This is not face recognition, and images and hashes are not stored.

Use this in your code

curl -X POST "https://apibox.io.vn/v1/image-phash" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "action=@./my-file"

API documentation → Get a free API key

FAQ

Which algorithm should I use?

pHash is the most robust for re-compressed and resized photos; dHash is fast and good for exact re-uploads; blockhash (256 bits) separates similar-looking images better. compare returns all of them.

What distance means "the same image"?

For 64-bit hashes, 0–10 is usually the same picture (resized, re-compressed, small watermark); above about 18 the images are different. Tune threshold for your data.

Does it find cropped or rotated copies?

No. Perceptual hashes compare the whole frame; crops, rotations and mirroring change the hash. Use feature matching for those cases.