MRZ OCR: read, parse and check the machine readable zone of passports and ID cards
The machine readable zone (MRZ) is the strip of characters at the bottom of a passport's data page or on the back of an ID card. It repeats the key fields in a fixed layout with check digits, which makes it the most reliable part of the document to read by machine. Koncile reads it from a photo, a scan or a PDF, parses it, recomputes the check digits and compares it with the printed zone. A software MRZ reader, not a hardware scanner.
What an MRZ contains
The format is defined by the ICAO 9303 standard. A passport carries two lines of 44 characters (TD3). A national ID card carries three lines of 30 characters (TD1). Some older ID documents and visas use two lines of 36 (TD2, MRV). The character set is limited to capital letters, digits and the filler « < », printed in the OCR-B font at fixed positions.
| Format | Document | Lines × characters | Main fields |
|---|---|---|---|
| TD3 | Passport | 2 × 44 | Type, issuing country, names, number + check, nationality, birth date + check, sex, expiry + check, optional data, composite check |
| TD1 | ID card, residence permit | 3 × 30 | Type, issuing country, number + check, optional data (line 1); birth date + check, sex, expiry + check, nationality, composite check (line 2); names (line 3) |
| TD2 | Older ID documents | 2 × 36 | Same fields as TD3 with shorter name field |
| MRV-A / MRV-B | Visas | 2 × 44 or 2 × 36 | Visa type, issuing state, names, number, nationality, dates |
P<FRADOE<<JOHN<MICHAEL<<<<<<<<<<<<<<<<<<<<<<
19AB123454FRA9303036M3103016<<<<<<<<<<<<<<02
line 2, position by position:
19AB12345 document number 4 check digit
FRA nationality
930303 birth date (YYMMDD) 6 check digit
M sex
310301 expiry date 6 check digit
<<<<<<<<<<<<<< optional data 0 check digit (empty field)
2 composite check digitHow the check digits work
Each protected field is followed by a digit computed from its characters with the weights 7, 3, 1 repeated, modulo 10 (letters count A = 10 to Z = 35, « < » counts 0). The last digit of the line checks the number, birth date, expiry date and optional data together. A reader that recomputes these digits knows immediately whether it misread a character, or whether a value was modified without the digit being updated. A full worked example on the ICAO specimen passport is in the guide to the MRZ code; the protected positions on each format, and the reading errors an MRZ checksum cannot see, have their own guide.
What Koncile does with the MRZ
- Locate the zone on the image, whatever the orientation, from a photo, a scan or a PDF page.
- Read the characters as fixed positions, which is more reliable than free text OCR.
- Parse the lines into fields according to the format (TD1, TD2, TD3, MRV).
- Recompute every check digit and flag a mismatch.
- Compare the parsed fields with the printed zone: surname, number, birth date, expiry. A disagreement lowers the confidence and raises the fraud score.
- Return the lines as read plus the parsed fields, in the same JSON as the rest of the document.
The MRZ is only part of the reading. The issue date, the place of birth, the address on an ID card and the issuing authority are not in the MRZ: Koncile reads them in the printed zone. See the passport OCR API and ID card OCR pages for the full field list.
What an MRZ does not prove
A valid MRZ with correct check digits proves that the characters are consistent with each other. It does not prove that the document is genuine: a forger who knows the algorithm produces valid check digits, which is why MRZ generators exist and why Koncile does not publish one. That is also why Koncile looks beyond the MRZ: the file's editing traces on a PDF, photo retouching and AI generation on an image, and the agreement between the MRZ and the printed zone. The result is a fraud score from 0 to 100, a signal to verify, not a verdict on the person.
Software MRZ reader versus hardware scanner
Desktop MRZ swipe readers and full page passport scanners read the zone at a counter, with a dedicated device. A software reader like Koncile's reads the zone from any image your application receives: a phone photo uploaded in a form, a scan sent by email, a PDF from a partner. No device, no installation, the same API for the MRZ and for the rest of the document. For a capture on a phone inside your own app, an MRZ scanner SDK (Dynamsoft, Microblink, Regula, Scanbot) guides the user and reads on device; Koncile then processes the image on the server. The comparison of passport OCR APIs and SDKs covers both. Hotels face the same choice at check in, and the guide to the hotel passport scanner lists what each country asks them to record.
Open source MRZ readers
PassportEye (Python, on Tesseract), readmrz, the mrz parser packages for JavaScript and Java: free, self hosted, good for a prototype, limited to the MRZ, sensitive to image quality, without support or fraud control. Koncile is the step after the prototype: the printed fields, confidence levels, both sides of an ID card, a fraud score, and an account that reads the other documents of the file.
Pricing
The MRZ is read as part of the document: 1 credit per page for an extraction, 2 for a fraud analysis. 20 free credits at signup, then from €199 per month for 1,000 credits on koncile.ai.
Frequently asked questions
01What is MRZ OCR?
The reading of the machine readable zone of a passport, ID card or visa by software, from an image or a PDF, with parsing of the fields and recomputation of the check digits. Koncile does it as part of reading the whole document.
02Can I scan the MRZ with a phone?
Yes. A phone photo of the data page is enough if the whole zone is visible, in focus and without glare. Koncile locates the zone whatever the orientation. A cut MRZ comes back with low confidence and is flagged.
03Does the MRZ contain the issue date?
No. The MRZ holds the type, issuing country, names, number, nationality, birth date, sex, expiry date and optional data. The issue date, place of birth, authority and address are printed only in the visual zone, which Koncile reads too.
04What is a check digit?
A digit computed from a field's characters with the weights 7, 3, 1 modulo 10. It lets a reader detect a misread or a modified character. Koncile recomputes all of them.
05Is an MRZ reader an identity verification?
No. It reads and checks the consistency of the zone. Koncile adds file and image controls and a fraud score, but does not read the chip, inspect physical security features or match a face.
06Does Koncile offer an MRZ generator?
No. Generators serve to fabricate documents. Koncile offers reading, checking and, soon, a check digit calculator for developers who want to validate their own parser.
Read an MRZ from a photo or a PDF
Create a Koncile account, upload a passport or an ID card, and get the MRZ lines, the parsed fields, the check digits and the fraud score.
Create a free Koncile accountTalk to an expert
20 free credits, no credit card. Documents are deleted after analysis.