OCR6 min

How to Read a Passport MRZ Line and Verify It Locally

The Machine Readable Zone at the bottom of every passport encodes name, number, nationality, DOB, and expiry — plus check digits. Here's how to parse and verify it in the browser.

Zro7 Passport Reader OCR's and validates MRZ entirely in your browser. Passport numbers and personal data never leave your device.

To read a passport's MRZ, open Zro7 Passport MRZ Reader, drop a photo of the ID page, and Zro7 OCRs the two 44-character lines, parses every field, and recomputes each check digit locally. If a digit fails, the field is flagged red — no server round-trip.

What the MRZ actually contains

ICAO Doc 9303 defines the TD3 format used by passports: two lines of 44 characters each. Line 1 encodes document type, issuing country, and the holder's name. Line 2 encodes passport number, nationality, date of birth, sex, expiration date, and personal number — each followed by a check digit, plus a composite check digit at the end.

The check-digit algorithm (weights 7-3-1)

  1. Map each character to a number: 0–9 as themselves, A–Z as 10–35, filler < as 0.
  2. Multiply each digit by the repeating weight pattern 7, 3, 1.
  3. Sum the products and take modulo 10 — that's the check digit.
  4. If the character in the check-digit position matches, the field is valid.

Why local verification matters

  • The MRZ is your most sensitive identifier — it's the string used for border checks and KYC.
  • Any SaaS 'passport OCR' service sees every passport you upload.
  • Client-side OCR + check-digit math gives you the same 'green tick' with zero exposure.

Steps

  1. Open Passport MRZ Reader.
  2. Drop a well-lit photo or scan of the ID page.
  3. Review the parsed fields; failed check digits are highlighted.
  4. Copy the JSON, or clear the tab to erase everything.

Frequently asked questions

Does it work for ID cards and visas too?

Yes — Zro7 detects TD1 (ID card, 3 lines × 30 chars), TD2 (some visas, 2 × 36), and TD3 (passport, 2 × 44).

What if OCR misreads a character?

A wrong character will break the corresponding check digit and be flagged red so you can correct it manually.

Is the passport image saved anywhere?

No. Everything happens in your browser tab; refresh to erase it.

Can it verify the digital NFC chip?

No — that requires the physical passport and BAC keys. Zro7 only handles the visual MRZ.

Is this ICAO-compliant?

Zro7 implements the MRZ parsing and check-digit algorithm from ICAO Doc 9303.

Related posts

← Back to blog