High Programmer > Alan De Smet > Unique ID > Machine Readable Passport Zone

Machine Readable Passport Zone

by Alan De Smet

The International Civil Aviation Organization, a Quebec based group, developed standards for Machine Readable Travel Documents (MRTDs), including passports and visas. These MRTD make it easy for automated systems to scan a travel document. If a country decides to check all visitors against a known criminals data reading the information automatically with a computer will be much faster and less prone to error than if the immagration agent needs to type the information in by hand.

The MRTD standards are encoded in ICAO Document 9303. Part 1 documents Machine Readable Passports (MRPs). This standard was accepted by the International Standards Organization as ISO/IEC 7501-1:1997, ISO/IEC 7501-2:1997, and ISO/IEC 7501-03:1997.

If you're interested in original materials, do not bother with the ISO versions. These $27 documents (well, 34,00 CHF) are are essentially a single page saying, "See ICAO Document 9303". ICAO 9303 is much better and includes several pages documenting the history of the document. It's a bit expensive at $62. You might be able to get it through inter-library loan. I borrowed a copy of the much briefer 3rd edition this way. The 5th edition is much larger (126 pages versus the 30 or so), but I don't access to the 5th edition and am unable to comment on what has been added in the remaining 100 pages.

MRTD's have a Machine Readable Zone (MRZ) at the bottom of them. These MRZes are printed in the monospace font OCR-B. It is printed as "Size 1", which works out to be about 14 point. Further details on the font can be found in ISO Standard 1073-2:1976. The exact location of the MRZ, the type of paper, reflectivity and the like are futher documented in ICAO 9303 and ISO 1831:1980.

On a MR Passport there are two lines. Each line is 44 characters long. There are no blank spaces; where one is necessary is it filled with the filler character, a less than sign (<). Here is an example from ICAO 9303. This person is from the fictional country of Utopia, the country code (UTO) is invalid. I've reformatted it to be similar to a United States passport.



Type / Type / Tipo
Code / Code / Cédigo
Passport No. / No. du Passeport / No. de Pasaporte
Surname / Nom / Apellidos
Given names / Prénoms / Nombres
Nationality / Nationalité / Nacionalidad
Date of birth / Date de naissance / Fecha de nacimiento
06 Aug 1969
Personal no / no personnel
Sex / Dexe / Sexo
Place of birth / Lieu de naissance / Lugar de nacimiento
Date of Issue / Date de délivrance / Fecha de expedición
24 Jun 1989
Authority / Autorité / Autoridad
Passport Office
Date of expiration / Date d' expiration / Fecha de caducidad
23 Jun 1994
Ammendments / Modifications / Enmiendas
See Page 24

Notable differences between the example data and an actual US passport:

So here is the example MRZ.


Here are the fields:


General Notes

All fields are padded with less than signs (<) to fill the required width. There should be no whitespace in the MRZ. Only letters A through Z, digits 0 through 9, and the filler character < are allowed. Some extended letters are mapped to other sets of characters per the following table. The alternate encoding is used when the normal encoding might caused confusion between different names.


P - Passport

The first letter is "P", designating a passport.

t - Passport Type

The second character can be assigned by the issuing country to distinguish different types of passports. If unused a < is assigned.

The United States, at least in the cases I've seen, doesn't use this field.

In the example above there is a <, apparently the fictional country of Utopia doesn't specify specific types, or Anna doesn't need one.

iii - Issuing Country or Organization

The issuing country or organization, encoded in three characters. The code is pulled from this table.

In the example above the code is UTO. This code doesn't exist; it's the fictional country of Utopia for the example.

nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn - Name

This field is the passport holder's name. The general format is "LAST<NAME<<FIRST<NAME<ADDITIONAL<NAMES<<<<<". The name is entirely upper case. Puncuation (like hyphens) are replaced with the filler character < The surname is given first, then the filler character twice (<<), then the remainder of given names. Separate names in the surname or given name are separated with the filler character < The filler character < pads out the field to fill 39 characters.

Suffixes (Jr, Sr, II, III, etc) are encoded as part of the last name, without punctuation.

If the name is too long to fit the most significant parts of the name are used. Names may abbreviated if necessary to make them fit.

In the above example Anna's surname is Eriksson, her first and middle names are Anna and Maria. Her name is encoded as


George Michael Richards-Stevens Jr. would be encoded as


######### - Passport Number

This is the passport number, as assigned by the issuing country. Each country is free to assign numbers using any system it likes. If the number has non-letter or number characters they are replaced with the filler character <.

C - Check digit

Check digits are calculated based on the previous field. Thus, the first check digit is based on the passport number, the next is based on the date of birth, the next on the expiration date, and the next on the personal number. The check digit is calculated using this algorithm.

bbb - Nationality

The issuing country or organization, encoded in three characters. The code is pulled from this table.

In the example above the code is UTO. This code doesn't exist; it's the fictional country of Utopia for the example.

YYMMDD - Date of Birth

The date of the passport holder's birth in YYMMDD form. Year is truncated to the least significant two digits. Single digit months or days are prepended with 0.

In the example Anna was born in August 6th, 1969. That encodes as "690806".

s - Sex

Sex of the passport holder, M for males, F for females, and < for non-specified.

Anna is female, so "F".

yymmdd - Passport Expiration Date

The date the passport expires in YYMMDD form. Year is truncated to the least significant two digits. Single digit months or days are prepended with 0.

Anna's passport expired on June 23rd, 1994 and is encoded "940623".

pppppppppppppp - Personal Number

This field can be used for any purpose that the issuing country desires.

The United States uses this field in some unknown way. My personal passport has a single digit number in the field.

Anna's personal number is ZE184226B, this field is encoded "ZE184226B<<<<<".

X - Final check digit

This is a check digit for positions 1 to 10, 14 to 20, and 22 to 43 on the second line. Thus, the nationality and sex are not included in the check. The check digit is calculated using this algorithm.

Check Digit Calculations

First, break the input into individual characteres and numbers.

Next, convert non-digits into numbers. A through Z are encoded to 10 through 25. The filler character < is encoded as 0.


Now, multiply each number by the corresponding weighting. The first digit is multipled by 7, the next by 3, and the next by 1. The pattern then repeats (7, 3, 1, 7, 3, 1, 7, 3, 1, etc).

Add up the results, then divide by 10. The remainder is the check digit.

As a special case, if the personal number on the second line is not used (and thus entirely filled with the filler character <), the check digit for that section can be replaced with the filler character <.

An example for the input AB2134:

Input:A B 2 1 3 4 < < <
Value:10 11 2 1 3 4 0 0 0
Weight:7 3 1 7 3 1 7 3 1
Products:70 33 2 7 9 4 0 0 0

Division: 125 ÷ 10 = 12, remainder 5

Country / Organization / Special Table

This table is used for both issuing country and nationality. If the code is shorter than 3 characters it is padded to three characters with the filler character <.

The code list is based on the alpha-3 codes in ISO 3166, but is not entirely identical. The United Nations Statistics Division has a free list of ISO 3166 alpha-3 codes.

Country Code
Afghanistan AFG
Albania ALB
Algeria DZA
American Samoa ASM
Andorra AND
Angola AGO
Anguilla AIA
Antarctica ATA
Antigua and Barbuda ATG
Argentina ARG
Armenia ARM
Aruba ABW
Australia AUS
Austria AUT
Azerbaijan AZE
Bahamas BHS
Bahrain BHR
Bangladesh BGD
Barbados BRB
Belarus BLR
Belgium BEL
Belize BLZ
Benin BEN
Bermuda BMU
Bhutan BTN
Bolivia BOL
Bosnia and Herzegovina BIH
Botswana BWA
Bouvet Island BVT
Brazil BRA
British Indian Ocean Territory IOT
Brunei Darussalam BRN
Bulgaria BGR
Burkina Faso BFA
Burundi BDI
Cambodia KHM
Cameroon CMR
Canada CAN
Cape Verde CPV
Cayman Islands CYM
Central African Republic CAF
Chad TCD
Chile CHL
China CHN
Christmas Island CXR
Cocos (Keeling) Islands CCK
Colombia COL
Comoros COM
Congo COG
Cook Islands COK
Costa Rica CRI
Côte d'Ivoire CIV
Croatia HRV
Cuba CUB
Cyprus CYP
Czech Republic CZE
Democratic People's Republic of Korea PRK
Democratic Republic of the Congo COD
Denmark DNK
Djibouti DJI
Dominica DMA
Dominican Republic DOM
East Timor TMP
Ecuador ECU
Egypt EGY
El Salvador SLV
Equatorial Guinea GNQ
Eritrea ERI
Estonia EST
Ethiopia ETH
Falkland Islands (Malvinas) FLK
Faeroe Islands FRO
Fiji FJI
Finland FIN
France FRA
France, Metropolitan FXX
French Guiana GUF
French Polynesia PYF
Gabon GAB
Gambia GMB
Georgia GEO
Germany D
Ghana GHA
Gibraltar GIB
Greece GRC
Greenland GRL
Grenada GRD
Guadeloupe GLP
Guam GUM
Guatemala GTM
Guinea GIN
Guinea-Bissau GNB
Guyana GUY
Haiti HTI
Heard and McDonald Islands HMD
Holy See (Vatican City State) VAT
Honduras HND
Hong Kong HKG
Hungary HUN
Iceland ISL
India IND
Indonesia IDN
Iran, Islamic Republic of IRN
Iraq IRQ
Ireland IRL
Israel ISR
Italy ITA
Jamaica JAM
Japan JPN
Jordan JOR
Kazakhstan KAZ
Kenya KEN
Kiribati KIR
Kuwait KWT
Kyrgyzstan KGZ
Lao People's Democratic Republic LAO
Latvia LVA
Lebanon LBN
Lesotho LSO
Liberia LBR
Libyan Arab Jamahiriya LBY
Liechtenstein LIE
Lithuania LTU
Luxembourg LUX
Madagascar MDG
Malawi MWI
Malaysia MYS
Maldives MDV
Mali MLI
Malta MLT
Marshall Islands MHL
Martinique MTQ
Mauritania MRT
Mauritius MUS
Mayotte MYT
Mexico MEX
Micronesia, Federated States of FSM
Monaco MCO
Mongolia MNG
Montserrat MSR
Morocco MAR
Mozambique MOZ
Myanmar MMR
Namibia NAM
Nauru NRU
Nepal NPL
Netherlands, Kingdom of the NLD
Netherlands Antilles ANT
Neutral Zone NTZ
New Caledonia NCL
New Zealand NZL
Nicaragua NIC
Niger NER
Nigeria NGA
Niue NIU
Norfolk Island NFK
Northern Mariana Islands MNP
Norway NOR
Oman OMN
Pakistan PAK
Palau PLW
Panama PAN
Papua New Guinea PNG
Paraguay PRY
Peru PER
Philippines PHL
Pitcairn PCN
Poland POL
Portugal PRT
Puerto Rico PRI
Qatar QAT
Republic of Korea KOR
Republic of Moldova MDA
Réunion REU
Romania ROM
Russian Federation RUS
Rwanda RWA
Saint Helena SHN
Saint Kitts and Nevis KNA
Saint Lucia LCA
Saint Pierre and Miquelon SPM
Saint Vincent and the Grenadines VCT
Samoa WSM
San Marino SMR
Sao Tome and Principe STP
Saudi Arabia SAU
Senegal SEN
Seychelles SYC
Sierra Leone SLE
Singapore SGP
Slovakia SVK
Slovenia SVN
Solomon Islands SLB
Somalia SOM
South Africa ZAF
South Georgia and the South Sandwich Island SGS
Spain ESP
Sri Lanka LKA
Sudan SDN
Suriname SUR
Svalbard and Jan Mayen Islands SJM
Swaziland SWZ
Sweden SWE
Switzerland CHE
Syrian Arab Republic SYR
Taiwan Province of China TWN
Tajikistan TJK
Thailand THA
The former Yugoslav Republic of Macedonia MKD
Togo TGO
Tokelau TKL
Tonga TON
Trinidad and Tobago TTO
Tunisia TUN
Turkey TUR
Turkmenistan TKM
Turks and Caicos Islands TCA
Tuvalu TUV
Uganda UGA
Ukraine UKR
United Arab Emirates ARE
United Kingdom of Great Britain and Northern Ireland
    - Citizen GBR
    - Dependent territories citizen GBD
    - National (overseas) GBN
    - Overseas citizen GBO
    - Protected Person GBP
    - Subject GBS
United Republic of Tanzania TZA
United States of America USA
United States of America Minor Outlying Islands UMI
Uruguay URY
Uzbekistan UZB
Vanuatu VUT
Venezuela VEN
Viet Nam VNM
Virgin Islands (Great Britian) VGB
Virgin Islands (United States) VIR
Wallis and Futuna Islands WLF
Western Sahara ESH
Yemen YEM
Zaire ZAR
Zambia ZMB
Zimbabwe ZWE
United Nations Organization
  (If indicating nationality,
indicates an UN offical)
United Nations
  specialized agency official
Stateless (per Article 1 of 1954 convention) XXA
(per Article 1 of 1951 convention,
amended by 1967 protocol
Refugee (non-convention) XXC
Unspecified / Unknown XXX

Contact webmaster - Copyright © 2004 (2004-01-31)