Passport OCR: how to extract data from a passport's data page and MRZ

For onboarding, KYC and operations teams at banks, lenders and fintechs that retype passport details: what's on the data page, how extraction works, the checks to run and where automation fits.

US passport data page with the date of birth field extracted and shown for review

Key takeaways

  • Passport OCR reads a passport's data page, both the printed fields (the visual inspection zone, or VIZ) and the machine readable zone (MRZ), into structured fields such as name, nationality, date of birth, passport number and expiry date.
  • Under ICAO Doc 9303, the MRZ is two lines of 44 OCR-B characters that repeat the key printed fields, with check digits after the passport number, date of birth, expiry date and personal number, plus a composite digit at the end of line 2.
  • The checks that matter are data checks: recompute the check digits, compare the MRZ with the printed page, confirm the passport is unexpired, and match the name and date of birth to the application.
  • For US banks, a passport number and country of issuance can serve as a non-US customer's identification number under the Customer Identification Program (CIP) rule, and a bank that relies on a passport records its type, number, place of issuance and dates of issue and expiry.
  • Passport OCR checks the data, not the document. Confirming that a passport is genuine and belongs to the person presenting it is identity verification, a separate step.
On this page
  1. What is passport OCR?
  2. Fields you can extract from a passport
  3. How to extract data from a passport with OCR
  4. Checks to run on every passport
  5. How to automate passport data extraction
  6. The bottom line
  7. Frequently asked questions

Passport OCR is how you extract data from a passport automatically: it reads the data page, both the printed fields and the two-line machine readable zone (MRZ) at the bottom, and turns them into structured fields such as name, nationality, date of birth, passport number and expiry date. Banks, lenders and fintechs use it to onboard customers and run KYC checks without retyping passport details. The MRZ's check digits also let software catch misreads in the passport number and dates.

This guide shows what's on the data page, which fields to extract, how extraction works, the checks to run on every passport and where Docsumo fits.

What is passport OCR?#

Passport OCR is optical character recognition applied to one page: the passport's data page, the one with the holder's photo. ICAO Doc 9303, the international standard for machine readable passports, splits that page into a visual inspection zone (VIZ) of printed fields for people and a machine readable zone (MRZ) for machines.

The MRZ is two lines of 44 characters in the OCR-B typeface, using only capital letters, digits and the filler character <. It repeats the key printed fields in fixed positions, so software doesn't have to guess where anything is. That's also the usual answer to "what is OCR in a passport?": the MRZ was designed to be read by OCR. The specimen below is issued by Utopia (UTO), the fictional country ICAO uses for sample documents.

Passport data page with nine printed fields numbered to their characters in the two MRZ lines, check digits in green
The MRZ repeats the numbered fields in fixed positions, with dates as YYMMDD, and its green check digits let software catch a misread before comparing it with the page.

Fields you can extract from a passport#

The data page holds three groups of printed fields, and the MRZ repeats most of them. That repetition is what makes a passport easy to check.

  • Holder

    Surname and given names, nationality, date of birth and sex, plus place of birth and a personal number where the issuing country includes them.
  • Document

    Document type (P for passport), issuing country code, passport number and issuing authority.
  • Dates

    Birth, issue and expiry. Birth and expiry dates are also in the MRZ with check digits; the issue date is printed only.
  • MRZ

    Line 1 carries the document type, issuing country and name. Line 2 carries the passport number, nationality, birth date, sex, expiry date and optional personal number, with check digits.

For US banks, these fields line up with the Customer Identification Program (CIP) rule. A passport number and country of issuance can serve as a non-US customer's identification number, and a bank that verifies identity with a passport records the document type, its number, the place of issuance and the dates of issue and expiry. The issue date isn't in the MRZ, so reading the MRZ alone won't fill that record.

How to extract data from a passport with OCR#

Whatever tool you use, passport extraction runs through the same stages, from upload to your KYC or onboarding system.

  • App or portal upload
  • Email attachment
  • Phone photo or scan
API and webhooks
  1. 01Classify the page
  2. 02Read the VIZ and MRZ
  3. 03Check digits and compare
  4. 04Review exceptions
KYC or onboarding system
How a passport moves from upload to your KYC system
  1. CollectCustomers upload a phone photo or scan in your app or portal, or send it by email; put every file in one queue. Ask for photos without flash, since glare on the glossy page washes out characters.
  2. Classify the pageFind the data page, and set aside other passport pages, visas or a different ID sent by mistake.
  3. Read both zonesOCR reads the printed fields and the two MRZ lines, and extraction maps each value to a named field such as surname, passport number or date of birth.
  4. CheckRecompute the MRZ check digits, then compare the MRZ with the printed fields and the application. On a worn or damaged page, a failed check digit points to the field to re-read.
  5. Review and deliverFields that fail a check or were read with low confidence go to a person, with the value highlighted on the image. Everything else goes straight to your KYC or onboarding system.

Checks to run on every passport#

These are data checks. They catch misreads and mismatches between the passport and what the customer told you; they don't prove a passport is genuine.

  • Check digitsRecompute the digits after the passport number, birth date, expiry date and personal number, and the composite digit that ends line 2. A mismatch usually means a misread, so re-read the field or send it for review.
  • ExpiryThe passport is unexpired on the day you rely on it: the CIP rule names unexpired government-issued ID, such as a passport, as a document banks may use. MRZ dates use two-digit years (YYMMDD), so set the century before comparing.
  • MRZ matches the printed pagePassport number, name, birth date, sex and expiry agree. Allow for ICAO's rules: the MRZ drops accents and apostrophes (Ö can become OE or O), turns hyphens into <, and truncates names that don't fit in 39 characters.
  • Matches the applicationName and date of birth agree with what the customer entered, and the nationality and issuing country are what you expect.
  • Nothing missingEvery field your records need was read, including the issue date, which only the printed page carries.

Here's a second Utopia specimen with its check digits recomputed and its printed page compared with the MRZ:

Document
FieldExtracted valueConfidence
Document typeP (passport)
Issuing stateUTO
Passport numberQ72P41856
Date of issue2023-06-02
Date of expiry2033-06-01
A passport data page being read, with the MRZ check digits checked.

How to automate passport data extraction#

A passport rarely arrives alone: it comes with an application and often proof of address such as utility bills or bank statements. Docsumo reads the data page with a pre-trained passport model and handles any other document type, so the whole file is read together. A code step you add to the workflow can recompute the MRZ check digits and compare the MRZ with the printed fields. Fields below a per-field confidence threshold go to your reviewers, who click a field to see its source on the page; their corrections improve the model. Data goes to your KYC, onboarding or loan system through the API and webhooks. On the Enterprise plan, cross-document validation can check the passport's name and date of birth against the application and other documents, and case management keeps each customer's file together.

Docsumo works with the data on the page; it isn't an identity verification tool. It doesn't read the passport's chip, inspect security features or match a selfie to the photo, so teams that need those add an ID verification provider (see the best KYC document verification software). It runs in the cloud only, is SOC 2 Type 2 audited and ISO/IEC 27001:2022 certified, and doesn't use customer documents to train shared or third-party models; see security.

The bottom line#

Passport OCR turns a passport's data page into fields you can use, and the MRZ makes the result checkable. Recompute the check digits, compare the MRZ with the printed page and the application, read the issue date from the printed page, and send only the mismatches to a person. When you also need to know the passport is genuine and belongs to the person presenting it, add identity verification.

Book a demo with a sample onboarding file, or start a free trial.

Frequently asked questions#

What is passport OCR?

Software that reads a passport's data page, including the machine readable zone (MRZ), and turns it into structured fields such as name, passport number, nationality, date of birth and expiry date. Banks, lenders and fintechs use it so staff don't retype passport details during onboarding and KYC.

What is OCR in a passport?

It usually means the machine readable zone: the two lines of capital letters, numbers and < symbols at the bottom of the photo page. They're printed in the OCR-B typeface so machines can read them, and they repeat the main printed details with check digits. The passport number opens line 2, followed by its check digit.

How do MRZ check digits work?

Multiply each character's value by 7, 3 and 1 in turn (digits count as themselves, letters A to Z as 10 to 35 and < as 0), add the products and keep the remainder after dividing by 10. For the birth date 880314 (14 March 1988), 8×7 + 8×3 + 0×1 + 3×7 + 1×3 + 4×1 = 108, so the check digit is 8.

Is passport OCR the same as identity verification?

No. Passport OCR reads and checks the data on the page. Identity verification also checks that the passport is genuine, for example through its security features or chip, and that the person presenting it is the holder, usually with a selfie. KYC programs often use both; see automated KYC verification.

Can passport OCR read passports from any country?

Every passport issued to the ICAO standard uses the same MRZ format, so the MRZ reads the same way whatever the issuing country. Printed layouts and languages vary, but mandatory fields in a non-Latin script must also be transcribed or transliterated into Latin letters, and the MRZ uses only A to Z, 0 to 9 and <.

What should I look for in passport OCR software?

Test it on your own phone photos and scans, including glare and worn pages. Look for reading of both the printed fields and the MRZ, check digit validation, review of low-confidence fields, an API that delivers the fields to your systems, and independent security audits such as SOC 2 Type 2. If you also need to confirm the passport is genuine, pair it with an identity verification tool.

See Docsumo read your own documents

Bring a few real samples. We'll show the fields extracted, the checks that ran and what a reviewer would see.