MRZ Generator

Build machine-readable zones for passports, ID cards and visas that follow ICAO Doc 9303, with every check digit calculated for you. Useful for testing OCR, scanners and document-reading software.

  • ICAO Doc 9303 check digits
  • Passports, ID cards and visas
  • Runs in your browser, nothing is stored
Choose a document format
Document
P passport, I, A or C ID card, V visa
The country or organisation that issued the document
Holder
Dates and extra data
Optional. Leave empty to fill with <

Your MRZ

Generated data is fictional and intended for software testing and education only. It is not a valid travel or identity document.

Three steps to a valid MRZ

  1. Pick the document

    Choose a passport, one of the two ID card sizes or a visa. The line count and length follow the format.

  2. Enter details or randomise

    Type the holder’s data, or press Generate random for a complete fictional sample in one click.

  3. Copy or download

    The MRZ updates as you type, with check digits highlighted. Copy it or save it as a text file.

How a check digit is calculated

Every character gets a value: digits keep their own, A to Z count as 10 to 35 and the filler < counts as 0. Multiply the values by the repeating weights 7, 3, 1, add the results and keep the last digit.

TD1, TD2 and TD3 add a composite digit that protects the document number, both dates and the optional data together. Visas have no composite digit.

Worked example for document number L898902C3
Character L 8 9 8 9 0 2 C 3
Value 21 8 9 8 9 0 2 12 3
Weight 7 3 1 7 3 1 7 3 1
Product 147 24 9 56 27 0 14 36 3
Sum 316, so the check digit is 6.

Questions

Short answers about the machine-readable zone and this generator.

What is an MRZ?

The machine-readable zone is the block of text at the bottom of a passport, ID card or visa. Scanners read it with OCR to capture the holder’s details quickly and verify them with check digits.

How are names with accents or hyphens written?

Letters are transliterated to A to Z (ß becomes SS, é becomes E). Spaces and hyphens become a single <, apostrophes are dropped, and << separates the surname from the given names.

What about document numbers longer than nine characters?

On TD1 and TD2 the first nine characters go in the number field, the check digit position gets a <, and the rest continues in the optional data followed by its check digit. The other formats hold nine characters.

Is my data sent anywhere?

No. The MRZ is built in your browser and nothing you type reaches the server.

Can I use the output as a real document?

Generated data is fictional and intended for software testing and education only. It is not a valid travel or identity document.

[mrzgen_tool]

From the blog