PAN
Validator, formatter, and masker for Indian Permanent Account Numbers (PAN).
PAN is a 10-character alphanumeric code issued by the Income Tax Department of India, uniquely identifying taxpayers — individuals, companies, HUFs, trusts, and other entities.
Format: [A-Z]{5}[0-9]{4}[A-Z]
Characters 1–3: alphabetic (freeform, assigned by ITD)
Character 4: entity category code — one of:
P C H A B G J L F TCharacter 5: first letter of the holder's name (individuals) or entity name
Characters 6–9: four-digit sequential number
Character 10: check letter (alphabetic; ITD has not published the algorithm)
4th-character entity category codes (index 3, 0-based):
P— Person / IndividualC— CompanyH— Hindu Undivided Family (HUF)A— Association of Persons (AOP)B— Body of Individuals (BOI)G— GovernmentJ— Artificial Juridical PersonL— Local AuthorityF— Firm / Limited Liability PartnershipT— Trust
PAN is financial PII (Income Tax ID). Mask before logging or displaying in UI. See mask for PII-safe display options.
Accepted input forms (all normalised before validation):
Raw uppercase:
"ABCPE1234F"Lowercase:
"abcpe1234f"— normalised to uppercaseMixed case:
"AbCpE1234f"— normalised to uppercaseWith spaces:
"ABCPE 1234 F"— internal whitespace strippedWhitespace padded:
" ABCPE1234F "— leading/trailing whitespace trimmed
No checksum: The Income Tax Department has not published a public checksum algorithm for the 10th character. Validation is structural (format + category) only.
This object is stateless and thread-safe.
Samples
PAN.validate("ABCPE1234F") // ValidationResult.Valid
PAN.format("abcpe1234f") // "ABCPE1234F"
PAN.mask("ABCPE1234F") // "XXXXXX234F"