Skip to content

Understanding the MRZ ​

The Machine Readable Zone (MRZ) is the block of OCR-B text on the data page of a passport or identity card, defined in ICAO Doc9303 (Parts 3-7). It is central to both KINEGRAM product lines: the MOBILE SCAN SDK reads it optically, and the MOBILE CHIP SDK uses it as the access key to the eMRTD chip.

MRZ Formats ​

FormatLayoutTypical Documents
TD13 lines × 30 charsIdentity cards (credit card size)
TD22 lines × 36 charsOlder/smaller ID documents
TD32 lines × 44 charsPassports
MRV-A2 lines × 44 charsVisas (full size)
MRV-B2 lines × 36 charsVisas (smaller format)

All formats carry the same core fields, arranged differently:

  • Document code (for example P< for passport, I< for ID card)
  • Issuing state (3-letter code)
  • Name (primary and secondary identifier, separated by <<)
  • Document number
  • Nationality
  • Date of birth
  • Sex
  • Date of expiry
  • Optional data (used by some states for a personal number)

The filler character < pads unused positions.

Dates are encoded as YYMMDD, without a century. Converting such a date into a real date requires a windowing rule based on the field: in the specimen below, the date of birth 690806 is 6 August 1969, while the same digits in a date of expiry would mean 2069.

Anatomy of a Passport MRZ ​

The two lines below are the ICAO Doc9303 specimen for a TD3 passport. The first line holds the document type, the issuing state and the name. The second line packs the document number, the key dates and their check digits into fixed positions:

text
P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C<3UTO6908061F9406236ZE184226B<<<<<14

The second line is where the fixed-position layout matters most. Each field occupies a fixed range of characters:

L898902C<Document number
3CD
UTONationality
690806Date of birth
1CD
FSex
940623Date of expiry
6CD
ZE184226B<<<<<Personal number
1CD
4CC

Here CD marks a field check digit and CC the composite check digit that covers the whole line. The filler < pads each field to its fixed length. This is why the short document number L898902C is followed by one < before its check digit 3.

Document numbers longer than 9 characters do not fit the TD3 field at all. Positions 1-9 then hold the first 9 characters, and the check digit position holds a filler <. The remaining characters are placed at the start of the optional data field, followed by the check digit over the complete document number. The Access Key has to be derived from the complete document number. This makes such documents a frequent cause of failed chip access.

Check Digits ​

Several fields carry a check digit so that reading errors can be detected. The check digit is calculated with a repeating 7-3-1 weighting:

  1. Map each character to a value: digits keep their value, A-Z map to 10-35, the filler < maps to 0.
  2. Multiply the values by the repeating weights 7, 3, 1, 7, 3, 1, ….
  3. Add up the products. The check digit is that sum modulo 10.

For example, the document number L898902C from the specimen above produces the check digit 3:

CharacterL898902C
Value2189890212
Weight73173173
Product147249562701436

The products sum to 313, and 313 mod 10 = 3, so the field is stored as L898902C3.

Check digits protect the document number, the date of birth, the date of expiry and, on TD3, the optional data field. Some of these fields may contain letters as well as digits. This is why the mapping above covers A-Z. A final composite check digit covers those fields together, including their individual check digits, so typical OCR errors are detected.

Why the MRZ Is the Key to the Chip ​

The Access Control protocols BAC and PACE derive their Access Key from the MRZ Info: document number, date of birth and date of expiry, each including its check digit.

This is the reason for the typical two-step flow of the KINEGRAM products:

  1. Scan the data page with the MOBILE SCAN SDK to obtain the MRZ.
  2. Read the chip via NFC with the MOBILE CHIP SDK, using the MRZ Info (or alternatively the printed 6-digit CAN, if the document supports PACE) as the access key.

Notes:

  • Pass the document number as printed, without the filler <. For the specimen above this is L898902C, not L898902C<. Both forms are accepted, because the SDKs pad the value to the width of the MRZ field themselves. The printed form is the one to prefer. Document numbers longer than 9 characters are passed in full.
  • Without a correct MRZ (or CAN) the chip cannot be read at all. This is the skimming protection of the eMRTD.
  • The chip stores a copy of the MRZ in Data Group 1, verified by Passive Authentication. Comparing the optically scanned MRZ with Data Group 1 detects manipulated data pages, see Interpreting Verification Results.