MRZ generator

Build a valid passport machine-readable zone (ICAO 9303 TD3) with correct check digits. Use it to create test fixtures – the output is synthetic and must never carry real personal data.

Checking a zone you already have? Paste it into the MRZ parser and check digit calculator.

Generated MRZ

P<GRCPARADEIGMA<<ELENI<SOFIA<<<<<<<<<<<<<<<<
AM73045184GRC9403084F3203101PN48291630<<<<72

Verify it with the MRZ parser.

What a machine-readable zone is

A machine-readable zone is the block of fixed-width lines at the foot of a passport or identity card, standardised by ICAO Doc 9303. It encodes the document number, issuing state, name, nationality, date of birth, sex and expiry date, each at a fixed offset, with check digits that verify the reading.

How the check digits above are calculated

  1. Take the field the digit protects – the document number, the date of birth, the date of expiry, the personal number, or the whole composite range.
  2. Give every character its value: a digit counts as itself, a letter as its position in the alphabet plus nine (A = 10, Z = 35), and the filler < as zero.
  3. Multiply each value by its position weight. The weights repeat 7, 3, 1 across the field, starting at 7 on the first character.
  4. Add the products together.
  5. The check digit is that sum modulo 10 – the last digit of the total.

Worked through on the specimen's passport number AM7304518 – an invented document belonging to nobody:

The 7-3-1 weighting worked through, character by character, on a specimen document number
CharacterValueWeightProduct
A10770
M22366
7717
33721
0030
4414
55735
1133
8818
Sum, then modulo 10214 → 4

Enter AM7304518 as the document number above and the digit after it in the generated zone is 4 – the same arithmetic, run by the same code.

The composite digit

One more digit covers most of the zone at once: the composite. It is computed the same way, over a range that skips the fields no digit protects – and in TD1 that range spans two lines, which is where a hand-written parser usually goes wrong. A zone whose field digits all pass and whose composite fails has been transcribed correctly in pieces and assembled wrongly.

What the digits do not cover

No check digit covers the name, and none covers the issuing state. A misread in either is silent: the arithmetic still balances. That is why reading the printed side of the document as well, and comparing the two readings, catches what the digits cannot.

Questions people ask

What is an MRZ?

A machine-readable zone is the block of fixed-width lines at the foot of a passport or identity card, standardised by ICAO Doc 9303. It encodes the document number, issuing state, name, nationality, date of birth, sex and expiry date, each at a fixed offset, with check digits that verify the reading.

Which formats does this tool support?

This generator builds TD3 – the two lines of 44 characters a passport carries – with every check digit computed from the values you enter, including the composite. The format explainer sets out TD1 and TD2 as well, with a worked example of each.

Do you store any of my data?

No. The zone is built by code running in your own browser and never leaves the page: nothing is uploaded and no request carrying your values is made. This page is a static file, and the only request it makes after it loads is to ask whether there is a service notice to show at the top. Use invented values anyway – a generated zone is for test fixtures, and real personal data does not belong in one.

Where to go next

  • MRZ parser – paste a zone and watch every check digit recomputed.
  • TD1, TD2 and TD3 – the three layouts, their line and character counts, and where the standard defines each.
  • Passport OCR API – the printed side as well as the encoded one, read from a photo in one request.
  • Free passport OCR API – the first calls with no account, as a single curl command.
  • Passport OCR by country – the issuing states this API reads, each with a specimen zone of its own.