TD1, TD2 and TD3 MRZ format: line sizes explained
· 3 min read
The machine readable zone (MRZ) at the bottom of an identity document comes in three sizes, called TD1, TD2 and TD3. ICAO Doc 9303 defines each one: a TD3 passport has two lines of 44 characters, a TD1 card has three lines of 30, and a TD2 has two lines of 36. The two machine readable visa formats, MRV-A and MRV-B, also use two lines, of 44 and 36 characters.
Line counts at a glance
- TD3 is the size of a passport data page. Two lines of 44 characters each (Doc 9303 Part 4).
- TD1 is the size of a credit card. Three lines of 30 characters each (Doc 9303 Part 5).
- TD2 is a larger card format. Two lines of 36 characters each (Doc 9303 Part 6). ICAO says it will no longer maintain the TD2 specifications beyond the 8th edition, because many states have moved to TD1.
- MRV-A is a visa label, 80 by 120 mm. Two lines of 44 characters.
- MRV-B is a visa format 105 mm wide. Two lines of 36 characters.
You can check these numbers yourself. The ICAO Part 4 PDF for TD3 and the ICAO Part 5 PDF for TD1 are free on icao.int, and their MRZ tables give the positions.
How TD3 is laid out
The first line starts with the document code. For a passport the first character is always P, so a line that begins with P and a second character describes a machine readable passport. The issuing country takes positions 3 to 5 as a three-letter code, and the name fills positions 6 to 44. Double filler characters (<<) separate the primary identifier, usually the surname, from the given names.
The second line holds the document number in positions 1 to 9, its check digit in position 10, nationality in 11 to 13, date of birth in 14 to 19, sex in 21, and expiry date in 22 to 27. Positions 29 to 42 are for optional data, and position 44 is a composite check digit over most of the line.
Here is a fictional specimen in the style of ICAO's examples, for the invented country Utopia:
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F3404148ZE184226B<<<<<12
How TD1 differs
A TD1 card has three lines, and the field layout is split differently. The document number and its check digit sit on the first line. Date of birth, sex, expiry date and the composite check digit sit on the second line. The name is on the third line, so a reader built for passports, which expects the name on line 1, will put the wrong text in the wrong field if it is not told the card format. Read the lines in the right order and check the length of each one before you parse anything.
Check the format before you parse
Count the lines first. Three lines of about 30 characters means a card. Two lines of 44 means a TD3 passport, and two lines of 36 means TD2 or MRV-B. Then look at the first character. A P in line 1 marks a passport. If the check digits fail after you apply the wrong layout, that failure is a signal to stop and re-check the format, not to guess at the fields.
What the MRZ does not contain
The TD3 machine readable zone has no field for place of birth or for the date of issue. Those appear only in the printed part of the page, which has no fixed layout, and the printed fields change from country to country. Passport fields explained in detail, including the printed items, are covered in passport fields explained. For the arithmetic behind the check digits, see MRZ check digit calculation.
If you are new to the MRZ itself, start with what the MRZ is. The point to keep in mind is that the line count tells you the format, and the format tells you where each field should be.
Where ScanPass fits
ScanPass is an iPhone app for charter companies, marinas and yacht agents. It reads the passport data page, parses the TD3 machine readable zone, checks the check digits, and lets you correct every field before saving. It is still in development and coming soon to the App Store. It is not downloadable yet.