October 26, 2026

What is MRZ: TD1, TD2, TD3, and check digits explained

Alexander Sheshkus
Chief Science Officer, Ph.D.
What is MRZ: TD1, TD2, TD3, and check digits explained

Machine-readable zone (MRZ) scanning allows businesses to automatically extract key information from passports and other identity documents, eliminating the need for manual data entry. Defined by the ICAO Doc 9303 standard, MRZ formats follow specific rules for data structure and interpretation. Understanding how these formats, data fields, and validation rules work helps businesses choose and implement document-scanning solutions that fit their needs.

In today’s blog post, we explore how MRZ OCR works, how different document formats affect MRZ scanning, and how automated checks help verify extracted data. We also look at the practical considerations involved in integrating an MRZ scanner into existing applications and identity verification workflows.

What Defines the Machine-Readable Zone

The machine-readable zone is a standardized area on passports, identity cards, and other travel documents that contains essential identity and document details in a format designed for automated reading. Based on ICAO Doc 9303, the MRZ follows consistent rules for character placement and field structure, allowing an MRZ scanner to extract information from different document types.

The MRZ contains uppercase Latin letters, digits, and the filler character. This character separates components of names and fills unused positions in a field. Each piece of information occupies a designated location, making it possible for MRZ OCR technology to interpret document data according to the appropriate format.

The information typically includes:

  • Holder’s name;
  • Document type, issuing State, and document number;
  • Nationality, date of birth, and sex;
  • Date of expiry;
  • Check digits and optional data, where applicable.

The fixed structure of the MRZ is particularly useful for businesses that handle identity documents at scale. Instead of requiring users to enter personal details manually, MRZ scanning can capture the available information and transfer it into structured fields for use in digital onboarding, customer registration, and document management systems.

The same standardized approach supports different document categories, including passports and ID cards. Although their layouts vary, the underlying conventions make it possible to read and organize information consistently across supported formats.

For organizations building document-based workflows, the MRZ provides a practical foundation for faster data capture, more consistent input, and smoother integration with existing applications.

Which MRZ Formats Apply to Different Identity Documents

ICAO defines three principal document formats: TD1, TD2, and TD3. They differ in the number of lines, the number of characters per line, and the arrangement of document and personal information. The same character position can represent different information in different document types. Understanding these differences helps explain how MRZ scanning adapts to different identity documents.

The primary MRZ formats include:

FormatStructureTypical machine-readable documents
TD13 lines × 30 charactersID cards
TD22 lines × 36 charactersCertain official travel documents and ID cards
TD32 lines × 44 charactersPassports
MRVA2 lines × 44 charactersVisas (Format A)
MRVB2 lines × 36 charactersVisas (Format B)

Supporting all formats allows businesses to use a consistent approach to MRZ scanning across different identity and travel documents, reducing the need for separate manual data-entry procedures for each category.

How MRZ Fields Organize Personal and Document Data

Each MRZ format assigns specific positions to document identifiers, issuing-state codes, personal details, and additional information. This standardized arrangement allows MRZ scanning to turn the characters captured from a document into structured data that can be used by business applications.

Names follow a particular convention. The surname and given names are arranged in a designated field and separated by filler characters. Because the MRZ uses a standardized character set, names may appear differently from their presentation in the visual inspection zone (VIZ) of the document. The filler character also occupies unused positions when a field does not reach its full length.

Dates are generally written in a six-digit year-month-day format. This applies to fields such as the date of birth and document expiry date, where provided. Their fixed positions help an MRZ scanner distinguish one date from another without relying on the formatting conventions used in ordinary text.

Other fields follow the same principle. Their exact arrangement depends on whether the document uses TD1, TD2, or TD3. For example, TD1 distributes information across three lines, while TD2 and TD3 use two lines with different character capacities. This affects where individual fields appear and how the extracted characters must be interpreted.

The practical benefit for businesses is that MRZ OCR can provide individual data fields rather than an undifferentiated block of text. Names, dates, and document numbers can then be transferred into registration forms, customer records, and onboarding systems, helping streamline document-based workflows and reduce manual data entry.

What Makes MRZ Check Digits Work

MRZ check digits are numerical characters included in designated fields to check the consistency of data captured from a document. They help an MRZ scanner detect errors in scanned data.

Each check digit is calculated from the characters in a designated field according to ICAO rules. Letters and numbers are assigned specific values, and a repeating sequence of weights is applied to calculate the expected digit. This result is then compared with the check digit captured from the MRZ.

For example, a passport document number such as L898902C3 has an associated check digit. To calculate it, each character is converted into its standardized value, multiplied by the corresponding weight in the repeating sequence, and the results are added together. The total is divided by ten, and the remainder gives the check digit 6.

The same principle applies to other designated fields, including the date of birth and expiry date. An MRZ scanner calculates the expected check digit for each applicable field and compares it with the digit read from the document.

Some formats also include a composite check digit, calculated from specified characters across multiple fields. This provides an additional consistency check covering several parts of the MRZ.

For businesses using MRZ OCR, check digits help detect scanning errors by identifying mismatches between calculated and captured digits. This helps flag potentially incorrect extracted data before it is passed to downstream systems.

How Check-Digit Rules Differ Across TD1, TD2, and TD3

Although TD1, TD2, and TD3 use the same general ICAO principles for calculating check digits, their layouts determine where those digits appear and which data fields contribute to each calculation. An MRZ scanner must therefore interpret the relevant format correctly to handle check digits as part of the complete document structure.

In TD3 passports, the second line contains the document number and its associated check digit, the date of birth and its check digit, and the expiry date and its check digit. Depending on the layout, optional data and a composite check digit also occupy designated positions.

TD2 uses two shorter lines, so the distribution of fields and check digits differs from TD3. TD1 uses three lines of 30 characters, placing some information in different positions and requiring the corresponding format-specific rules to be applied.

Common check digit types in the MRZ:

  • Document number;
  • Date of birth;
  • Expiry date;
  • Personal number or other optional data elements;
  • Composite.

A composite check digit is calculated from designated characters in the MRZ, and its value is not derived by combining individual check digits. During MRZ scanning, calculated check digits are compared with those recorded in the MRZ to verify the consistency of the corresponding fields.

Understanding of format-specific differences helps businesses interpret scanned passport or identity-card data correctly. It also allows MRZ OCR solutions to support multiple document layouts through a consistent scanning workflow while applying the appropriate rules to each format.

How MRZ OCR Turns Document Images into Structured Data

MRZ OCR combines image capture, character reading, format interpretation, and data extraction to turn an image of an identity document into structured information. The process is designed to capture the MRZ and organize its contents into fields that can be used by business applications.

The workflow begins with a document image obtained from a camera, video stream, or scanned file. The system locates the MRZ area and prepares the image for character reading. This stage is particularly important when documents are captured under real-world conditions, where lighting, camera angles, and image quality can vary.

Image-processing capabilities help handle common capture challenges, including glare, shadows, low resolution, and perspective distortion. These conditions can affect how clearly individual characters appear, so effective image preparation is an important part of reliable MRZ scanning.

Once the MRZ has been captured, the extracted characters are interpreted according to the applicable document format. The system identifies the line structure, assigns characters to their designated fields, and organizes the available information into structured values.

This approach supports automated data extraction without requiring users to enter every detail manually. The resulting fields are transferred into registration forms, customer databases, onboarding platforms, and other applications that rely on identity-document information.

MRZ scanning complements other document-reading capabilities. Data from the MRZ is compared with information in VIZ. Compatible RFID functionality provides access to data stored in an electronic document chip, allowing the workflow to incorporate additional document information.

How to Integrate MRZ Scanning into Your Product

OCR MRZ-scan is OCR Studio’s solution for MRZ scanning on passports, ID cards, and visas. The SDK enables businesses to integrate MRZ OCR into mobile applications, web apps, and on-premise systems, automatically extracting machine-readable data from document photos, images, and video streams instead of requiring users to enter personal details manually.

MRZ OCR is performed entirely on-device, without sending document images or extracted information to external servers. This offline approach helps businesses protect sensitive personal data while supporting fast, automated identity document scanning.

OCR Studio’s solution supports:

  • All ICAO-compliant MRZ formats, including TD1, TD2, TD3, MRVA, and MRVB;
  • Real-time MRZ scanning from photos, images, and video streams;
  • Check-digit validation and cross-checking MRZ data against the VIZ;
  • Scanning in challenging conditions, including glare, shadows, low light, low-resolution images, and angled captures;
  • Cross-platform SDKs for Android, iOS, Windows, Linux, and web applications.

The MRZ scanner uses neural networks to detect two-line and three-line layouts, including curved MRZ lines and documents captured at different angles. Local MRZ formats from France, Switzerland, Bulgaria, and other countries are supported alongside ICAO-standard formats, helping businesses handle a wider range of identity documents.

With flexible deployment options, OCR MRZ-scan helps businesses reduce manual data entry and simplify document-based onboarding. Its offline architecture also allows sensitive information to remain on the client’s device, supporting privacy-conscious workflows across travel, finance, and identity-related services.

Learn more about OCR Studio’s solutions

FAQ

What is MRZ OCR, and how does it work?

MRZ OCR extracts machine-readable information from passports, ID cards, and visas. It captures the MRZ area, reads its characters, interprets the document format, and organizes the extracted information into structured fields such as names, document numbers, dates of birth, and expiry dates.

Which document formats does MRZ scanning support?

MRZ scanning supports the ICAO-standard TD1, TD2, and TD3 formats, as well as MRVA and MRVB visa formats. These formats differ in the number of lines, characters per line, and arrangement of document information. Supporting multiple formats enables consistent data extraction across different identity and travel documents.

How does an MRZ scanner validate extracted data?

An MRZ scanner uses check digits to detect potential errors in scanned information. It calculates expected values according to ICAO rules and compares them with the check digits captured from the document. The system can also cross-check MRZ data against the VIZ to help verify data consistency.

Can MRZ scanning work in challenging lighting and image conditions?

Yes. The MRZ scanning solution can handle common capture challenges, including glare, shadows, low light, low-resolution images, and angled document captures. The technology detects MRZ areas and interprets two-line and three-line layouts, including curved MRZ lines.

How can businesses integrate an MRZ scanner into their applications?

Businesses can integrate an MRZ scanner using an SDK for mobile applications, web apps, and on-premise systems. OCR Studio’s OCR MRZ-scan supports Android, iOS, Windows, Linux, and web applications. MRZ OCR runs on-device, allowing document data to be extracted from photos, images, and video streams without sending document images or extracted information to external servers.

Contents

About the author

Alexander Sheshkus, Ph.D., is a scientist and inventor specializing in artificial intelligence and machine learning. As Chief Science Officer of OCR Studio, he oversees research and development initiatives focused on advancing AI-powered recognition and computer vision technologies. Alexander developed the core of a string recognition system, proposing and implementing numerous algorithms for neural network training and high-precision text recognition.

With expertise in smart data capture, computer vision, machine learning, and AI, Alexander regularly presents his research at international conferences, industry exhibitions, and scientific forums. His contributions are supported by 70+ scientific publications and 3 US patents, reflecting his ongoing work to advance research and innovation at OCR Studio.

Continue reading

Get in Touch With Us Today!

For comprehensive details about our complete
range of solutions and services.

Or contact our sales team:

sales@ocrstudio.ai

    * Required information
    By clicking the “Send request” button, you consent to data processing