Oct
Meet NIST 0.1 DFAR/DFRR with MRZ Verification for Compliance Teams
MRZ verification confirms that the machine-readable zone on a passport, visa or ID card is correctly formatted, internally consistent, and mathematically valid through its check digits. It catches OCR errors, obvious tampering and data inconsistencies, but it does not prove a document is authentic on its own. For high-value or regulated flows, we recommend pairing MRZ checks with NFC chip reads, liveness detection or issuer verification.
TL;DR:
- Reject malformed input before checksum calculations: TD3 lines require 44 characters, TD1 lines require 36, and MRZs allow only letters, digits, and filler characters.
- Calculate individual and composite check digits using repeating seven, three, one weights, and test valid samples alongside deliberately corrupted MRZs.
- Localize and crop the MRZ band before OCR, then retry checksum failures with common character swaps and revalidate the full checksum before manual review.
- NIST sets document authentication and false rejection targets at 0.1 or below; compare MRZ fields with the printed visual inspection zone and log decisions.
- When privacy matters, choose browser scanning that keeps document images on the device, and compare field diagnostics, confidence scores, and licensing.
Table of Contents
- Core MRZ checks: formats, fields, and structural validation
- How the MRZ checksum algorithm actually works
- OCR extraction and error handling for MRZ data
- Practical MRZ tools and libraries to evaluate quickly
- How MRZ checks map to NIST SP 800-63A requirements
- Implementation checklist: capture, parse, validate, escalate
- Expert perspective: why MRZ checks alone fall short
- Our take on where MRZ verification advice goes wrong
- Publisher resources and next steps
- FAQ
- Sources
Core MRZ checks: formats, fields, and structural validation
The MRZ format specifications laid out in ICAO Doc 9303 define three main document layouts: TD1 (three lines, used on many national ID cards), TD2 (two lines, used on some ID cards and older visas), and TD3 (two lines, the standard passport format). Visa documents use their own MRV-A and MRV-B layouts, which share TD1/TD2 logic but shift field positions slightly.

Each format specifies exact character counts per line, fixed field positions for document number, date of birth, expiration date, nationality and sex, and the use of the filler character “<” to pad unused space or replace missing values. Several fields carry individual check digits (document number, date of birth, expiration date), and a final composite check digit validates a combination of fields together.
Before running checksum logic, a parser should gate on structure:
- Confirm line length matches the expected format (44 characters for TD3, 36 for TD1 lines).
- Reject lines containing characters outside the ICAO-permitted set (letters, digits, and “<”).
- Verify filler characters appear only where the specification allows padding, not inside a numeric check-digit position.
A document failing these structural gates should exit early, before checksum computation wastes cycles on malformed input.
How the MRZ checksum algorithm actually works
The ICAO checksum algorithm applies a repeating 7-3-1 weight pattern across each character in a field, computes a weighted sum, then takes that sum modulo 10 to produce the expected check digit.
- Map each character to a numeric value: digits keep their value, letters map A through Z to 10 through 35, and “<” maps to 0.
- Multiply each character’s value by its position weight, cycling 7, 3, 1, 7, 3, 1 across the field.
- Sum the weighted values and take the result modulo 10 to get the expected check digit.
- Compare that digit against the one printed in the MRZ; a mismatch flags the field for review.
Common mismatches trace back to a few repeat offenders: OCR confusing “0” and “O” or “1” and “I”, filler characters miscounted at field boundaries, or composite checksums computed over the wrong field range. We recommend building a small suite of unit tests using known-good sample MRZs (several are published alongside MRZcode’s validator) alongside deliberately corrupted variants to confirm your implementation rejects bad input the same way it accepts good input.
OCR extraction and error handling for MRZ data
Generic OCR engines struggle with the OCR-B font and tight character spacing used in the MRZ band. A detection-then-crop pipeline that isolates the MRZ region before running MRZ-specific OCR produces materially cleaner extraction than feeding a full document image into a general-purpose text recognizer.
- Run a dedicated MRZ localization step first, then OCR only the cropped band.
- Apply OCR-confusion substitution: when a field fails checksum, try the predictable swaps (0/O, 1/I, 5/S, 8/B) and recheck the checksum before flagging the document for manual review.
- Surface per-field confidence scores so low-confidence fields get flagged independently rather than failing the whole document.
- Give capture guidance on resolution and lighting upfront; a blurry or glare-heavy capture is the most common root cause of OCR failure.
Pro Tip: Build the confusion-substitution retry as a loop that revalidates the full checksum after each candidate swap, not just a one-shot guess; this catches multi-character OCR errors that a single substitution misses.
Practical MRZ tools and libraries to evaluate quickly
A handful of open-source and hosted tools cover most of the MRZ pipeline without building from scratch.
- OmniMRZ is an open-source Python library offering MRZ extraction, strict ICAO-9303 structural enforcement, checksum validation and logical plausibility checks, with structured JSON output suited to KYC pipelines.
- mrz-scanner projects, including alsenet-labs’ browser and Node.js implementation, run onnx-powered OCR client-side, so document images never leave the user’s device, which matters for privacy-sensitive deployments.
- MRZcode offers a free web-based validator for pasting raw MRZ lines and getting immediate check-digit recalculation with diagnostic output, useful for debugging extraction results during development.
- DAON operates as a multi-layer identity verification provider worth evaluating once a team needs to move beyond MRZ-only checks toward biometric and document-authenticity layers together.
When comparing options, weigh field-level diagnostics, confidence scoring granularity, licensing terms, and whether the tool’s processing model keeps document data client-side or requires server upload.
How MRZ checks map to NIST SP 800-63A requirements
NIST SP 800-63A requires automated identity evidence validation to compare MRZ or barcode data against the printed visual inspection zone, and it sets explicit performance targets: a document authentication rejection rate (DFAR) and false reject rate (DFRR) that validation systems should measure and hold at or below 0.1.
- Treat MRZ-to-VIZ comparison as a mandatory step, not an optional cross-check; a mismatch between the two zones is one of the clearest tamper signals available.
- Reserve MRZ-plus-VIZ comparison for lower-risk flows; move to NFC chip reads or cryptographic verification when the use case demands higher assurance.
- Log every validation decision, including which checks passed or failed and any manual override, to support audit trail requirements.
DFAR and DFRR thresholds of 0.1 or below, as NIST’s performance guidance states, give compliance teams a concrete target to measure against rather than a vague “low error rate” standard.
Implementation checklist: capture, parse, validate, escalate
A reliable MRZ pipeline follows a consistent sequence rather than ad hoc scripting.
- Capture: enforce minimum resolution and flag glare or motion blur before OCR runs.
- Parse: localize the MRZ band, run format-specific OCR, and reject lines failing structural gates immediately.
- Validate: compute individual and composite checksums, then compare MRZ fields against the VIZ.
- Escalate: route low-confidence or mismatched fields to a retry loop first, then to manual review if retries fail.
Pro Tip: Keep a rotating sample set of known-good and known-bad MRZs in your test suite so accuracy metrics and DFAR/DFRR reporting stay meaningful as OCR models or libraries change.
Expert perspective: why MRZ checks alone fall short
MRZ-only verification is weakening against motivated fraud as MRZ generator tools and scraped MRZ data pools circulate. A checksum that passes no longer guarantees a document was ever genuine; it only confirms internal consistency. We recommend combining MRZ validation with liveness detection and NFC or issuer checks for anything beyond low-risk onboarding, and documenting the decision rationale so auditors can see why a given risk tier got a given control stack.
Our take on where MRZ verification advice goes wrong

Most MRZ guidance treats checksum validation as the finish line. It is not. A forged document can carry a perfectly valid checksum because the algorithm only tests arithmetic consistency within the MRZ, never whether the underlying document or issuer is real.
The practical priority is composite checksum validation across multiple fields, since single-field recalculation misses the kind of coordinated tampering that experienced fraud teams see in scraped and synthetic document pools. After that, invest in retry logic before escalation, since a well-built OCR-confusion substitution loop resolves most legitimate failures without ever involving a human reviewer. Treat MRZ as the floor of a verification stack, never the ceiling, and build the escalation path before the volume forces you to.
— Carlos Ochoa
Publisher resources and next steps
We track the identity verification landscape so compliance and fraud teams do not have to piece it together from vendor documentation alone. For teams building or auditing an MRZ pipeline, two of our resources go further than this guide:
- Our Identity Verification Upgrade Checklist walks through an audit-ready rollout sequence for compliance teams.
- Our guide to why biometrics reduce bank fraud covers how biometric layers complement document checks like MRZ.

Teams planning a multi-month rollout can also review this KYC onboarding automation roadmap for sequencing automation work alongside document verification upgrades. If your organization builds identity verification technology and wants its approach covered, reach out about sponsored research placement on Fraud Signals News.
FAQ
What is MRZ verification?
MRZ verification checks the machine-readable zone on a passport, visa or ID card for correct formatting, valid check digits, and consistency with the printed visual inspection zone. It catches OCR errors and many tampering attempts, though it does not independently prove a document’s authenticity.
How can I generate an MRZ code?
An MRZ code is generated by formatting a holder’s data fields according to the ICAO Doc 9303 layout for the relevant document type, then computing check digits for each required field using the 7-3-1 modulo-10 algorithm. Libraries like OmniMRZ handle this encoding programmatically rather than requiring manual calculation.
How do I scan an MRZ on a passport?
Scanning an MRZ reliably requires isolating the MRZ band from the rest of the document image before running OCR-B-aware text recognition on it. Tools like mrz-scanner handle this client-side in a browser, while libraries such as OmniMRZ run the same extraction server-side for pipeline integration.
How can I verify if a passport is real?
MRZ checksum validation and MRZ-to-VIZ comparison catch many signs of tampering or data entry errors, but confirming a passport is genuinely authentic typically requires additional layers such as NFC chip reads, UV or security feature inspection, or issuer-side verification. For regulated or high-risk flows, NIST SP 800-63A treats MRZ checks as one component of a broader evidence validation process, not a standalone proof of authenticity.
Sources
- NIST Special Publication 800-63A – Enrollment and Identity Proofing Requirements
- ICAO Doc 9303, Machine Readable Travel Documents (MRZ) specifications
- OmniMRZ — Python MRZ Extraction & Validation Library
- Free MRZ Validator — MRZcode


