What Is Perceptual Hashing and How Platforms Use It
Perceptual hashing (pHash) turns an image or video frame into a short "fingerprint" that stays nearly the same even after the file is resized, re-compressed, or lightly edited — so platforms can match a new upload against a database of known content by comparing fingerprints instead of pixels. Unlike metadata, a perceptual hash is computed from the visual content itself. That single fact makes it a fundamentally different layer from provenance scanning — and one that file-level cleanup does not defeat. This article explains it plainly, including that honest limitation.
How it started: from exact hashes to "close enough" hashes
Traditional cryptographic hashes (like SHA-256) were built to be fragile: change one pixel and the hash changes completely. That is perfect for verifying a file is byte-for-byte identical — and useless for catching the same image re-saved at a different size, which produces a totally different cryptographic hash.
Content-matching needed the opposite property: a fingerprint that survives everyday transformations. Perceptual hashing emerged to fill that gap. The best-known public example is Microsoft's PhotoDNA (developed with Dartmouth researcher Hany Farid around 2009), widely adopted to detect known child-safety imagery. Later, Facebook/Meta open-sourced PDQ and TMK+PDQF in 2019 for image and video matching, and Apple publicly described a perceptual-hash system (NeuralHash) in 2021. The academic pHash library popularized the term. These systems share one goal: give near-identical fingerprints to near-identical content.
How it works: the mechanism, step by step
A perceptual hash is designed to throw away the details that change under re-encoding and keep the structure that a human eye recognizes. A classic pHash pipeline looks like this.
Step 1 — Normalize the image. Shrink it to a tiny fixed size (often 32×32) and convert to grayscale. This deliberately discards color, resolution, and fine detail — the things most likely to change when a file is re-saved or resized. What remains is coarse structure.
Step 2 — Extract the dominant structure. Apply a mathematical transform (commonly a Discrete Cosine Transform, the same family used in JPEG) and keep only the low-frequency components — the broad light/dark layout of the image. High-frequency noise, which shifts with compression, is dropped.
Step 3 — Reduce to bits. Compare each of those low-frequency values to the median and record a 1 or 0. The result is a compact binary string, often 64 bits — the perceptual hash. Two visually similar images produce two very similar bit strings.
Step 4 — Match by distance, not equality. To compare, count how many bits differ between two hashes (the Hamming distance). Identical or near-identical images have a tiny distance; unrelated images have a large one. The platform sets a threshold: below it, the upload is treated as a match to a known file.
Step 5 — Look up against a database. New uploads are hashed and checked against a stored set of fingerprints — known misinformation, banned imagery, copyrighted clips, or previously removed posts. A close match triggers whatever action the policy attaches to that entry: block, label, or review.
Why it works: by design, the hash ignores exactly the properties that change during ordinary re-encoding (size, format, small crops, compression) while preserving overall visual structure. That is what lets it catch "the same content, re-uploaded" at scale, cheaply, across billions of files.
The honest part: perceptual hashing is a layer Calabi does NOT defeat
This is the crucial takeaway, and it deserves to be blunt.
A perceptual hash is computed from what the image looks like, not from its metadata. Metadata normalization — stripping C2PA provenance, clearing AI flags, presenting camera-capture identity — changes the file's self-description. It does not meaningfully change the visual structure a pHash measures. Resize, re-encode, or re-tag a file all you want; if the picture still looks like the picture, its perceptual hash stays close, and a match still fires.
Calabi Sanitizer operates at the file/metadata layer and does not defeat perceptual hashing. It does not change how an image looks, and changing how an image looks is the only thing that would move a perceptual hash — which would mean altering the visual content itself, something a metadata tool neither does nor claims to do. If content is being matched by pHash (say, a known clip already in a platform's database), file-level cleanup is the wrong layer for that problem, and any tool claiming otherwise is misleading you.
Being clear about this is part of using the right tool for the right layer: metadata scanning and perceptual matching are separate systems, and each is defeated (or not) by separate means.
What this means for a creator
Use the mental model of layers. Provenance/metadata scanning trusts what the file says — that layer responds to file-level hygiene. Perceptual hashing measures what the file shows — that layer responds only to visual changes. Knowing which layer you are dealing with tells you whether metadata work is even relevant. For brand-new AI content that has never been in a matching database, pHash has nothing to match against; for known, previously-flagged content, pHash is decisive and metadata is beside the point.
FAQ
How is perceptual hashing different from a normal file hash?
A cryptographic hash (like SHA-256) changes completely if a single byte changes, so it only detects byte-identical files. A perceptual hash is built to stay nearly the same after resizing or re-compression, so it detects visually similar content — a fundamentally different and more forgiving kind of match.
Can editing metadata change a perceptual hash?
No. A perceptual hash is computed from the visual content, not the metadata. Stripping or rewriting metadata leaves the image's appearance unchanged, so its perceptual fingerprint stays essentially the same and any match still fires.
Does Calabi defeat perceptual hashing?
No, and it does not claim to. Calabi works at the file/metadata layer and never alters how an image looks. Only changing the visual content would move a perceptual hash, which is outside what a metadata-normalization tool does.
Calabi Sanitizer automates the file-level cleanup described here — try it free at calabilabs.com (10 cleans, no card).
Related reading
- How AI Content Detection Works 2026
- What Is C2PA Content Credentials Explained
- The History of AI Watermarking
- How to remove C2PA content credentials
- Strip metadata from video
- Why Your AI Content Gets No Views and How to Fix It
- Remove AI watermarks — every tool