Indian PAN Number Regex
Validates the format of an Indian Permanent Account Number (PAN): five uppercase letters, four digits, and a final uppercase letter, e.g. ABCDE1234F.
Regex Pattern
^[A-Z]{5}[0-9]{4}[A-Z]$Pattern Breakdown
Hover over a token to see what it does.
| Token | Meaning |
|---|---|
| ^ | Anchors the match to the start of the string |
| [A-Z]{5} | Exactly five uppercase letters (the first three are alphabetic series, the fourth encodes holder type, the fifth is the first letter of the surname) |
| [0-9]{4} | Exactly four digits, a sequential number unique to the holder |
| [A-Z]$ | A single uppercase check-alphabet letter, then the end of the string |
Detailed Explanation
What it does
This pattern checks that a string matches the structural format of an Indian PAN card number: 5 letters, followed by 4 digits, followed by 1 letter, for exactly 10 characters total. It does not verify that the letters encode a real holder-type code or that the check letter is mathematically correct.
Why it works
PAN numbers follow a fixed positional format mandated by the Indian Income Tax Department, so a rigid sequence of character classes with exact counts (`{5}`, `{4}`) is sufficient to validate the shape. Anchoring with `^` and `$` ensures no extra characters can sneak in before or after the 10-character code.
Common use cases
- Validating PAN input fields on Indian KYC, banking, or tax-filing forms
- Sanity-checking bulk-uploaded customer or vendor records before onboarding
- Client-side format validation before calling a PAN verification API
- Filtering log or document text for strings that look like PAN numbers
Edge cases
- Lowercase input like 'abcde1234f' is rejected since the pattern is case-sensitive by design
- The fourth letter actually encodes the holder category (P for individual, C for company, etc.) but this regex accepts any letter there
- A structurally valid but non-existent PAN (e.g. all same letters) will still pass since regex cannot check issuance records
- Whitespace around the number, like ' ABCDE1234F', fails due to the anchors
Limitations
- Cannot verify the PAN was actually issued or belongs to the claimed holder
- Does not validate the semantic meaning of the fourth character (holder type code)
- No checksum exists in the PAN format itself, so any letter/digit combination in the right shape passes
- Real verification requires calling the Income Tax Department's PAN verification service
Interactive Tester
Edit the pattern or text below — matching runs live in your browser.
Test Cases
Editable — add your own inputs to see if they pass.
| Input | Expected | Result | |
|---|---|---|---|
| Pass | |||
| Pass | |||
| Pass | |||
| Pass | |||
| Pass | |||
| Pass | |||
| Pass | |||
| Pass |
Language Variants
Production-ready examples in 12 languages.
const panRegex = /^[A-Z]{5}[0-9]{4}[A-Z]$/;
console.log(panRegex.test('ABCDE1234F')); // trueCommon Mistakes
Allowing lowercase letters or trimming case before validating
Fix: Keep the pattern case-sensitive and uppercase user input only for display, not for validation, since real PAN cards are always uppercase
Assuming a format-valid PAN is a real, issued PAN
Fix: Pair this regex with the Income Tax Department's PAN verification API for authoritative checks
Trying to validate the fourth character's holder-type meaning with plain [A-Z]
Fix: If holder-type matters, use a class like [PCHABGJLFT] instead of a generic [A-Z] for that position
Performance Notes
- Fixed-count quantifiers ({5}, {4}) make this pattern O(n) with no backtracking risk
- Anchoring with ^ and $ lets the engine reject malformed strings immediately
- Precompile the regex once per process rather than reconstructing it on every validation call
Browser Compatibility
| Engine | Supported | Notes |
|---|---|---|
| Chrome | Yes | — |
| Firefox | Yes | — |
| Safari | Yes | — |
| Edge | Yes | — |
| Node.js | Yes | — |