MRZ Calculator
All posts
Check digitsValidation

How MRZ Check Digits Work (with a worked example)

The 7-3-1 weighting rule explained step by step, including how the composite check digit catches errors single fields miss.

5 min read
Abstract illustration of MRZ check digit weights 7-3-1

Every critical field in the MRZ ends with a one-digit checksum. The rule is identical everywhere — once you know it, you can verify any MRZ by hand.

The algorithm

  • Map each character to a number: 0–9 stay as themselves, A=10 … Z=35, and the filler "<" equals 0.
  • Multiply position by position using the repeating weights 7, 3, 1.
  • Sum the products and take mod 10. The remainder is the check digit.

Worked example — date of birth 520727

Input:    5  2  0  7  2  7
Weights:  7  3  1  7  3  1
Products: 35 6  0  49 6  7   →  sum = 103
103 mod 10 = 3                →  check digit = 3

The composite check

For TD1, TD2 and TD3 documents there's a final composite check digit. It's computed over the document number, date of birth, expiry date and optional data segments concatenated together. This catches cases where individual fields look valid but the overall block has been tampered with or mis-paired.

Try it yourself

Validate, generate, and convert MRZ lines with the in-app tools.

Keep reading

All posts