Generate a test MRZ

Build a machine readable zone with correct check digits for testing OCR, document readers and identity verification flows. Names are converted using ICAO transliteration rules.

P for passports, ID or I for ID cards, V for visas
Three-letter ICAO code, for example LVA, DEU, GBR
On TD3 usually the personal number

    

Check this MRZ

For software testing only. Generated MRZs are not identity documents.

Check a visa MRZ with the visa checker →

How names are converted

ICAO Doc 9303 Part 3 allows only A–Z in names. Diacritics are removed (Ā becomes A, Š becomes S, Ņ becomes N), Ä, Ö and Ü become AE, OE and UE, ß becomes SS, spaces and hyphens become <, and apostrophes are dropped. A name that does not fit the line is cut at the last position.

Which format to pick

Passports use TD3. Credit-card-sized ID cards and residence permits use TD1, which is also the only format that fits a document number longer than nine characters. TD2 is mostly found on older ID cards.

Annotated examples

The three ICAO specimen documents of the fictional state of Utopia, field by field. Line and position numbers start at 1.

TD3: passport, 2 lines of 44

P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
L898902C36UTO7408122F1204159ZE184226B<<<<<10
LinePositionsFieldValue
11–2Document codeP<
13–5Issuing stateUTO
16–44NameERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
21–9Document numberL898902C3
210Number check digit6
211–13NationalityUTO
214–19Date of birth740812
220Birth date check digit2
221SexF
222–27Date of expiry120415
228Expiry check digit9
229–42Optional dataZE184226B<<<<<
243Optional data check digit1
244Composite check digit0

TD2: 2 lines of 36

I<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<
D231458907UTO7408122F1204159<<<<<<<6
LinePositionsFieldValue
11–2Document codeI<
13–5Issuing stateUTO
16–36NameERIKSSON<<ANNA<MARIA<<<<<<<<<<<
21–9Document numberD23145890
210Number check digit7
211–13NationalityUTO
214–19Date of birth740812
220Birth date check digit2
221SexF
222–27Date of expiry120415
228Expiry check digit9
229–35Optional data<<<<<<<
236Composite check digit6

TD1: ID card, 3 lines of 30

I<UTOD231458907<<<<<<<<<<<<<<<
7408122F1204159UTO<<<<<<<<<<<6
ERIKSSON<<ANNA<MARIA<<<<<<<<<<
LinePositionsFieldValue
11–2Document codeI<
13–5Issuing stateUTO
16–14Document numberD23145890
115Number check digit7
116–30Optional data<<<<<<<<<<<<<<<
21–6Date of birth740812
27Birth date check digit2
28SexF
29–14Date of expiry120415
215Expiry check digit9
216–18NationalityUTO
219–29Optional data (line 2)<<<<<<<<<<<
230Composite check digit6
31–30NameERIKSSON<<ANNA<MARIA<<<<<<<<<<

What test MRZs are used for

Generated MRZs let you test without real identity documents. OCR and MRZ-parsing teams use them to cover every format, long names, missing optional data and edge cases such as document numbers longer than nine characters. KYC and onboarding teams use them in sandbox environments, where real passport data must not appear. Document reader and kiosk vendors use them in QA to check that a reader parses each field correctly and rejects a wrong check digit. Personalisation teams use them to prepare test specimens and compare the printed MRZ with the expected value.

Questions

Are generated MRZs valid documents?
No. They follow the format and check digit rules of ICAO Doc 9303, but they belong to no real document and must only be used for testing.
Which country code should I use for test data?
UTO, the code of the fictional state of Utopia used in all ICAO specimens. It cannot be confused with a real document. Use a real country code only when the system under test needs one.
Why was the name shortened?
The name field has a fixed length: 39 characters on a TD3 passport, 31 on TD2 and 30 on TD1. The generator cuts a longer name at the last position. ICAO Doc 9303 Part 3 describes more detailed truncation rules that issuing states may apply.
Can a document number be longer than nine characters?
Only on TD1 cards. The first nine characters go into the number field, position 15 holds <, and the rest of the number continues in the optional data, followed by its own check digit. TD2, TD3 and visas allow nine characters at most.