The TD3 layout
Passport data pages carry a machine-readable zone (MRZ) of two lines, each exactly 44 characters, printed in the OCR-B typeface. Line 1 holds the document type, issuing state and name; line 2 holds the numbers and dates. The ICAO specimen reads:
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10The 7-3-1 check digit
Each check digit is calculated the same way: every character is given a value, multiplied by a repeating weight of 7, 3, 1, and the sum is taken modulo 10.
- Digits 0–9 keep their value; letters A–Z count as 10–35; the filler < counts as 0.
- Position 10 checks the document number (positions 1–9).
- Position 20 checks the date of birth (YYMMDD).
- Position 28 checks the expiry date (YYMMDD).
- Position 43 checks the optional data; position 44 is a composite check over the number, dates and optional data.
Worked example
Document number L898902C3: L=21, 8, 9, 8, 9, 0, 2, C=12, 3. With weights 7,3,1,7,3,1,7,3,1 the products are 147, 24, 9, 56, 27, 0, 14, 36, 3 — a sum of 316. 316 mod 10 = 6, which matches the digit printed at position 10.
How Mahad OCR uses it
When a passport is uploaded, the MRZ is read first by a deterministic reader on our own servers — no AI provider is involved on this path. Each check digit is verified field by field: fields proven by a valid check digit are marked ✓ confirmed; a failed check digit marks the field ⚠ check it and sends the document to human review. If no valid MRZ is found, the AI reader takes over.
A valid check digit shows the characters were read correctly. It does not show that the passport is genuine; Mahad OCR does not check documents against any government database.
Try it on your own documents
Upload a document in the live demo, or get an API key and integrate.