PatternRegex

Validate a PAN number

Check an Indian Permanent Account Number against its published 10-character shape: five letters, four digits, one letter.

Last updated

Pattern
^[A-Z]{5}\d{4}[A-Z]$
Open in Regex Tester & Builder

Matches

  • ABCDE1234F
  • AAAPL1234C

Doesn’t match

  • abcde1234f
  • ABCD1234F
  • ABCDE12345

Why it’s written this way

A PAN is always 10 characters in a fixed layout — [A-Z]{5} for the first five letters, \d{4} for the four digits in the middle, and a single trailing [A-Z] — and the anchors make sure nothing shorter or longer than that can pass.

The pattern is case-sensitive on purpose: real PAN cards are issued in uppercase, so a lowercase value typed into a form is a sign it needs re-entering, not a formatting quirk this pattern should tolerate.

Edge cases to know

  • The fourth letter of a real PAN encodes the holder type (P for individual, C for company, and so on) — this pattern accepts any letter there and doesn't check that it's a defined code.
  • Matching the format is not the same as the PAN being issued — only the Income Tax Department's own verification service can confirm that.
  • It won't accept a PAN typed with a lowercase letter or extra whitespace — normalize the input (trim, uppercase) before testing it against this pattern.

Related in Patterns