Scanning a passport, visa or IDs with a mobile device is lightning fast. More successful scans means more successful transactions.
Understanding MRZ
What is Machine Readable Zone?
MRZ Standards and Documents
A Machine Readable Zone (MRZ) is a section on identity documents – such as passports, ID cards, visas, residence permits, and other travel documents – that contains encoded personal information in a standardized format . The MRZ is typically located at the bottom of the document and consists of two or three lines of text printed in a special OCR-friendly font (usually OCR-B ). This format is defined by the International Civil Aviation Organization (ICAO) in its Doc 9303 standard for Machine Readable Travel Documents (MRTDs).
The MRZ allows machines (either dedicated scanners or smartphone cameras with OCR software) to quickly and accurately read key identity data without manual entry in this sense, barKoder boasts supreme MRZ recognition capabilities.
ID with a 3 line MRZ
ICAO 9303 Standard Formats: ICAO 9303 specifies several standard MRZ formats based on document size (often referred to as TD1, TD2, TD3 for “Type” 1/2/3 documents). The most common formats include:
ID-3 (TD3): Used for passport booklets (the identity page of passports). MRZ is 2 lines of 44 characters each
ID-2 (TD2): A medium-sized card (slightly larger than credit card, sometimes visas or older ID cards). MRZ is 2 lines of 36 characters each
ID-1 (TD1): Credit-card sized documents (national ID cards, passport cards, some driver’s licenses). MRZ is 3 lines of 30 characters each
There are also standardized formats for machine-readable visas: MRV-A (visa format with 2 lines of 44 characters) and MRV-B (visa format with 2 lines of 36 characters), as defined in ICAO Doc 9303 Part 7. No matter the format, all MRZs use the same character set and similar data fields. Only the digits 0–9, capital letters A–Z, and the filler symbol < are allowed characters. The < character acts as a space or padding indicator in the MRZ. For example, names in the MRZ have spaces and punctuation replaced by < (and surname is separated from given names by << ). Non-Latin letters with diacritics are transliterated into basic Latin letters or combinations (e.g. Ü → UE , ß → SS ) according to ICAO rules.
Nearly all modern passports and many national IDs now include an MRZ. In fact, since 2010, ICAO has required member states to issue only machine-readable passports, and non-MRZ passports became invalid for international travel after November 2015. This ubiquity means software developers can rely on MRZ data being present for a wide range of identity documents. The MRZ serves as a universal machine-readable identity string , enabling interoperability across border control systems, airport kiosks, banking apps, and more.
MRZ Structure and Encoded Fields (ICAO 9303 Format)
Despite looking like a jumble of letters and numbers, the MRZ is highly structured. It encodes the document holder’s personal data in fixed field positions, along with check digits for error detection. According to the ICAO 9303 specification, an MRZ typically includes the following core fields :
Document Type: A 1-character code for the type of document. For example, P for passport, V for visa, I or other letters for ID cards. (The second character on the first line may be used for a subtype or simply a filler <
Issuing Country/Authority: A 3-letter ISO country code (with some ICAO-defined modifications) indicating the issuing country or organization
Name: The bearer’s surname and given names. In the MRZ, the surname is written first, followed by << , then the given names separated by single < . For example, SMITH<<JOHN<DOE would correspond to surname "SMITH" and given names "JOHN DOE". Unused name field space is filled with < padding
Document Number: The passport or ID card number (alphanumeric). This field has a check digit following it to ensure it was read correctly
Nationality: A 3-letter country code for the holder’s nationality (ISO 3166-1 alpha-3 code, which in some cases can differ slightly from the issuing country code)
Date of Birth: In YYMMDD format, followed by a check digit
Sex: 1 character: M for male, F for female, or < (or sometimes X ) if unspecified
Document Expiration Date: In YYMMDD format, followed by a check digit
Personal Number (Optional): An optional field (up to 14 characters in passports) used by some countries for a national ID number or other personal identifier. If unused, it is filled with < . This field also has a check digit or filler in its last position
Overall Checksum: The last character of the MRZ (at the end of the last line) is a global check digit that verifies the combined data from several fields (such as document number, birth date, expiry date, and personal number). This helps detect any error in reading any part of the MRZ.
VISA with a 2-line MRZ code
For example, in a typical two-line passport MRZ (known as TD3 format), the layout is as follows:
Line 1 (44 chars): Positions 1–2: document type ( P< for a standard passport); positions 3–5: issuing country code; positions 6–44: name (surname<<given names)
Line 2 (44 chars): Positions 1–9: document number; pos 10: check digit for document number; pos 11–13: nationality; pos 14–19: date of birth; pos 20: check digit for DOB; pos 21: sex; pos 22–27: expiration date; pos 28: check digit for expiration; pos 29–42: optional personal number; pos 43: check digit for personal number; pos 44: overall check digit
Other document formats use a similar concept with adjusted line lengths. For instance, an ID card in TD1 format has three lines of 30 characters: the first line contains document type, issuer, and document number; the second line contains birth date, sex, expiration date, nationality; and the third line contains the name. Visas (MRV-A or MRV-B) have two lines like passports, but may allocate different lengths for the name or optional data. No matter the format, the presence and order of fields are consistent, which allows a parser to identify and extract the data once it knows which format (2-line vs 3-line, 44 vs 36 vs 30 char) it’s dealing with.
Passport with a 2-line MRZ code
Check Digit Calculation: MRZ fields are protected by check digits to detect misreads or forgeries. The check digit for a field is computed by a specific algorithm: each character is converted to a value (0–9 as their numeric value, A–Z as 10–35, and < as 0), then each position’s value is multiplied by a weight in a repeating sequence 7-3-1. The weighted values are summed and the sum’s modulo 10 is taken – that result is the check digit. For example, if a passport number is C01X3<7 (just as an illustration), the software would calculate its check digit by applying these weights and verifying the result matches the digit provided in the MRZ. Any discrepancy means the MRZ was read incorrectly or has been tampered with. All critical fields (document number, birth date, expiry date, and often the optional number) have individual check digits, and the final overall checksum provides an extra layer of verification across the combined data. This system significantly reduces errors , ensuring that automated scans are highly reliable – a crucial feature for both security and data integrity.
Use Cases of MRZ Scanning
MRZs were originally introduced to speed up identity verification in travel, but today they are leveraged across many industries.
Travel and Border Control
The earliest and most prominent use of MRZ is in international travel. At immigration checkpoints and airport security, passports with MRZ enable fast, automated identity verification. Instead of manually typing passenger information, border agents or e-gates scan the MRZ to instantly extract the traveler’s data. This dramatically reduces waiting times and minimizes human error. Airlines also use MRZ scanning during check-in and boarding to automate passport details entry and comply with security regulations (e.g. verifying against watchlists). In short, MRZ technology has become a cornerstone of modern global travel security and passenger processing.
How is data extracted from a MRZ code
Financial Services
Banks and fintech companies use MRZ scanning to streamline Know Your Customer (KYC) and identity verification processes. When opening a bank account, applying for a loan, or performing any regulated financial transaction, customers can be asked to scan their passport or ID card using a mobile app. The MRZ data (name, DOB, document number, etc.) is extracted to verify the person’s identity and checked against sanction or PEP lists as required by Anti-Money Laundering rules. Automating KYC with MRZ OCR speeds up onboarding (no need to manually fill forms) and reduces fraud – fake IDs can be detected by verifying MRZ checksums and cross-checking the data with authorities. For example, a fintech app can instantly read a user’s passport MRZ to auto-populate their sign-up details, improving user experience while ensuring compliance.
Access Control and Security Screening
In many secure facilities and high-security use cases, scanning an ID’s MRZ helps verify identity quickly. For instance, entry into office buildings, data centers, or secure events can be expedited by MRZ scanning. Security personnel can scan the MRZ on a visitor’s ID badge or passport to automatically log their name and details, rather than copying information by hand. In the hospitality industry, hotels often scan guest passports/IDs at check-in – MRZ readers capture the guest’s info in seconds, reducing check-in time and errors. Similarly, at large events or amusement venues, MRZ-based identity checks can help validate tickets or age (for age-restricted events) and prevent entry with fraudulent IDs. These scenarios all benefit from the speed and accuracy of MRZ scanning in verifying a person’s credentials.
Beyond these, MRZ scanning is also used in healthcare (for patient identity verification), telecommunications (SIM card registration with ID verification), car rentals, borderless kiosks, and any application where a quick, reliable read of an official ID is needed. In summary, what began as a border control technology is now a widespread standard for identity verification , appreciated for its efficiency in a broad array of business processes.
Smartphone-Based MRZ Scanning: OCR on Mobile Devices
Originally, reading MRZ data required dedicated hardware scanners or special equipment. Now, thanks to advances in mobile cameras and optical character recognition, smartphones can accurately scan MRZs using just the built-in camera and software. This has opened up new possibilities: any mobile app can incorporate passport/ID scanning functionality, making user onboarding or ID checks far more convenient.
Modern mobile MRZ scanning SDKs (Software Development Kits), such as barKoder’s MRZ Parser SDK , leverage on-device OCR to detect the MRZ in a camera frame, read the text, and parse it into structured data fields automatically. The process typically works like this: the user points their phone camera at the passport or ID; the SDK’s vision algorithm locates the MRZ zone (which has a distinctive pattern of two or three lines with high-contrast OCR font), then performs OCR to extract the text, and finally the parser splits the text into fields and validates the checksums.
All of this can happen in a fraction of a second on a modern mobile device.
barKoder MRZ
Experience barKoder’s MRZ module.
BarKoder’s MRZ Scanner mobile technology brings you automation, speed, efficiency and excellence to all of your business processes and procedures.
Start supporting your business needs by using our API or go for our SDK licensing and integrate the scanning engine in your apps as per your requirements. Amaze your customers with the most technologically advanced user experience they've ever had.
MRZ Features
SDK Features
Data Security
We do not collect personal information! The app however does need to process the personal information that is on the MRZ of the identity document. This includes privacy-sensitive information like name, date of birth, personal number and document number. In addition, the app scans via OCR technology for the date of expiry and any optional data on the document, because all these are needed for information processing.
The personal information is secured since all the processing is done on the phone. Confidentiality of this information is also protected by using encrypted network connections for any requested communication.
High Performance
Scanning with MRZ Scanner is way faster than manual input. Mobile OCR also removes any human error from your processes. This means the accuracy of your scans will be higher than manual verification. You can use MRZ Scanner to provide the most reliable service possible to your customers. It provides you with near instant scan results once you point your device at your target. Average scan time takes less than half a second.
You can optimize your company processes and procedures by adding the fastest scanning ever to your mobile app. This will also give you more time to focus on other aspects of your business.
Work Offline
MRZ Scanner works in real-time, locally on a device, without the need of internet connection. Since the scan happens right on the spot, the data never leaves your phone unless you want it to. All the processing is done at that very moment, right away. This means the results never pass any external servers. That makes MRZ Scanner the perfect tool for completing scans of sensitive information.
Based on your demands our software can, however, transfer data to your servers using a secured end-to-end encryption. When using our SDK (Software Development Kit) you can customize things on both ends.
Cost Reduction
MRZ Scanner works on your mobile device so there is no need to spend money on expensive external readers. This reduces the cost of equipment and employee training. MRZ Scanner's high accuracy also removes false readings from your processes. More successful scans means more successful transactions. A penny saved is a penny earned. Scanning a passport, visa, ID cards with a mobile device works lightning faster.
With MRZ Scanner you can drastically improve your processes and stay on top on your business at the same time.
MRZ FAQ
Frequently asked questions
What are the barKoder scanner SDK MRZ properties?
The barKoder MRZ SDK is capable of scanning all variant of MRZ codes that are currently officially used. However, the same SDK is designed to easily recognize future MRZ codes.
The SDK can extract photos from MRZ documents.
The SDK can extract signatures
The SDK can extract whole document image
Technology used?
Machine learning - features detection on image
Drawbacks?
Bigger SDK size due to necessary models for Machine Learning model prediction and also OCR
Can be slow on older hardware which is not optimized for ML Prediction
What is the minimum hardware required to run this technology optimally?
It's tested on Android devices using API level 5 and higher. API level 8 is recommended as well as arm64 CPU
iPhone 7 is oldest iOS device tested and confirmed working. However, performance is lower than devices with dedicated neural engine CPU cores
Any missing features for MRZ scanning?
ROI
weaker Signature detection
not implemented on other platforms than Android and iOS
Release date?
The barKoder MRZ SDK was released Late October 2024. You can find it for most supported platforms and cross-platform frameworks under the version number 1.5.x+.