Skip to main content
Version: 10.3

Extract machine-readable zone

The machine-readable zone (MRZ) is typically found in official travel or identity documents of many countries. It can have two or three lines of machine-readable data. A new profile allows processing MRZ written in accordance with ICAO Document 9303.

Extract MRZ

To process MRZ, do as follows:

  1. Activate a new profile to extract MRZ.
  2. Set the machineReadableZone value to the profile parameter. The result of recognition is returned in the XML format.
note

Only the XML format is supported and is used by default. Thus, you can omit the exportFormat parameter.

warning

The profile is supported by FREngine 12 only. Use API for FREngine 12: /api/v2/..

Explore field types

In the table below, there are possible MRZ field types:

Field typeDescriptionExample
MrzTypeThe number of lines in MRZ. It can have one of the following values:
  • 2-line
  • 3-line
2-line MRZ: P<USATRAVELER<<HAPPY<<<<<<<<<<<<<<<<<<<<< 3400072370USA6707046F1608078910000193<113538
Line1All characters of the first line of the machine-readable zone.P\<RUSMALBORSKYI\<\<KOVBOJ\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<\<
Line2All characters of the second line of the machine-readable zone.7553279419RUS8712242M2104131<<<<<<<<<<<<<<02
Line3All characters of the third line of the machine-readable zone (if exists).
DocumentTypeThe document type. It is the first character of the first line.P indicates a passport.
DocumentSubtypeThe document subtype (if exists). It is the second character of the first line.
IssuingCountryCode of the issuing state (ISO 3166-1 alpha-3 code).USA
LastNameSurname.TRAVELER
GivenNameOne or several given names separated with the space character.HAPPY
DocumentNumberThe number of a document.340007237
DocumentNumberVerifiedThe Boolean value that specifies whether the checksum over the document number matches the check digit. It can have one of the following values:
  • true
  • false
true
DocumentNumberCheckThe check digit over the document number.0
NationalityNationality (ISO 3166-1 alpha-3 code).USA
BirthDateDate of birth in the following format: YYMMDD.670704
BirthDateVerifiedThe Boolean value that specifies whether the checksum over the birth date matches the check digit. It can have one of the following values:
  • true
  • false
true
BirthDateCheckThe check digit over the birth date.6
SexSex. It can have one of the following values:
  • M
  • F
  • <
ExpiryDateDate of expiry in the following format: YYMMDD.200807
ExpiryDateVerifiedThe Boolean value that specifies whether the checksum over the expiry date matches the check digit. It can have one of the following values:
  • true
  • false
true
ExpiryDateCheckThe check digit over the expiry date.8
PersonalNumberPersonal number. The personal number and its check digit are optional in MRZ.
PersonalNumberVerifiedThe Boolean value that specifies whether the checksum over the personal number matches the check digit. It can have one of the following values:
  • true
  • false
true
PersonalNumberCheckThe check digit over the personal number. The personal number and its check digit are optional in MRZ.
OptionalDataLine1Optional data from the first line of the 3-line MRZ.
OptionalDataLine2Optional data from the second line of the 3-line MRZ.
ChecksumThe check digit over the document number, birth date, expiry date, personal number, optional data, and their check digits.8
ChecksumVerifiedThe Boolean value that specifies whether the checksum over the document number, birth date, expiry date, personal number, optional data, and their check digits matches the check digit. It can have one of the following values:
  • true
  • false
You can check the quality of data extraction by the value of this field. However, mind that there is no check digit over the surname and given names. Therefore, these fields may contain recognition errors even if the checksum over all other fields matches the check digit.
true

View document examples

2-line MRZ

You can find a 2-line MRZ in a US passport.

Extracting 2-line MRZ output
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MRZData>
<Field Type="IssuingCountry">
<Value>USA</Value>
<Region>
<Rect>83,1073,129,1090</Rect>
</Region>
<Chars>
<Char>
<Value>U</Value>
<Rect>83,1073,94,1090</Rect>
</Char>
<Char>
<Value>S</Value>
<Rect>100,1073,111,1090</Rect>
</Char>
<Char>
<Value>A</Value>
<Rect>117,1073,129,1090</Rect>
</Char>
</Chars>
</Field>
<Field Type="LastName">
<Value>TRAVELER</Value>
<Region>
<Rect>134,1073,266,1090</Rect>
</Region>
<Chars>
<Char>
<Value>T</Value>
<Rect>134,1073,146,1090</Rect>
</Char>
<Char>
<Value>R</Value>
<Rect>152,1073,163,1090</Rect>
</Char>
<Char>
<Value>A</Value>
<Rect>169,1073,180,1090</Rect>
</Char>
<Char>
<Value>V</Value>
<Rect>185,1073,198,1090</Rect>
</Char>
<Char>
<Value>E</Value>
<Rect>204,1073,214,1090</Rect>
</Char>
<Char>
<Value>L</Value>
<Rect>221,1073,232,1090</Rect>
</Char>
<Char>
<Value>E</Value>
<Rect>238,1073,249,1089</Rect>
</Char>
<Char>
<Value>R</Value>
<Rect>255,1073,266,1089</Rect>
</Char>
</Chars>
</Field>
<Field Type="GivenName">
<Value>HAPPY</Value>
<Region>
<Rect>306,1072,386,1089</Rect>
</Region>
<Chars>
<Char>
<Value>H</Value>
<Rect>306,1072,317,1089</Rect>
</Char>
<Char>
<Value>A</Value>
<Rect>323,1072,334,1089</Rect>
</Char>
<Char>
<Value>P</Value>
<Rect>340,1072,352,1089</Rect>
</Char>
<Char>
<Value>P</Value>
<Rect>357,1072,369,1089</Rect>
</Char>
<Char>
<Value>Y</Value>
<Rect>374,1072,386,1089</Rect>
</Char>
</Chars>
</Field>
...
<Line1>
<Value>P<USATRAVELER<<HAPPY<<<<<<<<<<<<<<<<<<<<<<<<</Value>
<Region>
<Rect>49,1072,797,1090</Rect>
</Region>
</Line1>
<Line2>
<Value>3400072370USA6707046F1608078910000193<113538</Value>
<Region>
<Rect>48,1114,798,1134</Rect>
</Region>
</Line2>
<Checksum>
<Value>8</Value>
<Verified>true</Verified>
</Checksum>
</MRZData>

3-line MRZ

You can find 3-line MRZ in a US passport card.

Extracting 3-line MRZ output
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MRZData>
<Field Type="IssuingCountry">
<Value>USA</Value>
<Region>
<Rect>107,427,187,457</Rect>
</Region>
<Chars>
<Char>
<Value>U</Value>
<Rect>107,428,128,457</Rect>
</Char>
<Char>
<Value>S</Value>
<Rect>138,427,156,457</Rect>
</Char>
<Char>
<Value>A</Value>
<Rect>167,428,187,457</Rect>
</Char>
</Chars>
</Field>
<Field Type="DocumentNumber">
<Value>C03004964</Value>
<Checksum>
<Value>6</Value>
<Verified>true</Verified>
</Checksum>
<Region>
<Rect>199,425,458,456</Rect>
</Region>
<Chars>
<Char>
<Value>C</Value>
<Rect>199,427,216,456</Rect>
</Char>
<Char>
<Value>0</Value>
<Rect>227,426,248,456</Rect>
</Char>
<Char>
<Value>3</Value>
<Rect>257,426,276,456</Rect>
</Char>
<Char>
<Value>0</Value>
<Rect>287,425,308,456</Rect>
</Char>
<Char>
<Value>0</Value>
<Rect>317,425,338,456</Rect>
</Char>
<Char>
<Value>4</Value>
<Rect>348,426,368,456</Rect>
</Char>
<Char>
<Value>9</Value>
<Rect>377,425,397,456</Rect>
</Char>
<Char>
<Value>6</Value>
<Rect>407,426,427,456</Rect>
</Char>
<Char>
<Value>4</Value>
<Rect>438,426,458,456</Rect>
</Char>
</Chars>
</Field>
...
<Line1>
<Value>IPUSAC030049646<<10<30<B22<498</Value>
<Region>
<Rect>49,422,941,457</Rect>
</Region>
</Line1>
<Line2>
<Value>8101017M1911297USA<<0754052296</Value>
<Region>
<Rect>46,472,940,507</Rect>
</Region>
</Line2>
<Line3>
<Value>TRAVELER<<HAPPY<<<<<<<<<<<<<<<</Value>
<Region>
<Rect>47,524,940,557</Rect>
</Region>
</Line3>
<Checksum>
<Value>6</Value>
<Verified>false</Verified>
</Checksum>
</MRZData>
troubleshooting

For troubleshooting tips, refer to the following support guides: