Capture with prompts
The web widget shows a frame and prompts, and the quality check filters out blurred, dark and cropped shots. The bottom edge of the document with the MRZ must fit in the frame entirely.
MRZ recognition from a photo or scan: NeuroVision finds the machine-readable zone on a passport, ID card or residence permit, reads the lines, recalculates the check digits and compares them with the data on the document page. The MRZ lines and the parsed fields arrive in JSON through the REST API or the web widget — together with the rest of the document data.
The MRZ has 37 permitted characters: the letters A–Z, the digits 0–9 and the filler character «<», which replaces spaces and empty positions. The font is the monospaced OCR-B, so every position stays in its place.
Document type, issuing country, surname and given name, number, nationality, date of birth, sex and expiry date — the same details that are printed for a person in the visual zone (VIZ).
The document number, the dates and the optional data are followed by check digits. A misread character or an edited field changes the result of the calculation.
The service does not simply “see text”: it detects the format, splits the lines into fields, brings the dates to a single format and returns the MRZ check status in one API response.
The MRZ is not the chip. The machine-readable zone (MRZ, ICAO Doc 9303) is printed on paper and is read from an ordinary photograph; the chip can only be read over NFC — see the differences in the “OCR of the MRZ vs. reading the chip” block. Where the MRZ is on a passport and how it is used to check for forgeries by hand — in the article on the machine-readable zone.
Documents with an MRZ come in three sizes, each with its own line layout. The service detects the format by itself — from the number of lines, their length and the document code in the first positions — so reading the MRZ of a document does not require the user to choose the type in advance.
An MRV-A visa line is easy to confuse with a passport line: it has the same length, but the first letter is V and the set of fields is different. The model tells them apart by the document code.
Card documents: ID-1, three lines of 30 characters.
Passports: ID-3, two lines of 44 characters — the main format of this page.
Mid-size documents: ID-2, two lines of 36 characters.
Example MRZ of an international passport (fictitious data)
MRZP<RUSTSVETKOVA<<IULIIA<<<<<<<<<<<<<<<<<<<<<<
0000000000RUS9001011F3001019<<<<<<<<<<<<<<06 valueUTC). How check digits are recalculated by hand — in our article A Russian citizen has two documents with an MRZ, and they are built differently. The international passport is an ordinary ICAO TD3: type P, the name in Latin letters under the transliteration rules, the expiry date in line 2. In the Russian internal passport (since 1 July 2011) the document code is PN, the full name is written by encoding, there is no expiry date, but there are the series, the issue date and the issuing-authority code.
The service knows both schemes and splits each into fields. Passports issued before July 2011 have no MRZ — they are read from the visual zone (the page about passport recognition). More on the form and its protection — in the article “Security features of a Russian passport”.
Example MRZ of a Russian internal passport (fictitious data)
MRZPNRUSCVETKOVA<<7LI8<PETROVNA<<<<<<<<<<<<<<<<
0000000000RUS9001011F<<<<<<<0200101000000<62 Line 2, positions 1–9 — the first three digits of the series and the number; 22–28 — empty; 29–42 — the last digit of the series, the issue date (YYMMDD) and the issuing-authority code without the hyphen. The check digits use the same 7‑3‑1 algorithm as in the international passport.
Ё → 2 · Ж → J · Й → Q · Х → H · Ц → C · Ч → 3 · Ш → 4 · Щ → W · Ъ → X · Ы → Y · Ь → 9 · Э → 6 · Ю → 7 · Я → 8
Ё → E · Ж → ZH · Й → I · Х → KH · Ц → TS · Ч → CH · Ш → SH · Щ → SHCH · Ъ → IE · Ы → Y · Ь → — (not transmitted) · Э → E · Ю → IU · Я → IA
Ё → YO · Ж → ZH · Й → J · Х → X · Ц → CZ or C · Ч → CH · Ш → SH · Щ → SHH · Ъ → '' (two apostrophes) · Ы → Y' · Ь → ' (apostrophe) · Э → E' · Ю → YU · Я → YA
Example: Цветкова Юлия: CVETKOVA<<7LI8 (internal passport), TSVETKOVA IULIIA (international passport), CZVETKOVA YULIYA (GOST). The other letters coincide in all three systems (А — A, Б — B, В — V, etc.). The transliteration in an international passport can be changed on request (both “YULIYA” and “IULIIA” are found in the MRZ): the service does not treat such a discrepancy as an error if the MRZ line matches the Latin text of the visual zone of the same document. Comparing a client's different documents with each other is separate logic of your system.
What does the checksum in a passport mean? It is a digit calculated from the neighbouring MRZ characters. The service recalculates it for each protected field and compares it with the printed one. A mismatch means a reading error, a damaged document or altered data — in the API response this is isMRZValid and the error [document] bad mrz checksum.
Check digits catch errors and crude edits but do not prove authenticity: the algorithm is published, and whoever forged a document can recalculate them. That is why the service compares the MRZ with the visual zone (the block below) and looks for traces of image editing — document authenticity check.
A digit after the nine characters of the number. It catches a typo and a swap of adjacent digits — the most frequent errors of both manual entry and OCR.
Protects the six digits YYMMDD. A changed year of birth without recalculating the digit is visible at once.
Protects the expiry date. In the MRZ of a Russian internal passport the field is empty, and a «<».
In a passport — a personal number or data at the state's discretion. In a Russian passport this is the issue date and the issuing-authority code, and they are also under control.
Calculated over the number, the dates and the optional data together. It matches only if all the fields are consistent at once.
Digits are taken as they are, the letters A–Z as 10–35, «<» as 0. The values are multiplied cyclically by 7, 3 and 1, the products are added up, and the remainder of division by 10 is the check digit. Example: the date 900101 → 9×7 + 0×3 + 0×1 + 1×7 + 0×3 + 1×1 = 71 → 1.
The MRZ is read together with the whole document in one request: the client takes a photo, and your system receives the zone lines, the parsed fields and the check statuses. All passport fields, including the registration page.
If a field in a document has been altered, it is most often altered where a person can see it — in the visual zone. The machine-readable zone then stays as it was or is recalculated with an error. The service compares both zones field by field and shows where they differ. The illustrations show a fictitious document “SPECIMEN”. A discrepancy is a reason to retake the document or send the application for manual review, not a conclusion of forgery: glare, a bent corner or an old form also cause reading errors.
In a biometric international passport the data is stored twice: printed in the MRZ and written to an electronic chip. These are two different ways to obtain the data, and each has its own job.
| Criterion | Reading the RFID chip over NFC | OCR of the MRZ from a photo — NeuroVision |
|---|---|---|
| What the client needs | a smartphone with NFC and a native app | a phone or computer camera, a browser |
| Which documents | only documents with a chip (eMRTD) | all documents with an MRZ, including those without a chip: the Russian internal passport, old international passports, ID cards |
| How the data is obtained | the app opens the chip with a key derived from the MRZ and reads the recorded data | the lines in the image are recognised |
| What it confirms | the data was recorded when the document was issued and signed with the state's digital signature | the data is consistent with itself and with the visual zone |
| Holder's photo | a digital photograph from the chip | is cut out from the page image |
| Where it works | only in an app, the document is held against the phone | a website, a mobile browser, WebView, an office |
| Available in NeuroVision | no | yes |
NeuroVision does not read the chip. The service works with the image of the document: it reads the MRZ and the visual zone, compares them and looks for traces of image editing. If your procedure requires a cryptographic check of the chip data, a separate app with NFC performs it. For mass onboarding where documents are sent as a photograph and not every client has a biometric passport, OCR of the MRZ solves the task without installing an app.
Glare on the lamination
The passport page is covered with film, and a flash or a lamp leaves a spot right on the MRZ lines. It helps to shoot without a flash and at a slight angle to the light source — the widget prompts “remove the glare”.
Cropped bottom edge
The MRZ is the lowest part of the page, and the frame or a finger cuts it off first. If the lines are not entirely visible, the service will return [document] cropped orbad mrz checksum and ask for a retake.
Blur and perspective
The monospaced font is small: with motion blur “8” becomes “B”, “5” becomes “S”. The service straightens the perspective and takes into account which characters are allowed in each position, but a sharp shot is more reliable than any correction. How to reduce the number of retakes — in the article “Why users retake documents”. OCR and MRZ quality metrics — in the article “How to improve the accuracy of AI OCR and MRZ checks in KYC”.
Damage and old forms
Worn, stained or torn pages are read worse. Russian internal passports issued before July 2011 have no MRZ at all — their data is taken from the visual zone.
The error code and a prompt for the client — from the error reference
KYC with an MRZ check is connected with one method: the zone lines, the parsed fields and the MRZ status arrive together with the rest of the document data. No separate integration for the MRZ is needed.
Test access for 1 month, a personal manager, support through a ticket system, payment only for recognised documents.
Request
cURLcurl -X POST "https://api.neuro-vision.ru/v1/kyc/process" \
-H "token: <jwt-token>" \
-F "images=@passport.jpg" \
-F "ocr=true" \
-F "mode=sync" Response: an international passport with an MRZ
JSON{
"status": "success",
"results": [
{
"status": "success",
"type": "passport",
"docName": "RUS — ePassport (2021)",
"errors": [],
"checks": [
{
"caption": "fraud",
"items": [
{ "caption": "isMRZValid", "status": "success" },
{ "caption": "isEdited", "status": "success" }
]
}
],
"ocr": {
"status": "success",
"fields": [
{ "title": "Surname", "value": "TSVETKOVA", "conf": "high" },
{ "title": "Given name(s)", "value": "IULIIA", "conf": "high" },
{ "title": "Document number", "value": "000000000", "conf": "high" },
{ "title": "Date of birth", "value": "01.01.1990", "valueUTC": "1990-01-01T00:00:00Z", "conf": "high" },
{ "title": "Date of expiry", "value": "01.01.2030", "valueUTC": "2030-01-01T00:00:00Z", "conf": "high" },
{ "title": "MRZ Strings", "value": "P<RUSTSVETKOVA<<IULIIA<<<<<<<<<<<<<<<<<<<<<<\n0000000000RUS9001011F3001019<<<<<<<<<<<<<<06", "conf": "high" }
]
}
}
]
} If the MRZ was not read or the check digits do not match, in errors you will get [document] bad mrz checksum. What to do — retake, send to an operator or reject — is up to you.
The MRZ helps where there are many documents of foreigners and international passports, and the data is needed in Latin letters and without errors. Checking non-residents against sanctions lists and databases.
MRZ reading and checksum verification are included in document recognition — there is no separate charge for the MRZ. There is no subscription fee.
Calculate the costTerms found in the ICAO standard, in the API documentation and in document-verification requirements.
Send us your task — we will give you test access to the API and the web widget for a month and check MRZ reading on your documents.
Can't put your request into words? Book a call and our team will contact you at a convenient time
Book a callThe company is included in the register of IT companies and the register of personal data operators of the Russian Ministry of Digital Development.
Address: Moscow, Presnenskaya Embankment 12 — Moscow City business centre, Federation Tower. Nearest metro stations: Delovoy Tsentr and Mezhdunarodnaya.
How the machine-readable zone is built and how documents are checked — in our blog
Answers about passport types, the registration page, accuracy, data storage and integration
It is two lines of Latin letters and digits at the bottom of the page with the photograph, in which, under ICAO Doc 9303, the document type, country, surname and given name, number, dates and check digits are recorded. On ID cards the MRZ has three lines and is on the back. The zone is needed so that the document data can be read automatically and verified.
Passports (TD3 format), ID cards and card-format residence permits (TD1) and TD2 documents from 195+ countries and territories, including the Russian international passport and internal passport. The full list is in the documentation; forms without an MRZ are marked “not MRZ” there.
Yes, in the Russian internal passport the machine-readable record has been filled in since 1 July 2011: it is at the bottom of the third page. Passports issued earlier have no zone — these are legal documents, and the service takes their data from the visual zone.
In the internal passport Cyrillic is written with an encoding, not a transliteration: letters without a Latin counterpart are replaced with digits and letters, for example Ч — 3, Ш — 4, Ю — 7, Я — 8. The service knows this table and compares such a record with the full name on the page.
In an international passport the surname and given name are written in Latin letters under rules based on ICAO Doc 9303: Ю — IU, Я — IA, Ц — TS. GOST 7.79 is not used in passports. At the citizen's request the spelling may be different, for example as in a previous passport, so the MRZ is compared with the Latin text of the same document.
Not necessarily. Check digits confirm that the record is consistent, but the algorithm is published, and whoever altered the document can recalculate them. That is why the service also compares the MRZ with the visual zone and looks for traces of image editing.
No. The service works with the image of the document: it reads the MRZ and the visual zone from a photo. The chip of a biometric passport is read only over NFC in a separate app; on the other hand, OCR of the MRZ works in a browser and for documents without a chip.
Ask the client to retake the document without a flash so that the bottom lines fit in the frame entirely. The API will indicate the reason with an error code: bad mrz checksum — the lines were not read or the checksums do not match, cropped — the document is cropped. The web widget shows prompts already during capture.
The MRZ is read as part of document recognition: you receive both the zone lines and the fields of the visual zone in one response. There is no separate MRZ-only mode.
A passport scanner is a device at a desk that reads a document with backlighting and suits cases when the client comes in person. MRZ OCR works with a photograph: the client photographs the document with a phone on a website or in an app, and the data arrives through the API without any equipment.
There is no separate charge for the MRZ: reading and checksum verification are included in document recognition — from 16 ₽ with anti-fraud. The first month is a free test.
In Russia: in the NeuroVision cloud or on your servers when installed in your perimeter. Processing complies with 152‑FZ; in the cloud, original images are stored for 3 months free of charge and then at the tariff rate, and with an installation on your side they never leave your infrastructure.