Skip to content

Identifier detector

Indian Aadhaar number: format, validation and detection

Updated Indianational ID numberDetector key in_aadhaar

Short answer

An Aadhaar number has 12 digits, never starts with 0 or 1, and ends in a Verhoeff check digit. Maskflare also rejects numbers made of one repeated digit.

What it is

Aadhaar is the 12-digit identity number issued in India. Maskflare's India pack covers it as a national ID, with an unformatted sibling detector.

In Maskflare this is the detector in_aadhaar, labelled "India - Aadhaar number", category national id number, in the India pack.

Format and layout

  • 12 digits, printed in groups of four: 2341 2341 2346.
  • The first digit is 2 to 9.

How the check works

The Verhoeff algorithm: a check based on the dihedral group D5, using a multiplication table and a permutation table. Digits are processed from the right, and a valid number leaves a running value of 0.

Valid and invalid examples

Synthetic values. Each was run through Maskflare's own validator and pattern when this page was generated.
ExampleResultWhy
2341 2341 2346ValidMatches the layout and passes the validator.
2341 2341 2340InvalidThe invalid example changes one character, the last character: 6 becomes 0.

In running text the valid example reads, for instance, Aadhaar 2341 2341 2346. The invalid one is left alone: a value that fails the validator is treated as an ordinary string.

Regex and validation caveats

  • Verhoeff catches all single-digit errors and most transpositions, so random 12-digit numbers pass about one time in ten.
  • The pattern requires a space or hyphen between the groups of four. Unseparated 12-digit runs belong to a sibling detector that needs a keyword before the number.
  • The example is synthetic: a test value that passes the check, not a number issued to anyone.

How to detect it in LLM traffic

Indian Aadhaar number values reach an LLM inside ordinary work rather than as standalone data: a pasted block of HR or payroll rows, a customer-support thread, an onboarding or identity-check form, a spreadsheet someone wants summarised, or an email they want rewritten. The model needs none of the digits for any of those jobs, so the safest place to remove them is before the request leaves the company.

Maskflare reads the whole request body, including the system prompt, earlier messages and tool arguments, so a number buried in the fourth message of a long chat is found as readily as one in the latest message. Each match is replaced with a token such as mf_mask_d7e0 before the request goes out, and with response restoration turned on the real value is put back into the answer for the person who is allowed to see it.

If you build the detection yourself

  1. Strip spaces, dots and hyphens before running any arithmetic, but remember where they were so the original text can be replaced exactly.
  2. Match the shape with a pattern anchored on word boundaries, so that a long digit string is not read as several shorter Indian Aadhaar number candidates.
  3. Run the check from the section above. A failing check is almost always a typo or a made-up value; a passing one removes most look-alikes.
  4. Replace the value before the text is sent anywhere, and keep a mapping if the answer has to be restored afterwards.

How Maskflare handles it

  • Protect now, Finance - Protect now, Healthcare and Developer: mask (a reversible token) when India is a primary country.
  • Monitor first: alert (counted, forwarded unchanged) when India is a primary country.

The available actions are mask (reversible token), redact, partial, hash, format-preserving encryption, generalize, alert and block. Masked values are kept encrypted for 30 days so that answers can be restored, then they expire; prompts and responses are not logged. The full list of detectors is in the detector reference.

Compliance profiles that include it

None of the 6 compliance profiles (HIPAA Safe Harbor, GDPR (EU/EEA), UK GDPR, PCI DSS v4.0, US PII (CCPA/CPRA) and Swiss nDSG health data) includes the India pack, so no profile turns this detector on. It runs when the pack is enabled directly, or when India is chosen as a primary country.

Frequently asked questions

What is the Verhoeff algorithm?

A check digit scheme that detects all single-digit errors and adjacent transpositions, used for Aadhaar numbers.

Why does Maskflare reject Aadhaar numbers starting with 0 or 1?

The validator requires the first digit to be 2 to 9.

Is the Indian Aadhaar number detector on by default?

It depends on the organisation's primary countries. It is part of the India pack, which the default Protect now template turns on with the action mask when India is a primary country.

Does a valid Indian Aadhaar number prove the person exists?

No. A check digit shows the value is well formed. Many valid-looking numbers have never been issued, and Maskflare masks them all the same.

Rules on this page describe what Maskflare's detectors and validators check. They are read from the detection catalogue and are not the specification of the body that issues the identifier. Examples are synthetic.

Related pages

See it on your own data

Try Maskflare free.
Bring your hardest prompts.

28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.