Skip to main content

MRZ Explained: Machine-Readable Zone Guide (2026)

The machine-readable zone (MRZ) stores selected passport and ID data in fixed-width lines. Check digits catch some reading errors. Verifying that the document is genuine requires separate checks.

MRZ Explained: Machine-Readable Zone Guide (2026)

Contents

In this guide

Jump to the part you need.

The machine-readable zone (MRZ) is the fixed-width block at the bottom of a passport data page and on some ID cards and travel documents. This guide fits developers and operations teams. We charge $0.15 for a document check in a workflow. A full KYC check costs $0.33 and includes document verification, passive liveness, face match, and device and IP analysis. If validation passes, the computed check digits match the printed digits for the protected characters. Document authenticity requires separate evidence.

Last updated: November 26, 2026. Prices checked against the live Didit price feed on November 26, 2026.

The MRZ in one table
QuestionShort answer
What it isThe machine-readable area of an ICAO Doc 9303 travel document, with fixed-width characters read by OCR
LayoutsTD1: 3 lines of 30. TD2: 2 lines of 36. TD3: 2 lines of 44
Character setUppercase A to Z, digits 0 to 9, and the filler <
Error detectionModulus-10 check digits, repeating weights 7, 3, 1
What a checksum pass showsIf validation passes, the computed check digits match the printed digits for the protected characters. Document authenticity requires separate evidence
Didit pricesDocument check $0.15. Full KYC $0.33. NFC chip read $0.15 as an add-on

What is the machine-readable zone (MRZ)?

The machine-readable zone is the mandatory machine-readable area of an ICAO-compliant travel document. It appears at the bottom of a passport data page and on some ID cards and travel documents, encoding selected identity and document fields as fixed-width characters so optical character recognition can recover them without a person keying them in.

It sits apart from the visual inspection zone (VIZ). The visual inspection zone is the part designed for people to read. It contains the portrait and labelled fields such as the holder's name and dates, presented in the issuer's display format. ICAO Doc 9303 defines the system. Part 3 holds the specifications common to machine-readable travel documents, and Parts 4, 5 and 6 define the TD3, TD1 and TD2 layouts. Part 7 covers MRV-A and MRV-B visas.

Border gates, check-in desks and onboarding flows can use the MRZ when they scan a machine-readable travel document. On ICAO TD3 passport booklets, it appears at the bottom of the data page. Many credit-card-size ID cards and official travel documents use TD1, often on the back. Larger cards and booklet data pages use TD2.

The character set and the filler

The layouts use OCR-B and a deliberately restricted repertoire: uppercase A to Z, digits 0 to 9, and the filler <. The filler pads fixed-width fields, replaces spaces and unsupported punctuation where the schema says so, and separates name components. Deleting every < before parsing destroys field boundaries and the structure of the name.

TD1, TD2 and TD3 layouts

The first parsing decision is the layout. Use line count and width to narrow the candidate layouts. Confirm the document class and code before choosing the field map.

TD1, TD2 and TD3 compared
LayoutTypical documentLines and widthTotal charactersName position
TD1Credit-card-size ID card or official travel document3 x 3090Line 3
TD2Larger card or booklet data page2 x 3672Line 1
TD3Passport booklet and other TD3 documents2 x 4488Line 1

MRV-A visas also use two lines of 44 characters, and MRV-B visas also use two lines of 36. Their field maps differ from TD3 and TD2, so confirm the document class and code before you assign positions (ICAO Doc 9303 Part 7).

Do not infer the layout from a document code alone. Capture drops lines, joins two of them, inserts spaces or returns a crop from the wrong region. Validate geometry and the permitted characters before you assign field positions.

TD3: two lines of 44 characters, the passport layout

TD3 field map
LinePositionsLengthField
11-22Document code
13-53Issuing State or organization
16-4439Name
21-99Passport number
2101Passport-number check digit
211-133Nationality
214-196Date of birth, YYMMDD
2201Birth-date check digit
2211Sex: F, M or <
222-276Date of expiry, YYMMDD
2281Expiry-date check digit
229-4214Personal number or optional data
2431Optional-field check digit
2441Composite check digit

Position 1 is P for a passport and position 2 identifies the passport type. The composite digit at position 44 covers line-2 positions 1 to 10, 14 to 20 and 22 to 43, so it includes the individual check digits but excludes nationality and sex. When the personal-number field is unused and filled with <, Part 4 lets its check position be 0 or < at the issuer's option.

TD1 and TD2 in brief

TD1 and TD2 field maps
LayoutLine 1Line 2Composite covers
TD1Document code 1-2, issuer 3-5, document number 6-14, check digit 15, optional data 16-30. Line 3 is the name, 30 charactersDate of birth 1-6, check 7, sex 8, expiry 9-14, check 15, nationality 16-18, optional data 19-29, composite 30Line-1 positions 6-30, then line-2 positions 1-7, 9-15 and 19-29
TD2Document code 1-2, issuer 3-5, name 6-36Document number 1-9, check 10, nationality 11-13, birth 14-19, check 20, sex 21, expiry 22-27, check 28, optional data 29-35, composite 36Line-2 positions 1-10, 14-20 and 22-35

The TD1 composite excludes the name on line 3. The TD2 composite excludes nationality at 11 to 13 and sex at 21, and missing that exclusion is a common source of an almost-correct implementation. Both layouts have a long-document-number exception: when the number exceeds nine characters, the check position becomes < and the continuation characters move into the optional field, with the check digit immediately after them.

Worked example: an ICAO TD3 specimen

ICAO's specimen passport shows how the two lines fit together and how every check position can be recomputed from the printed characters.

P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10
Reading the specimen line 2
PositionsPrintedMeaning
1-9L898902C3Passport number
106Check digit over the passport number
11-13UTONationality, the fictional state used in ICAO specimens
14-19740812Date of birth, YYMMDD. The specimen is conventionally read as 12 August 1974; the encoded year is 74.
202Birth-date check digit
21FSex
22-27120415Date of expiry, YYMMDD. The specimen is conventionally read as 15 April 2012; the encoded year is 12.
289Expiry-date check digit
29-42ZE184226B<<<<<Personal number or optional data, issuer-defined
431Optional-field check digit
440Composite check digit

Line 1 starts with P at position 1 and a filler at position 2, which marks an unspecified passport type. Positions 3 to 5 hold UTO, the code for Utopia. The name runs to position 44, with ERIKSSON as the primary identifier and ANNA MARIA as the secondary identifiers. Use a specimen as a regression test, not as a template: real documents vary in name length, optional data and issuer conventions.

The composite check digit covers line-2 positions 1-10, 14-20 and 22-43. The weights start at 7 on the first character of the concatenated string and continue 3, 1 across each range boundary. The three protected ranges concatenate to L898902C3674081221204159ZE184226B<<<<<1, and the weighted sum is 880. 880 mod 10 = 0, which matches the digit printed at position 44.

Composite check digit for the specimen
Protected rangeCharactersWeighted sum
Line 2 positions 1-10L898902C36358
Line 2 positions 14-20740812270
Line 2 positions 22-431204159ZE184226B<<<<<1452
TotalConcatenated ranges880; 880 mod 10 = 0
A document being analysed after capture, with the extracted fields read from the image
After capture, the parser reads the band, validates the check digits and slices the fields by position.

How MRZ check digits work

ICAO check digits use a deterministic modulus-10 calculation that returns one character, 0 to 9.

  1. Convert each character to a value: digits 0 to 9 keep their value, letters A to Z take 10 to 35, and < takes 0.
  2. Multiply by repeating weights 7, 3, 1, 7, 3, 1, starting from the first character of the protected field.
  3. Add the products and take the sum modulo 10. The remainder is the check digit.
Check-digit calculation for the specimen passport number L898902C3
StepL898902C3
Value21898902123
Weight731731731
Product1472495627014363

The products add to 316, and 316 mod 10 is 6, which matches the digit printed at position 10. The same method on the birth date 740812 gives 122 mod 10 = 2, and on the expiry date 120415 it gives 49 mod 10 = 9. Both match the specimen.

Validate the individual digits first and the composite last. An individual failure can come from the protected characters or from the printed check digit itself. After a composite-only failure, the first things to inspect are a misread printed composite digit, then the range construction, the optional data, and a character the composite covers and the individual digit does not.

The checked fields match their printed check digits. Some transcription errors can still pass, and document authenticity requires separate evidence. Anyone can recompute the digit, so treat a pass as an error-detection result, not a signature.

How MRZ OCR works

Parsing is a sequence of stages, and each one can fail without the next noticing. Running them in this order keeps the failure attributable. The parser must select the protected positions before it can calculate a check digit, so slicing comes before digit validation.

  1. Locate and segment the lines. Find the MRZ region and isolate the line candidates before reading any text. Blur, glare, skew and a crop that cuts a line all change what OCR recovers, so localization gets its own failure state.
  2. Run OCR using the MRZ alphabet. An OCR pass that expects only A to Z, 0 to 9 and < substitutes less than a general text model. Keep per-character confidence so a doubtful 0 or 1 stays visible.
  3. Validate line count, character count and document class. Reject anything that is not 30, 36 or 44 characters wide, and confirm the document class and code before assigning a layout.
  4. Slice the raw fixed-width fields. Use one-based ICAO positions for the confirmed layout and keep the raw strings.
  5. Validate individual and composite check digits. Field check digits first, composite last.
  6. Then normalize and run semantic checks. Return ISO 8601 dates and labelled identifiers while retaining the raw YYMMDD strings, the raw OCR lines and the parser version. Even if the check digit matches, reject 310299 because 99 is an invalid day.
A user photographing an identity document inside a verification flow
Capture comes first: the band has to be in frame, in focus and uncropped before any parser can help.

Record the outcome of each stage, so a failure says whether the cause was capture, segmentation, OCR, a check digit or issuer data the parser does not model. That record is what lets a reviewer explain a decision, and what stops a parse from being read as an authenticity result.

MRZ versus NFC chip data

The printed zone and the contactless chip in an ICAO ePassport do different jobs, and they are meant to be used together.

Printed MRZ compared with ICAO ePassport chip data
PropertyPrinted MRZICAO ePassport chip
CaptureCamera, scanner or manual entryNFC reader on a phone
Error detectionModulus-10 check digitsCryptographic signatures
AuthenticityNonePassive authentication against the issuing state's certificates
Cloning evidenceNoneActive authentication, when supported, tests whether the chip holds the private key associated with its authenticated data
DependencyNoneIn our standard ICAO workflow, the SDK uses the printed MRZ to derive the BAC or PACE access credentials. Other eID protocols can use different credentials.

The chip does not replace the print. If the device lacks NFC or NFC is disabled, we continue with standard document and selfie verification. An interrupted chip read can decline the NFC check with NFC_NOT_READ or NFC_BAC_FAILED. Allow the user to retry.

How Didit reads and validates an MRZ

We verify 14,000+ document types across 220+ countries and territories, with sub-2-second p99 inference. Our verification flow and native SDKs support 54 capture and interface languages. We serve 4,000+ companies.

We parse the MRZ as one of our listed capabilities, next to field extraction and barcode decoding. Our service cross-references data between the visual zone, the MRZ and any barcodes on the document. We report detected MRZ validation failures through warning codes. Workflow results can include MRZ_NOT_DETECTED. The standalone endpoint never returns that code. INVALID_MRZ covers a format or check-digit failure, INCONSISTENT_DATA covers a disagreement between the visual zone and the MRZ, and MRZ_NOT_DETECTED covers a session where no zone was found. Each warning carries a short and a long description you can show to the user.

The response path matters. Workflow document results appear in id_verifications[] and may report MRZ_NOT_DETECTED. Standalone results appear under id_verification. There, invalid_mrz_action and inconsistent_data_action control those warning groups with DECLINE or NO_ACTION. Other checks can still affect the decision. The parsed zone comes back in the mrz field of the response, beside the extracted holder fields.

Where the parsed MRZ appears in Didit responses
Request pathObjectFields to inspect
Workflow sessionid_verifications[]status, warnings, mrz; may include MRZ_NOT_DETECTED
Standalone direct uploadid_verificationstatus, warnings, mrz; configure invalid_mrz_action and inconsistent_data_action

One document check is $0.15 inside a workflow. Our standalone endpoint at https://verification.didit.me/v3/id-verification/ takes the front image and, for two-sided documents, the back image. It charges $0.20 at list price for each HTTP 200 result, including Declined and In Review. Upload uncropped images with all four corners visible, because the service detects, aligns and crops the document itself.

The ID document panel of a Didit session showing the extracted fields and the parsed document data
A session keeps the parsed document data, the warnings and the decision together, so a reviewer can see why a check passed or failed.

For ICAO ePassports, NFC chip reading is a separate step at $0.15 per check. When the chip and the printed data disagree, the session returns NFC_DATA_DOES_NOT_MATCH_OCR, and a failed passive authentication returns NFC_PASSIVE_AUTHENTICATION_FAILED. For NFC, use our native SDK or the supported Didit App handoff. In a browser-only flow, we skip NFC and continue with document and selfie verification.

Troubleshooting an MRZ result

Common outcomes and what to do next
SymptomLikely causeAction
Clipped lineCapture crop, skew or an open bookletRecapture with all corners visible; require the expected line count and width.
Failed field digitGlare, damaged print, OCR confusion or an issuer conventionPreserve the image, name the failed field and route to recapture or review.
Unresolved centuryYYMMDD has no centuryResolve from document type, expiry rules, capture date and a stated policy; keep the raw YYMMDD.
Visual-zone mismatchVisual zone and MRZ disagreeInspect the warning and apply the configured policy.

Worked cost example

An onboarding team runs 20,000 completed checks a month at each level on the Scale plan. The document, full KYC and NFC rates shown receive the Scale discount. The table shows monthly usage charges, before applying plan credit or adding the subscription fee, and assumes 20,000 completed checks at each level.

Monthly usage charges at three levels of checking, 20,000 completed checks, Scale plan
What you runList priceScale price (-10%)Monthly usage charges
Document check only$0.15$0.13520,000 x $0.135 = $2,700.00
Full KYC: document, passive liveness, face match, device and IP$0.33$0.29720,000 x $0.297 = $5,940.00
Full KYC plus NFC chip reading$0.48$0.43220,000 x $0.432 = $8,640.00

The list price for full KYC is built from the parts: $0.15 + $0.10 + $0.05 + $0.03 = $0.33, then + $0.15 for the chip = $0.48. On Scale each part is discounted: $0.135 + $0.09 + $0.045 + $0.027 = $0.297, plus $0.135 for the chip = $0.432. At this volume the chip adds 20,000 x $0.135 = $2,700.00 a month.

The standalone endpoint charges $0.20 at list price for each HTTP 200 result, including Declined and In Review. For 20,000 billable results, 20,000 x $0.20 = $4,000 before discounts or credits. The same document step inside a workflow is $0.15 at list price, so 20,000 x $0.15 = $3,000 before plan discounts.

Common mistakes when reading an MRZ

  • Losing the fixed-width structure. Trimming lines, collapsing fillers or deleting line breaks before layout detection shifts every field. Isolate the band, then require exactly 30, 36 or 44 characters per line.
  • Treating OCR output as ground truth. Readers confuse O with 0, I with 1 and B with 8. Do not run a global replacement, because letters are valid in document numbers and digits are valid in dates. Use the permitted set, the check digits and the visual zone, and keep the raw and corrected values.
  • Removing fillers too early. < can mean padding, a separator, an unspecified value or a required replacement. Parse positions first and interpret the filler inside the chosen field.
  • Assuming the MRZ preserves the printed name. Treatment varies by character: in names a hyphen can become a filler, an apostrophe can be omitted, national characters are transliterated and a long name is truncated to fit the fixed width. Store the MRZ name and the visual name separately.
  • Guessing the century. Birth and expiry carry two-digit years, and the check digit validates the six printed digits only. Resolve the full date from document type, expiry rules, capture date and a stated policy, and keep the raw YYMMDD.
  • Repairing a failed check digit silently. A failure can come from glare, a damaged line, an unsupported issuer convention or manipulation. Preserve the capture for the evidence needed for a defined review purpose and retention period, name the failed field and route it to recapture or review.

Sources

Start in the Business Console and run an ID Verification sandbox workflow with a supported test document, then inspect id_verifications[] for status, warnings and mrz. For parser-only tests, use the printed ICAO specimen above. The sandbox is free on every plan, and no sales call is needed. Keep raw document data only for the evidence needed for a defined review purpose and retention period. If you are moving from another provider, the switch guide covers the migration, and the MCP server lets a coding agent wire the call for you.

Try it

Try this in the sandbox

Run the check this guide describes, free.

ID Verification

The product this post is about, taken from its topic. Run it free in the sandbox.

$0.15 per checkStart free

Author

Alejandro Rosas

Co-founder and CTO

Alejandro Rosas

Alejandro Rosas

Co-founder and CTO

About Didit

Questions

Frequently asked questions

What is the MRZ code on a passport?

It is the two 44-character lines printed at the bottom of the passport data page, in the TD3 layout. Line 1 holds the document code, the issuing state and the name. Line 2 holds the passport number, nationality, dates of birth and expiry, sex, an optional personal number and the check digits. Reading it needs only OCR, which is why a border gate or a phone app can capture it from a photo.

Where exactly is the MRZ on a passport?

On most passports it is at the foot of the personal-data page, below the visual inspection zone. Locate the data page first, then detect the two lines near its lower edge. A crop from a fixed pixel position fails when the page is rotated or the booklet is open differently.

How do I read MRZ line 1 and line 2?

Read line 1 as the document code in positions 1 and 2, the issuing state in 3 to 5, then the name in 6 to 44, where << separates the primary identifier from the secondary ones. Read line 2 as the document number in 1 to 9, its check digit at 10, nationality in 11 to 13, birth date in 14 to 19, its check digit at 20, sex at 21, expiry in 22 to 27, its check digit at 28, optional data in 29 to 42, the optional check digit at 43 and the composite at 44. Slice by those one-based positions and never by splitting on <.

Apa itu MRZ?

MRZ adalah singkatan dari machine-readable zone, yaitu bagian paspor atau kartu identitas tertentu yang berisi karakter berlebar tetap dan dapat dibaca dengan OCR. Pada paspor TD3, nama dan negara penerbit ada di baris pertama. Pada kartu TD1, nama ada di baris ketiga.

What is the last number of a passport number (passin tunnistekoodin viimeinen numero)?

The actual passport number can end in a letter or a digit, so it is not always numeric. The character at TD3 line 2 position 10 is a separate check position, not part of the number. In the specimen L898902C36, the passport number is L898902C3 and the 6 at position 10 is the check digit computed over it. Appending the check digit changes the identifier and can cause an exact-match lookup to fail.

What does MRZ pass mean?

Teams use it to mean a parser accepted the zone: the line count and width matched a known layout and the checked fields match their printed check digits. Some transcription errors can still pass, and document authenticity requires separate evidence. A fabricated document with correctly recomputed digits can pass the same test, so treat it as one signal next to the authenticity checks, not as approval.

Do MRZ check digits prove a document is genuine?

No. The checked fields match their printed check digits. Some transcription errors can still pass, and document authenticity requires separate evidence, because the modulus-10 calculation is public and anyone can compute the same digit from an invented number. Document authentication evaluates the document image; when an ePassport chip can be read, passive authentication adds evidence by checking the issuer's signature over the chip data.

Why does NFC passport verification fail on a phone?

Our NFC flow needs a compatible phone with NFC enabled and usable MRZ data for ICAO chip access. An interrupted read can return NFC_NOT_READ or NFC_BAC_FAILED, so allow a retry. For NFC, use our native SDK or the supported Didit App handoff. In a browser-only flow, we skip NFC and continue with document and selfie verification.

Does the MRZ hold the name exactly as printed?

No. Treatment varies by character: in names a hyphen can become a filler, an apostrophe can be omitted, national characters are transliterated to A to Z, and a long name can be truncated to fit the fixed width. << separates identifier groups and a single < separates components inside a group. Store the MRZ name and the visual-zone name as separate values, and treat a name that fills the last available position as possibly truncated.

How much does MRZ reading cost on Didit?

MRZ parsing is part of ID Verification, which is $0.15 per document check inside a workflow. A full KYC that adds passive liveness, face match and device and IP analysis is $0.33. The standalone document endpoint charges $0.20 at list price for each HTTP 200 result, including Declined and In Review. A chip read through NFC is a separate $0.15 add-on.

What is the difference between the MRZ and the visual inspection zone?

The visual inspection zone is the part designed for people to read. It contains the portrait and labelled fields such as the holder's name and dates, presented in the issuer's display format. The MRZ is a fixed-width encoding of a subset of those fields, built for machines. When the two disagree, inspect the warning and apply the configured policy.

Compliance built in

Audited, certified and attested.

We hold the certifications and build each country's rules into your flows, so you can launch anywhere without worrying. Security and Compliance center

  • Regulation encoded into your flows

    Tell us what you do and where. Didit lists the rules that apply to you, with sources, and builds the checks each country needs into one workflow.

  • Ready for AMLR

    Every requirement of the new EU anti-money laundering rules, from checking customers to human review, is already covered by a Didit check.

  • Tested in Spain's Treasury sandbox

    Spain's Treasury published its supervised sandbox report on Didit's NFC plus active liveness onboarding; SEPBLAC took part and valued the added measures positively.

  • Audited, not self-declared

    iBeta Level 1 and Level 2. Liveness tested under ISO/IEC 30107-3.

Compliance assistant

Your obligations · 3 regions

EU · AMLRCustomer due diligence, human reviewCovered
Illinois, Texas, ColoradoExplicit biometric consentCovered
Germany · Youth protectionVerified adults only (JMStV)Covered
Workflow checked. Every obligation is met
  • SOC 2 Type 2
  • ISO 27001
  • iBeta Level 1 and Level 2
  • EU regulator attestation
  • FSM youth protection
  • GDPR
  • EBA remote onboarding
  • MiCA compatible
  • FIDO Alliance member
  • AMLREU AML Regulation ready

Integration · Didit MCP

Run Didit from your own AI agent

Connect Didit to Claude, Cursor, VS Code or ChatGPT and just ask in plain words. Your agent can do anything you can do in the console, with the same permissions you have.

Add to ClaudeChatGPT
Didit Academy · Lesson 04 · Use Didit with MCP
  • Build workflowsDescribe the checks you need. The agent creates and publishes the flow.
  • Run investigationsAsk why a session was declined, review cases, search people and companies.
  • Change rulesCreate payment rules, test them on past data and switch them on.
  • Pull reportsAsk for numbers, exports or the audit log.

Verify your first user today.

Start free

Free sandbox. Credit applies to work-email sign-ups.