MRZ formats: the ID card MRZ (TD1), TD2, TD3 passports and MRV visas
An ID card MRZ is usually three lines of 30 characters (format TD1); a passport has two lines of 44 (TD3); TD2 cards and MRV-B visas use two lines of 36, MRV-A visas two lines of 44. The size of the document decides the format, and the first letter (I, A, C, P or V) confirms it. Below: which real documents use which format, every layout position by position, and the cases that break parsers.

ID card MRZ or passport MRZ: how to tell in two seconds
Count the lines, then count the characters on one line. Those two numbers are enough to name the format, because ICAO 9303, the international standard for machine readable travel documents, gives each document size its own layout. The machine readable zone (MRZ) of an ID card is almost always three lines of 30 characters; a passport always has two lines of 44.
| Format | Lines × characters | Document size | Typical documents | ICAO Doc 9303 |
|---|---|---|---|---|
| TD1 | 3 × 30 | 85.6 × 54 mm (bank card) | National ID cards, residence permits, US passport card | Part 5 |
| TD2 | 2 × 36 | 105 × 74 mm | Older ID cards, some residence and travel documents | Part 6 |
| TD3 | 2 × 44 | 125 × 88 mm (passport page) | Passports | Part 4 |
| MRV-A | 2 × 44 | 80 × 120 mm | Visa stickers that fill a passport page | Part 7 |
| MRV-B | 2 × 36 | 74 × 105 mm | Smaller visa stickers | Part 7 |
The first character confirms the guess. P opens a passport, V a visa, and I, A or C an ID card or another official travel document. A two line zone of 44 characters starting with V is therefore a visa, not a passport, even though both share the same line length.
For what each character means on a passport, the basics are in our guide to the machine readable zone. This page compares the five layouts side by side, shows which real documents use which, and lists the traps that make a parser fail on a valid card.
Which document uses which MRZ format
The format follows the size of the document, not its country. Some families are fixed by law, which makes them predictable for anyone who processes documents at scale:
| Document | MRZ format | What to know |
|---|---|---|
| Passport (every ICAO member state) | TD3 | Two lines on the data page, under the photo. Emergency and temporary passports use the same layout. |
| EU national ID card issued since 2 August 2021 | TD1 | Required by Regulation (EU) 2019/1157: bank card size, MRZ on the back. |
| EU residence permit (uniform format) | TD1 | Card format with the MRZ on the back. |
| US passport card | TD1 | Three lines of 30 on the back of the card. |
| French ID card issued before 2021 | Not ICAO | Two lines of 36 characters with a national layout: a TD2 parser reads it wrong. |
| US permanent resident card (green card) | Close to TD1 | Three lines of 30 with its own document code; parsers often need a specific rule. |
| Swiss driving licence | Not ICAO | Three lines of 9, 30 and 30 characters. |
| Visa sticker | MRV-A or MRV-B | Chosen by the issuing state to fit the passport page; no composite check digit. |
| Most driving licences | None | Data sits in the printed fields or a barcode. |
Two lessons come out of this table. First, the line length alone is not a reliable country or document detector: the old French card and the TD2 format share 36 characters per line but not the same field order. Second, a card without an MRZ is common outside travel documents, so a reading flow has to fall back on the printed fields of the visual inspection zone (VIZ).
The ID card MRZ (TD1), position by position
TD1 is the format behind the query « mrz id card ». It spreads the data over three short lines, and the order is not the passport order: the document number comes first, on line 1, and the name moves down to line 3. Here is the ICAO specimen card, with valid check digits:
I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<| Line | Positions | Field | Specimen value |
|---|---|---|---|
| 1 | 1 to 2 | Document code | I< |
| 1 | 3 to 5 | Issuing state | UTO |
| 1 | 6 to 14 | Document number | D23145890 |
| 1 | 15 | Check digit of the document number | 7 |
| 1 | 16 to 30 | Optional data (issuer's choice) | empty |
| 2 | 1 to 6 | Date of birth (YYMMDD) | 740812 |
| 2 | 7 | Check digit | 2 |
| 2 | 8 | Sex (F, M or <) | F |
| 2 | 9 to 14 | Date of expiry (YYMMDD) | 120415 |
| 2 | 15 | Check digit | 9 |
| 2 | 16 to 18 | Nationality | UTO |
| 2 | 19 to 29 | Optional data | empty |
| 2 | 30 | Composite check digit | 6 |
| 3 | 1 to 30 | Name: surname << given names | ERIKSSON<<ANNA<MARIA |
The composite digit at the end of line 2 covers line 1 from position 6 to 30 and line 2 from 1 to 7, 9 to 15 and 19 to 29: everything except the document code, the issuing state, the sex and the nationality. The optional data of a TD1 card has no check digit of its own, which is why some issuers store a second number there that only the composite protects. The arithmetic behind each digit is explained in our guide to the MRZ checksum on ID cards and passports.
Long document numbers on TD1 cards
Nine positions are not always enough. When a card number has more than 9 characters, Doc 9303 part 5 puts the first 9 at positions 6 to 14, a filler « < » at position 15 where the check digit would be, then the rest of the number followed by its check digit at the start of the optional data. A parser that always reads position 15 as a digit rejects these cards or returns a truncated number, and the error only shows on a few countries, which makes it hard to catch in testing.
A name squeezed into 30 characters
Line 3 holds the whole name in 30 positions, against 39 on a passport. Long names are cut, and Doc 9303 part 3 sets how: given names are shortened first, then the surname if needed. The MRZ name of a TD1 card is therefore often shorter than the printed name, so a strict equality test between the two fields flags genuine cards. A comparison that accepts truncation and transliteration (Ü written UE or U) avoids those false alarms.
The passport MRZ (TD3) in one table
The passport format is the most common and the most documented. The ICAO specimen reads:
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10| Line | Positions | Field |
|---|---|---|
| 1 | 1 to 2 | Document code (P plus one character chosen by the state) |
| 1 | 3 to 5 | Issuing state |
| 1 | 6 to 44 | Name (39 positions) |
| 2 | 1 to 9, then 10 | Document number, check digit |
| 2 | 11 to 13 | Nationality |
| 2 | 14 to 19, then 20 | Date of birth, check digit |
| 2 | 21 | Sex |
| 2 | 22 to 27, then 28 | Date of expiry, check digit |
| 2 | 29 to 42, then 43 | Personal number or optional data, check digit |
| 2 | 44 | Composite check digit |
Compared with TD1, the passport keeps the name on line 1, places the nationality right after the document number, and gives the personal number its own check digit. Those three differences are the usual source of bugs when one parser is reused for both families.
The TD2 format, between card and passport
TD2 has the order of a passport with the lengths of a smaller card: the name field shrinks to 31 positions and the optional data to 7. It is now rare on new ID cards but still turns up on older cards and on some residence and official travel documents. The specimen:
I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6| Line | Positions | Field |
|---|---|---|
| 1 | 1 to 2 | Document code (I, A or C plus one character) |
| 1 | 3 to 5 | Issuing state |
| 1 | 6 to 36 | Name (31 positions) |
| 2 | 1 to 9, then 10 | Document number, check digit |
| 2 | 11 to 13 | Nationality |
| 2 | 14 to 19, then 20 | Date of birth, check digit |
| 2 | 21 | Sex |
| 2 | 22 to 27, then 28 | Date of expiry, check digit |
| 2 | 29 to 35 | Optional data (no check digit) |
| 2 | 36 | Composite check digit |
Visa formats: MRV-A and MRV-B
A machine readable visa (MRV) is a sticker placed in a passport. Its zone looks like a passport or TD2 zone, starts with V, and has one structural difference: there is no composite check digit, and the optional data at the end of line 2 is not protected at all. MRV-A has two lines of 44, MRV-B two lines of 36 so that the sticker leaves room on the page.
MRV-A specimen
V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L8988901C4XXX4009078F96121096ZE184226B<<<<<<
MRV-B specimen
V<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
L8988901C4XXX4009078F9612109<<<<<<<<| MRV-A | MRV-B | |
|---|---|---|
| Lines × characters | 2 × 44 | 2 × 36 |
| Name field | 39 positions | 31 positions |
| Optional data, line 2 | Positions 29 to 44 (16) | Positions 29 to 36 (8) |
| Check digits | Number, birth date, expiry | Number, birth date, expiry |
| Composite check digit | None | None |
The nationality XXX in the ICAO visa specimen is a real code: it marks a person of unspecified nationality. Other reserved codes appear on refugee and stateless documents, so a country list that only holds the ISO 3166 states rejects valid zones.
Document codes: what the first two characters say
The first character names the family and is fixed by Doc 9303: P for passports, V for visas, and I, A or C for ID cards and other official travel documents in TD1 or TD2 size. The second character is left to the issuing state. Many passports use « P< »; others use a letter to mark a diplomatic, service or emergency passport, with codes that vary from one country to the next.
This is the part of the standard that is moving. ICAO is revising Doc 9303 with a wider set of document codes so that ordinary, diplomatic, service, temporary and emergency passports can be told apart without a country table, plus stricter printing rules and stricter consistency between the MRZ and the printed page, as reported by Biometric Update in December 2025. Documents in both generations will circulate together for years, so a parser should treat the second character as information to return, not as a value to validate against a fixed list.
How a parser recognises the format
Format detection is the first step of any MRZ reader, before field splitting and check digits. A short version in Python, applied to the lines once the OCR has returned them:
def mrz_format(lines):
lines = [l.strip().replace(" ", "") for l in lines if l.strip()]
sizes = (len(lines), len(lines[0]) if lines else 0)
first = lines[0][0] if lines else ""
if sizes == (3, 30):
return "TD1"
if sizes == (2, 44):
return "MRV-A" if first == "V" else "TD3"
if sizes == (2, 36):
return "MRV-B" if first == "V" else "TD2 (or a national 36 character layout)"
return "unknown: check the crop and the line breaks"
mrz_format(["I<UTOD231458907<<<<<<<<<<<<<<<",
"7408122F1204159UTO<<<<<<<<<<<6",
"ERIKSSON<<ANNA<MARIA<<<<<<<<<<"]) # 'TD1'The function was run on the five ICAO specimens quoted on this page. In production, the hard part is not the rule but the input. These are the cases that send a valid document to « unknown »:
- Lines merged or split by the OCR. A TD1 zone read as two lines of 45 characters, or a passport line cut in two, breaks the count. Joining all characters and testing the total length (90, 72 or 88) is a sturdier first test.
- Fillers read as letters. A « < » read as K or « « » changes nothing in the length but breaks every later step; a reader that knows the expected format can correct runs of fillers.
- The wrong side of the card. On most TD1 cards the MRZ is on the back. A front side alone has no MRZ, so the reading has to come from the printed fields, or the user has to send both sides.
- National layouts. The old French card and the Swiss licence need their own rules. Labelling them TD2 or TD1 produces fields that look plausible and are wrong.
What the format tells you, and what it does not
A zone with the right number of lines, the right lengths and valid check digits is a well formed MRZ. It is not proof that the document is genuine: the layout and the checksum algorithm are public, so an edited scan can carry a perfect zone. The checks that carry information sit around the MRZ: agreement between the MRZ and the printed fields, an expiry date in the future, a document code consistent with the document shown, traces of editing in a PDF file, signs of retouching in a photo.
Koncile reads the MRZ of passports, ID cards and residence permits in all of these formats, returns the lines and the parsed fields together with the printed fields, and adds a fraud score from 0 to 100 on the file. A score is a signal to verify, never an accusation, and the service does not read the chip, match faces or check liveness. The fields returned are described on the ID card OCR page.
Frequently asked questions
01What is the MRZ on an ID card?
It is the block of three lines of 30 characters, usually on the back of the card, that holds the document number, the dates of birth and expiry, the sex, the nationality and the name in a fixed order. This layout is called TD1 in ICAO Doc 9303, part 5.
02What is the difference between TD1, TD2 and TD3?
The size of the document. TD1 is a bank card size with 3 lines of 30 characters, TD2 is a larger card with 2 lines of 36, and TD3 is the passport page with 2 lines of 44. The field order of TD2 and TD3 is the same; TD1 puts the document number on line 1 and the name on line 3.
03Do all ID cards have an MRZ?
No. EU national ID cards issued since 2 August 2021 must have one, as do EU residence permits and the US passport card. Many older cards, most driving licences and some national cards have none, or use a national layout that does not follow ICAO.
04Which MRZ format do visas use?
MRV-A (2 lines of 44) or MRV-B (2 lines of 36). The zone starts with V and has no composite check digit, which is the main difference with a passport zone of the same length.
05Why does my parser fail on some valid TD1 cards?
The most common causes are a document number longer than 9 characters, stored partly in the optional data with a filler at position 15, and names cut to fit 30 positions. Reserved nationality codes such as XXX, used for unspecified nationality, also trip parsers that only accept ISO country codes.
06What does the second letter of a passport MRZ mean?
It is chosen by the issuing state. Many passports use P followed by a filler; others use a letter to mark a diplomatic, service or emergency passport. ICAO is revising the document codes to make these categories readable without a country table.
07Is the old French ID card MRZ a TD2 zone?
No. It has two lines of 36 characters, like TD2, but a national field order. French cards issued since 2021 follow the TD1 layout.
08Does a valid MRZ format prove a document is genuine?
No. The layout and the check digit algorithm are public, so an edited image can carry a well formed zone. Authenticity needs other checks: consistency with the printed fields, expiry, and traces of editing in the file itself.
Sources
- ICAO Doc 9303, part 3: specifications common to all MRTDs (check digits, name truncation, transliteration)
- ICAO Doc 9303, part 4: machine readable passports (TD3)
- ICAO Doc 9303, part 5: TD1 size documents
- ICAO Doc 9303, part 6: TD2 size documents
- ICAO Doc 9303, part 7: machine readable visas (MRV-A, MRV-B)
- Regulation (EU) 2019/1157 on the security of identity cards and residence documents
Read any MRZ format in one call
Upload a passport, an ID card or a residence permit to a Koncile account and get the MRZ lines, the parsed fields, the printed fields and a fraud score. 20 free credits, no card, for professional use.
Create a free Koncile accountTalk to an expert
Documents are deleted after analysis. Face match, liveness and chip reading are not part of the service.