DevTools Logo

MRZ Generator & Validator

MRZ Generator & Validator

Generate ICAO 9303 machine readable zones for passports (TD3) and ID cards (TD1, TD2) with correct check digits, or validate a pasted MRZ — synthetic test data only

Runs in your browser
Try an example

Document data

TD3 passport (2 × 44)

Leave any field empty to get a random value.

UTO is the ICAO specimen state Utopia.

Generated MRZ

No MRZ yet

Pick a format and press Generate.

    Examples

    ICAO TD3 passport specimen

    Input
    Format: TD3 passport (2 × 44)
    Output
    P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
    L898902C36UTO7408122F1204159ZE184226B<<<<<10

    The ICAO specimen for Anna Maria Eriksson of Utopia: document number check 6, birth date check 2, expiry check 9, personal number check 1 and composite 0 all match.

    ICAO TD1 ID card specimen

    Input
    Format: TD1 ID card (3 × 30)
    Output
    I<UTOD231458907<<<<<<<<<<<<<<<
    7408122F1204159UTO<<<<<<<<<<<6
    ERIKSSON<<ANNA<MARIA<<<<<<<<<<

    The three-line specimen: the document number ends in check digit 7, the two date checks are 2 and 9, and line 2 closes with composite 6.

    Wrong document check digit

    Input
    P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<
    L898902C37UTO7408122F1204159ZE184226B<<<<<10
    Output
    Invalid — Document number: check digit is 7 but the field requires 6

    Changing the check digit to 7 while leaving the document number alone fails both the document number check and the composite check.

    About this tool

    The MRZ Generator builds one ICAO Doc 9303 machine readable zone at a time. Choose TD3 for a passport (two lines of 44 characters), TD2 for an ID card or older document (two lines of 36) or TD1 for an ID card (three lines of 30). Any field you leave empty is filled with a random value, and the issuing state defaults to UTO, the ICAO specimen state Utopia, which does not exist.

    Every check digit follows the Doc 9303 rule: the weights 7, 3 and 1 repeat across the field, digits keep their value, letters A–Z count as 10 to 35, the filler < counts as 0, and the weighted sum is taken modulo 10. TD3 line 2 carries the document number with its check digit, nationality, birth date with its check, sex, expiry with its check, the 14-character personal number with its check (it may be all filler), and a composite check computed over the document number, birth date, expiry and personal number fields together with their check digits. TD2 uses the same pattern at 36 characters with 7 characters of optional data, and TD1 puts the document number and 15 characters of optional data on line 1, the birth date and expiry with their check digits, sex, nationality, 11 characters of optional data and the composite check on line 2, and the name on line 3.

    Names are transliterated before they reach the zone: Ä becomes AE, Ö becomes OE, Ü becomes UE, ß becomes SS, Ø becomes OE, Å becomes AA, accents are dropped, apostrophes are dropped, and hyphens or spaces become the filler, so Anna María Eriksson is written as ERIKSSON<<ANNA<MARIA. The validator accepts 2 or 3 pasted lines and detects TD1, TD2 and TD3 plus the machine readable visa layouts MRV-A (2 × 44) and MRV-B (2 × 36), which carry no composite check digit. It checks the character set, the line shape, real YYMMDD dates, the sex value and every check digit, then lists the parsed fields. Generated zones are synthetic test data, not documents: the tool does not verify a real document or query any database, never use the output for travel, KYC, impersonation or real verification, and DevTools accepts no liability for how it is used. Everything runs locally in your browser.

    What this tool does not do

    • Names are cut hard at the field width; ICAO's truncation rules are more detailed and are not applied here.
    • Document numbers longer than 9 characters, which ICAO overflows into the optional field, are neither generated that way nor specially parsed, and a YYMMDD date carries no century, so the year is ambiguous.
    • There is no chip (eMRTD) data, no visual zone and no image of a document.
    • The tool does not verify a real document or query any database, so a passing check says nothing about issuance.

    How to use this tool

    1. Pick a format and fill in what you need

      Choose TD3, TD2 or TD1 and enter any of the issuing state, nationality, surname, given names, document number, sex and dates. Empty fields become random values; the issuing state defaults to UTO, the ICAO specimen state Utopia, which does not exist.

    2. Generate one MRZ

      Press Generate to build a single zone in the selected layout, with every check digit computed by the Doc 9303 rule. The result panel lists each check so you can see that the output is self-consistent.

    3. Copy, download or validate

      Copy the zone or save it as a .txt file, or switch to Validator and paste 2 or 3 lines to detect a TD1, TD2, TD3, MRV-A or MRV-B zone and see which check failed.

    Use cases

    Parser baselines

    Feed a scanner or MRZ parser implementation the ICAO specimens so it has a known-good zone whose check digits you can verify by hand.

    Rejection-path tests

    Use the broken specimen with document check digit 7 to confirm that your validator names the failing field instead of accepting the zone.

    Onboarding and form demos

    Fill passport or ID card fields in staging with a correctly shaped zone that carries no real traveler data.

    ICAO 9303 layouts the tool produces

    LayoutShape
    TD3 passport2 × 44
    TD2 ID card2 × 36
    TD1 ID card3 × 30

    Every check digit uses weights 7, 3, 1 repeating, with A–Z counted as 10–35, filler < as 0, and the sum taken modulo 10.

    Common mistakes

    Mistake:Hand-editing one character of a generated zone

    Fix:Every checked field has its own digit, and the composite covers all of them; regenerate instead of patching a character.

    Mistake:Treating the TD3 personal number as required

    Fix:The personal number and the optional data fields may be all filler, in which case the personal number check digit may be < instead of 0.

    Mistake:Assuming a valid zone proves a document

    Fix:The checks confirm internal consistency only; the tool does not verify a real document or query any database.

    Frequently asked questions

    Are these real MRZs, and can I use them?

    No. Every zone is synthetic test data for QA and development. The default issuing state is UTO, the ICAO specimen state Utopia, which does not exist, but a random value can still coincide with a real document. Never use the output for travel, KYC, impersonation or real verification, and DevTools accepts no liability for how it is used.

    How is an MRZ check digit calculated?

    Weights 7, 3 and 1 repeat across the field; digits keep their value, letters A–Z count as 10 to 35, and the filler < counts as 0. The weighted sum is taken modulo 10. The same rule produces the document number, birth date, expiry, TD3 personal number and composite check digits.

    Which formats does the validator recognize?

    TD1 (3 × 30), TD2 (2 × 36) and TD3 (2 × 44), plus the machine readable visas MRV-A (2 × 44) and MRV-B (2 × 36). Visas have no composite check digit, so only the document number and date checks run for them. Anything that is not one of those shapes is rejected with the line lengths it found.

    Why is a long surname cut off in the zone?

    The name field is filled to a fixed width — 39 characters on TD3 line 1 and 30 on TD1 line 3 — and the tool applies a hard cut. ICAO's truncation rules are more detailed, so treat the cut as a limitation of this generator rather than a reference implementation.

    Does a zone that passes every check prove a passport or ID card exists?

    No. The checks confirm internal consistency: characters, shape, real YYMMDD dates, sex and check digits. The tool reads no chip (eMRTD) data, no visual zone and no image, does not query any database, and a YYMMDD date does not say which century it belongs to.

    References & standards