Scanbot SDK has been acquired by Apryse! Learn more

Learn more
Skip to content

How to scan passports with a mobile device

Maya January 22, 2026 11 mins read
How to scan passports

In international travel, machine-readable travel documents (MRTDs) are the global standard for identity verification. Besides machine-readable passports (MRPs), this includes visas and some national ID cards. The core of all MRTDs is a standardized element designed for automated reading: the machine-readable zone (MRZ)

In this article, we take a closer look at the physical structure of passports and explain how the MRZ is formatted. We then explore how you can use mobile devices to reliably scan and extract passport data. 

What is a machine-readable passport (MRP)? 

A machine-readable passport (MRP) is a travel document with identity data that can be read by both humans and machines. To ensure global interoperability, MRPs follow ICAO Doc 9303. This standard defines machine-readable formats as well as the layout and data fields of passports. Today, the vast majority of passports issued worldwide are MRPs. 

An MRP is a booklet with at least eight pages, including a data page on which the issuing State records the holder’s personal details along with information about the document’s issuance and validity. This page also includes the machine-readable zone (MRZ).  

Layout of a machine-readable passport 

The passport data page layout is heavily standardized. This ensures that officials and automated systems worldwide can consistently locate and interpret the personal and document data no matter the issuing authority.  

Nonetheless, the layout offers some flexibility to accommodate the legal and cultural requirements of the individual issuing States. To balance international standardization and flexibility, the data page is divided into seven zones.

How to scan passports with a mobile device

The seven each hold specific elements:

  • Zone I: Header 
  • Zone II: Personal data 
  • Zone III: Document data 
  • Zone IV: Signature 
  • Zone V: Identification feature / Portrait picture 
  • Zone VI: Optional data 
  • Zone VII: Machine-readable zone (MRZ) 

Zones I through VI constitute the visual inspection zone (VIZ), which is designed for human inspection. Zone VII is the machine-readable zone (MRZ), formatted specifically for optical character recognition (OCR). 

The visual inspection zone (VIZ) 

The visual inspection zone is intended for manual verification at border control and in administrative workflows. It occupies most of the data page and contains more information than the MRZ.

VIZ data elements 

The VIZ includes human-readable fields such as the holder’s name, date of birth, and passport number, as well as the portrait picture. While many elements are mandatory, some are optional, meaning that issuing States may or may not choose to include them.

How to scan passports with a mobile device

The table below lists the VIZ data elements, their meaning, and whether they are required to be present:

ZoneFieldData elementMeaningRequired?
I1Issuing State or organizationThe full name of the State or organization that issued the MRPMandatory
I2DocumentThe document title in the national languageMandatory
I3Document codeDocument code Capital letter P to designate an MRPMandatory
I4Issuing State codeThe three-letter ICAO country code for the issuing State Mandatory
I5Passport numberA unique number assigned by the State to identify the specific documentMandatory
II6Primary identifierThe holder’s surnameMandatory
II7Secondary identifierThe holder’s given namesMandatory
II8NationalityThe holder’s nationality as identified by the issuing StateMandatory
II9Date of birthThe holder’s date of birth in a standardized format Mandatory
II10Personal number An identification number given to the holder by the State Optional
II11SexThe sex of the holder (F for female, M for male, or X for unspecified) Mandatory
II12Place of birthThe city and/or State of the holder’s birthplaceOptional
III13Date of issueThe date the document was officially issuedMandatory
III14Issuing authorityThe specific office or organization that issued the MRPMandatory
III15Date of expiryThe date the document is no longer valid for travelMandatory
IV16Holder’s signatureThe signature or usual mark of the rightful holder Mandatory
V17Holder’s portraitA secure, integrated image of the holder’s faceMandatory

Zone VI is optional and may contain additional discretionary data, often located on the back of the data page or on an adjacent page. 

For dates, several formats are possible – they are defined in Part 3 of Doc 9303. 

The machine-readable zone (MRZ) 

The MRZ, officially Zone VII, contains a standardized, machine-readable subset of the data printed in the VIZ. It is located at the bottom of the data page and consists of two lines of 44 characters each. 

The ICAO, in fact, defines several MRZ formats for use on different document types. The two-line format used for passports is TD3.  

Next, we will look at how the passport MRZ is structured internally. 

MRZ data encoding on passports (TD3 format)

The MRZ follows a strict left-to-right structure. All unused character positions are filled with the filler character “<” to preserve consistent spacing and length.

MRZ encoding

Line 1 encodes document and name information: 

Character positionsData elementDetails & formatting
1–2  Document codeThe first character is ‘P’ for passport; the second identifies the specific type (e.g., ‘PP’ for ordinary, ‘PD’ for diplomatic)
3–5Issuing StateThe three-letter ICAO country code representing the issuing State or organization
6–44NameThe holder’s primary and secondary identifiers, separated by two filler characters (<<)

Line 2 encodes the holder’s passport and personal information:

Character positionsData elementDetails & formatting
1–9Passport numberThe unique document number; spaces are replaced with filler characters (<)
10Check digitA digit used to verify the passport number 
11–13NationalityThe three-letter ICAO code for the holder’s nationality
14–19Date of birthFormat: YYMMDD
20Check digitA digit used to verify the date of birth
21SexM for male, F for female, or < for unspecified 
22–27Date of expiryFormat: YYMMDD
28Check digitA digit used to verify the date of expiry
29–43Personal numberOptional personal or document data at the discretion of the State
44Composite check digitAn overall check digit calculated using data from the lower line

Check digits 

Check digits embedded throughout the MRZ can be used to verify that the data has been read correctly. They are calculated using a Modulus 10 algorithm that assigns numeric values to characters and applies a repeating weighting pattern. This mechanism allows scanning systems to automatically detect recognition errors. 

NFC-enabled passports 

Most modern passports – often referred to as ePassports or biometric passports – have a contactless NFC chip embedded in the booklet. The chip securely stores biometric data such as the holder’s facial image and, in some cases, fingerprints. 

ePassports can be identified by the standardized chip symbol printed on the cover. 

NFC-enabled passport with chip

While chip-based reading is highly secure, not all passports worldwide support NFC. For this reason, NFC reading cannot be relied upon as a universal extraction method. 

Extracting data from passports 

Because the MRZ is mandatory on all machine-readable passports, it is the global baseline for automated data capture. Unlike the NFC chip, it can be read using any standard camera and OCR software. This means that given the right software, any smartphone or tablet can be used to scan passports.  

Using OCR to scan MRZs 

Optical character recognition (OCR) converts images of text into machine-readable characters. The MRZ is specifically designed for fast and accurate OCR: It uses a fixed font (OCR-B), standardized character spacing, and a limited character set to minimize misreads. 

Today, a typical MRZ scanning workflow includes:

  1. Image capture: A camera captures the passport data page. 
  2. MRZ detection: The software locates the MRZ at the bottom of the page. 
  3. Pre-processing: The image is enhanced to improve contrast and sharpness. 
  4. Character recognition: OCR converts the MRZ image into text. 
  5. Parsing: The raw string is turned into structured data fields such as name, passport number, nationality, and dates.
  6. Check digit validation: Check digits are calculated and compared against the printed values to detect errors.
  7. Output: The verified data is returned as structured key-value pairs. 

This process not only ensures high accuracy, but also enables fast, automated passport processing across industries – from travel to customer onboarding. 

Benefits of scanning passports 

Because the MRZ is standardized across all MRTDs, a passport issued by one State can be processed anywhere in the world using both visual and electronic methods. 

Automated MRZ scanning leverages this standardization. It eliminates manual data entry, accelerates identity workflows, reduces operational workload, and significantly lowers the risk of transcription errors. Built-in check digits further enhance reliability by enabling the validation of critical fields. 

How to scan passports with the Scanbot MRZ Scanner SDK 

The Scanbot MRZ Scanner SDK enables fast and reliable passport scanning directly within mobile and web applications. It is available for iOS, Android, cross-platform frameworks, and web environments. 

The SDK automatically detects MRZs, extracts all standardized data fields, validates check digits, and returns structured key-value results for seamless backend integration. All processing is performed locally on the device, without a need for third-party servers or an internet connection. 

how to scan an MRZ

Start testing today 

With the Scanbot SDK’s ready-to-use UI components, you can set up a fully functional MRZ scanner app with just a few lines of code – even in a single, self-contained HTML file, thanks to the Scanbot Web MRZ Scanner SDK

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <title>Web MRZ Scanner</title>
</head>

<body style="margin: 0">
    <button id="scan-mrz">Scan MRZ</button>
    <p id="mapped"></p>
    <script type="module">
        import "https://cdn.jsdelivr.net/npm/scanbot-web-sdk@7.2.0/bundle/ScanbotSDK.ui2.min.js";
        const sdk = await ScanbotSDK.initialize({
            enginePath:
                "https://cdn.jsdelivr.net/npm/scanbot-web-sdk@7.2.0/bundle/bin/complete/"
        });
        document
            .getElementById("scan-mrz")
            .addEventListener("click", async () => {
                const config = new ScanbotSDK.UI.Config.MrzScannerScreenConfiguration();
                const result = await ScanbotSDK.UI.createMrzScanner(config);

                const mappedParagraph = document.getElementById("mapped");
                mappedParagraph.innerText = "";

                if (!result) {
                    mappedParagraph.innerText = "No result. Please try again.";
                    return;
                }

                if (!result?.mrzDocument) {
                    mappedParagraph.innerText = "No MRZ document found. Please try again.";
                    return;
                }

                const mapped = result?.mrzDocument.fields.map(field => {
                    return `${field.type.name}:  ${field.value?.text}`
                });

Feel free to copy the code into an HTML file and open it in your browser. When moving to production, we recommend you download the SDK and host it on your server instead of using a CDN.

You can run the Scanbot SDK from your project for 60 seconds per session without a license. For more in-depth testing, generate a free trial license

Do you want to learn more about the SDK? Our experts are always happy to chat. Simply message us at sdk@scanbot.io.

Happy scanning! 🤳

FAQ

Do I need a special device to scan MRZs on passports?

No. With scanning software like the Scanbot SDK, you can scan and extract passport data on any smartphone, directly in your app or website. The SDK uses the device camera to capture the MRZ and returns all information as structured key-value pairs.

Can I scan MRZs in low light?

Yes. The Scanbot MRZ Scanner SDK is optimized to work even in challenging conditions, including low light, glare, or angled shots. To test it out yourself, try our demo app

How accurate is MRZ scanning?

MRZ scanning is highly accurate, thanks to the standardized OCR-B font, limited character set, and built-in check digits. It is a very reliable method of extracting passport data.

Can I scan MRZs on national ID cards as well?

Yes. The Scanbot MRZ Scanner SDK supports both two-line (TD3, TD2) and three-line (TD1, MRV-A, MRV-B) standards.

Related blog posts

best-id-card-scanner-sdk-image

Choosing the best ID card scanner for your app

In this article, we discuss the different ways to extract data from PDF417 codes, IDs, passports and visas, plus what to keep in mind when choosing the right solution...

Maya 12 mins read

Experience our demo apps

Barcode Icon Art

Barcode Scanner SDK

Scan 1D and 2D barcodes reliably in under 0.04s. Try features like Batch Scanning, Scan & Count, and our AR Overlays.

Launch Web Demo

Scan the code to launch the web demo on your phone.

Web QR Code

Also available to download from:

Document Icon Art

Document Scanner SDK

Scan documents quickly and accurately with our free demo app. Create crisp digital scans in seconds.

Launch Web Demo

Scan the code to launch the web demo on your phone.

Black and white QR code. Scan this code for quick access to information.

Also available to download from:

Data_capture Icon Art

Data Capture Modules

Try fast, accurate data capture with our demo app. Extract data from any document instantly – 100% secure.

Launch Web Demo

Scan the code to launch the web demo on your phone.

Black and white QR code. Scan this quick response code with your smartphone.

Also available to download from: