1. gibin.in
  2. Free tools
  3. MRZ parser
Free tool · ICAO 9303

Read and check a passport MRZ

The two lines of letters and <<< at the bottom of a passport photo page hold the holder's details and a set of check digits. Paste them here to read every field and confirm the check digits add up, which catches typos and scanner misreads.

Use it when
  • Your OCR or scanning software read a passport and you want to know the read is right
  • You're typing passport details into a form and want to double-check them
  • You're building document checks and need known-good results to compare against
● Runs in your browserNothing uploadedFree, no sign-up
  1. Paste the MRZ lines
  2. Read the decoded fields
  3. Confirm the checks pass
Check digit calculator

How to use it

  1. Copy the MRZ, the block of capital letters and < signs at the bottom of the photo page, from your OCR output or type it in.
  2. Paste it in. Line breaks can be missing; a single 88-character string is split into two passport lines on its own.
  3. Read the verdict, then the decoded fields. Red check digits are the ones that don't add up.

How the check digits work

ICAO 9303 protects the document number, date of birth, date of expiry and, on passports, the personal number with one check digit each. A final composite digit covers most of the second line. The arithmetic is the same everywhere: digits keep their value, A to Z count as 10 to 35, the filler < counts as 0, each character is multiplied by 7, 3, 1, 7, 3, 1 and so on, and the check digit is the total modulo 10.

For the ICAO specimen document number L898902C3: L is 21, so 21×7 + 8×3 + 9×1 + 8×7 + 9×3 + 0×1 + 2×7 + 12×3 + 3×1 = 316, and 316 mod 10 is 6. That 6 is the character right after the number. Try it in the calculator under the tool.

What it catches

  • OCR misreads. When a check fails and swapping one look-alike character (O/0, I/1, B/8, S/5, Z/2, G/6) would fix it, the tool suggests the corrected value.
  • Wrong line lengths. A missing filler at the end of a line is the most common copy-paste error. You're told which line is short and by how much.
  • Impossible dates. A 31st of February, or a month 13, fails even if the check digit happens to match.
  • Unknown country codes. Issuing state and nationality are checked against ICAO codes, including the special ones like XXA for stateless persons and GBN for British National (Overseas).

Where this comes from. At work I built a pipeline that finds the MRZ on a scanned passport, reads it with OCR and runs exactly these checks before anything goes further. A failed check digit is the cheapest way to catch a bad read. It's in the "also built" section of my projects page.

Questions

Is the passport data sent anywhere?

No. The MRZ is decoded by JavaScript running in your browser and never leaves your device. There's no server behind this page to send it to. Still, use specimen or test data where you can, as you would with any tool.

What does a passing check digit prove?

That the characters were read or typed correctly. The check digits are simple arithmetic (weights 7, 3, 1, modulo 10) that anyone can compute, so a passing MRZ says nothing about whether the document is genuine. Verification needs the chip and the issuing country's certificates.

Which documents does it support?

Passports (TD3, two lines of 44), ID cards (TD1, three lines of 30, and TD2, two lines of 36) and machine-readable visas (MRV-A and MRV-B). The format is picked from the line count and length.

Why does it say a check failed when I typed it right?

Usually because OCR, or a person, swapped a look-alike character: O and 0, I and 1, B and 8, S and 5. When one swap would make a failed check pass, the tool says which. The other common cause is a missing "<" at the end of a line, which changes the line length.

How is the year worked out from a 2-digit date?

Birth years that would be in the future go to the 1900s, so 74 is 1974 and 05 is 2005. Expiry years go to the 2000s. That's the usual convention, and for very old or very young holders it can be ambiguous, which is a limit of the MRZ format itself.