Regex for Indian Passport Number Validation

Indian passport numbers follow a simple, consistent structure, which makes them one of the easier government-issued ID formats to validate with regex. This guide gives you the pattern, a working JavaScript validator, and the edge cases worth handling in a real KYC or travel-booking form.

The Indian Passport Number Format

An Indian passport number is one uppercase letter followed by seven digits — for example A1234567 or M7654321. Unlike PAN or Aadhaar, there is no checksum digit embedded in the number, so validation is purely a format check.

Regex Pattern

const passportRegex = /^[A-Z][0-9]{7}$/;

function isValidIndianPassport(input) {
  return passportRegex.test(input.trim().toUpperCase());
}

isValidIndianPassport('A1234567');  // true
isValidIndianPassport('a1234567');  // true — normalized to uppercase first
isValidIndianPassport('AB123456');  // false — two letters instead of one
isValidIndianPassport('A123456');   // false — only 6 digits

Using It in a Form Validator

function PassportInput({ value, onChange }) {
  const normalized = value.trim().toUpperCase();
  const isValid = /^[A-Z][0-9]{7}$/.test(normalized);

  return (
    <div>
      <input
        value={value}
        onChange={(e) => onChange(e.target.value)}
        placeholder="A1234567"
        maxLength={8}
        style={{ borderColor: isValid ? '#16a34a' : '#dc2626' }}
      />
      {!isValid && value.length > 0 && (
        <span>Enter a valid passport number, e.g. A1234567</span>
      )}
    </div>
  );
}

Edge Cases and Practical Notes

  • Always trim whitespace and convert to uppercase before validating — users often paste numbers with trailing spaces or type in lowercase
  • Passport numbers alone don't include a checksum, so regex validation is purely structural — it cannot detect a mistyped but format-valid number
  • Combine passport number validation with a date-of-issue and date-of-expiry check when building travel/KYC forms, since airlines and visa portals typically validate all three together
  • Do not assume the pattern applies to other countries' passports — formats vary widely (e.g. UK passports are 9 digits, US passports can be 9 digits with no letters)
  • Never attempt to "verify" a passport number's authenticity client-side — that requires an official government API/database lookup, not a regex check

Combining with Other Indian ID Validators

KYC forms in India often collect multiple ID types together. Here's how a passport check fits alongside PAN and Aadhaar validators:

const validators = {
  passport: /^[A-Z][0-9]{7}$/,
  pan: /^[A-Z]{5}[0-9]{4}[A-Z]$/,
  aadhaar: /^[2-9][0-9]{11}$/,
};

function validateIdField(type, value) {
  const pattern = validators[type];
  return pattern ? pattern.test(value.trim().toUpperCase()) : false;
}

Frequently Asked Questions

What is the format of an Indian passport number?

An Indian passport number consists of one uppercase letter followed by seven digits, for example A1234567. The letter is not restricted to a specific set and can vary by issuing office and passport series.

What is the regex for validating an Indian passport number?

The pattern ^[A-Z][0-9]{7}$ validates the structure — one uppercase letter followed by exactly seven digits.

Does matching this regex confirm the passport number is real?

No. The regex only confirms the string follows the correct format. Verifying that a passport number actually exists and is valid requires checking against the Ministry of External Affairs Passport Seva database, which is not something regex or client-side code can do.

Try the Free AI Regex Generator

Describe any validation rule in plain English and get a working regex instantly — no signup required.

Related articles