Aadhaar
Validator, formatter, and masker for Aadhaar numbers issued by UIDAI.
Aadhaar is the 12-digit unique identity number issued by the Unique Identification Authority of India (UIDAI) to every Indian resident. It is required for:
Opening bank accounts (RBI KYC mandate)
Filing income tax returns
SIM card activation (TRAI mandate)
Government welfare benefit disbursement (DBT)
eKYC onboarding at regulated financial institutions
Format: 12 digits, first digit must be 2–9 (UIDAI never issues numbers starting with 0 or 1).
Checksum: Verhoeff algorithm (dihedral group D5). Implementation in io.github.kotindia.internal.Verhoeff — cross-referenced against Wikipedia D5 spec and mastermunj/format-utils JS implementation before finalising lookup tables.
Aadhaar is Private government-level PII protected under the Aadhaar Act 2016, IT Act 2000, and India's DPDP Act 2023. Always mask before logging or displaying. See mask for PII-safe display options.
Accepted input forms (all normalised before validation):
Raw:
"234567890121"UIDAI spaced:
"2345 6789 0121"— spaces stripped before validationPartial spacing:
"2345 67890121"— strippedWhitespace-padded:
" 234567890121 "— trimmed + stripped
This object is stateless and thread-safe.
Samples
Aadhaar.validate("234567890124") // ValidationResult.Valid
Aadhaar.format("234567890124") // "2345 6789 0124"
Aadhaar.mask("234567890124") // "XXXXXXXX0124"