How the check digit works
The 7-3-1 weighted sum modulo 10 that guards every MRZ number and date.
Each character in the MRZ has a value: 0-9 keep their value, A is 10, B is 11, up to Z is 35, and the filler '<' is 0. The check digit is the last digit of a weighted sum.
The weights repeat 7, 3, 1 over the characters, multiply each character value, then the total is taken modulo 10.
check = (7·v1 + 3·v2 + 1·v3 + 7·v4 + 3·v5 + …) mod 10
Worked example
Document number L898902C3 (nine characters, no filler):
| Char | Value | Weight | Product |
|---|---|---|---|
| L | 21 | 7 | 147 |
| 8 | 8 | 3 | 24 |
| 9 | 9 | 1 | 9 |
| 8 | 8 | 7 | 56 |
| 9 | 9 | 3 | 27 |
| 0 | 0 | 1 | 0 |
| 2 | 2 | 7 | 14 |
| C | 12 | 3 | 36 |
| 3 | 3 | 1 | 3 |
The sum is 316. 316 mod 10 = 6, so the check digit is 6.
What it does and does not catch
- It detects every single-digit typing error.
- It detects most swaps of two adjacent characters, but not all (a swap of two identical values, or a repeat separated by an odd gap, can cancel out).
- It does not detect a change between two letters whose values differ by a multiple of 10 at a fixed position (for example G and Q at weight 7).
A composite check digit covers several fields joined together, so a single error in any of them is caught even when the element check digits are individually consistent.
Source: Doc 9303 Part 3 — Specifications Common to all MRTDs — reference/9303-standands/Doc 9303 - Part 3 - Machine Readable Travel Documents (1).html
Source: Doc 9303 Part 11 — worked examples and check-digit uses — reference/9303-standands/Doc 9303 - Part 11 - Machine Readable Travel Documents.html