← Back to Explainers
LEAKLENS EXPLAINER · 2026-08-30

k-Anonymity: Checking Leaks Without Giving Away Your Email

LEAKLENS EXPLAINER · CIVIC TECH GUIDE

# k-Anonymity: Checking Leaks Without Giving Away Your Email

The mathematics and privacy design of prefix-based checking systems that guarantee your credentials never leave your browser


5 — characters of your password's hash sent to the server (not your password) 6 — characters used for email/username range queries ~1,048,576 — possible hash prefixes a single password could fall into 0 — full passwords or emails that ever reach the server
Editorial note: This piece describes the k-anonymity model as implemented by HaveIBeenPwned (Pwned Passwords and the range-search API), the most widely deployed version of this design. Other leak-checking tools may implement the same idea differently, or not at all — always check a tool's own documentation before trusting it with anything sensitive.

The problem this solves

Every "check if your password/email has leaked" tool has an obvious trust problem: to check something, it looks like you have to hand it over. Type your real password into a form on some website you've never heard of, and you've just done the thing every security guide tells you not to do — except now you're doing it specifically to find out if your password is already compromised.

k-anonymity is the piece of math that makes this contradiction avoidable. It lets a server answer "have you seen this?" without ever being told what "this" is.

How it actually works, step by step

Take a password. Say it's a bad one — qwerty123.

  • Your device hashes it locally, using SHA-1, before anything is sent anywhere. The hash of qwerty123 is a fixed 40-character string. Hashing happens in your browser or app — the plaintext password never leaves your device.
  • Only the first 5 characters of that hash are sent to the server. Not the password. Not the full hash. Five hex characters.
  • The server looks up every hash it knows about that starts with those same 5 characters, and sends back the full list — typically a few hundred entries, each showing the remaining 35 characters of the hash plus how many times it's appeared in known breaches.
  • Your device checks the list locally, looking for the one suffix that completes its own hash. If it finds a match, your password has been seen in a breach. If not, it hasn't. Either way, this comparison happens on your side, so the password itself remains private.
  • The server never learns your password. It doesn't even learn your hash — only a 5-character prefix that, by design, matches hundreds of other hashes too.

    Why 5 characters, specifically

    This isn't arbitrary. SHA-1 hashes split cleanly into 16^5 — 1,048,576 — possible prefixes. HaveIBeenPwned creator Troy Hunt has explained the tradeoff directly: go one character shorter (4), and each server response gets 16 times larger, slowing things down for no privacy benefit. Go one character longer (6), and each response gets 16 times smaller — fewer possible matches sharing your prefix, which starts to erode the anonymity set that makes this whole thing work. Five is described as the sweet spot between response size and anonymity.

    That "anonymity set" is the actual point. If your prefix is shared with, on average, several hundred other hashes, the server genuinely cannot tell which one is yours. That's what makes this k-anonymity rather than just "sending less data" — k, here, is roughly the size of that shared group.

    Emails work the same way, with one twist

    Checking an email address against a breach database uses the same range-query idea, but with a 6-character prefix instead of 5. That extra character matters: 16^6 is roughly 16.7 million possible prefixes, sixteen times more than the ~1,048,576 used for passwords. The reasoning is symmetrical to the password case: there are far more distinct email addresses in circulation than there are distinct passwords in common use, so a larger prefix space is needed to keep each response's anonymity set reasonably sized rather than either too large or too identifying.

    What this design does not protect against

    Worth being precise about the limits, because "your credentials never leave your browser" can sound like a stronger guarantee than it is:

    Why this matters for a tool like this one

    Any leak-checking tool that asks for your email or password and doesn't explain — specifically, technically — what happens to that input before it reaches a server is asking for trust it hasn't earned. k-anonymity is one of the few designs in this space where you don't have to take that trust on faith. Here's how to check it yourself, on any tool that claims to use it:

  • Open your browser's developer tools (F12, or right-click → Inspect) and go to the Network tab. (Safari has developer tools turned off by default — enable them first via Settings → Advanced → "Show features for web developers," then Develop → Show Web Inspector.)
  • Run a password or email check as normal.
  • Look at the outgoing request. If the tool is doing this correctly, you'll see a short request — 5 or 6 characters — going out, not your full email or password in plaintext.
  • If instead you see your actual email address or password sitting in the request body or URL, the tool isn't doing what it claims, regardless of what its marketing copy says. That's a rare property for a privacy claim to have — you can verify it yourself in under a minute — and it's why this model has become the standard the rest of the industry gets measured against.


    Sources (accessed August 2026):