MRZ parsing

The machine-readable zone is the encoded strip at the bottom of a passport or ID card. Parsed properly, it is a second, machine-native copy of the identity you can check the printed page against — complete with checksums that catch misreads. Zanyara parses every ICAO 9303 format and, crucially, repairs OCR misreads without ever accepting an unvalidated result.

Every ICAO 9303 layout

  • TD3 — passports: two lines of 44 characters.
  • TD1 — ID cards: three lines of 30 characters.
  • TD2 — some larger ID documents: two lines of 36 characters.

From any of them Zanyara returns the structured fields — document type, issuing state, name, document number, nationality, date of birth, sex and expiry — plus the status of every check digit.

Check digits, and what they’re for

Each check digit is a modulus-10 checksum with repeating weights of 7, 3 and 1 (digits as themselves, A–Z as 10–35, the filler ‘<’ as 0). There are per-field digits for the document number, date of birth and expiry, and a composite digit over several fields. They exist to catch corruption — and, at capture time, OCR error.

Repair, gated by the checksum

A single character misread can fail a genuine document. Zanyara treats a broken check digit as a prompt to repair, not to reject: it proposes the most likely correction from common OCR confusions and the document’s visual inspection zone, and accepts it only if the check digit then validates. A repair the checksum still rejects is never silently accepted — it is surfaced. The result is fewer false failures on real documents with no softening of the fraud bar.

The MRZ is a cross-check, not the last wordA valid MRZ proves the encoded data is internally consistent — not that the document is genuine. Zanyara corroborates the MRZ against the printed page, the chip and any barcode as part of document verification.
See the APITalk to us

Frequently asked questions

What are the TD1, TD2 and TD3 MRZ formats?
They are the three ICAO 9303 machine-readable-zone layouts. TD3 is the passport format — two lines of 44 characters. TD1 is the ID-card format — three lines of 30 characters. TD2 is used by some larger ID documents — two lines of 36 characters. Zanyara parses all three.
How does the MRZ check digit work?
Each check digit is a modulus-10 checksum over a field, using the repeating weights 7, 3, 1. Digits count as themselves, letters A–Z count as 10–35 and the filler ‘<’ counts as 0. There are per-field check digits (document number, date of birth, expiry) and, on TD1/TD2/TD3, a composite check digit over several fields together. Validating them catches most OCR misreads before they reach your decision.
What happens when an OCR misread breaks a check digit?
A single misread character (a common one is O read as 0, or B as 8) can fail an otherwise valid document. Zanyara does not simply reject: it uses the check digit and the visual inspection zone to identify and repair the likely misread, only accepting a repair the checksum then validates. That closes false failures on genuine documents without lowering the bar for real fraud.

© 2026 Zanyara Ltd. All rights reserved.

Questions: hello@zanyara.com · Privacy: privacy@zanyara.com

We use analytics cookies to understand how visitors use Zanyara. Declining still lets you use the site — see our Privacy Policy.