Skip to main content
Q&A Guide

How Do I Extract Text from Passports?

How do I extract text from passports? Learn about ICAO standards, MRZ reading, passport OCR accuracy, and how to digitize passport information.

Drop your file here

PNG, JPG, PDF

Direct Answer
To extract text from passports, photograph the data page and upload it to FastOCR at fastocr.org/image-to-text. FastOCR recognizes the passport holder's name, nationality, date of birth, passport number, and expiry date with 95-98% accuracy on clear passport photos. The Machine Readable Zone (MRZ) at the bottom of the data page contains encoded information that can be cross-verified against the visual text.

Passport Structure and OCR

Modern passports follow ICAO Document 9303 standards, which define the layout and data fields for machine-readable travel documents.

The Data Page Every passport has a data page containing: - **Personal details:** Full name, nationality, date of birth, sex - **Document details:** Passport number, issue date, expiry date, issuing authority - **Photograph:** Biometric photo of the holder - **Machine Readable Zone (MRZ):** Two or three lines of encoded text at the bottom

The Machine Readable Zone (MRZ) The MRZ is a standardized text block at the bottom of the data page. It uses a fixed-width font (OCR-B) and follows a strict format:

For a passport (Type P), the MRZ has two lines of 44 characters each: - Line 1: Document type, country code, name, passport number, checksums - Line 2: Passport number, nationality, birth date, sex, expiry date, checksums

The MRZ is designed specifically for OCR reading, so it achieves much higher accuracy than the visual text fields above it.

Accuracy by Passport Type

| Passport Element | Visual Text OCR | MRZ OCR | |---|---|---| | Name | 95-98% | 98-99.5% | | Passport number | 96-99% | 99%+ | | Nationality | 95-98% | 99%+ | | Date of birth | 97-99% | 99%+ | | Expiry date | 97-99% | 99%+ | | Issue date | 95-98% | N/A | | Place of birth | 93-97% | N/A |

Tips for Passport OCR

1. **Photograph the data page flat** — open the passport fully and press it against a flat surface 2. **Avoid glare on the laminate** — the data page has a protective laminate that reflects light. Use indirect lighting or slightly angle the light source. 3. **Capture the entire page** — include all four corners so the engine can detect the MRZ boundaries 4. **Use even lighting** — avoid shadows from the passport cover or your hands 5. **300 DPI minimum** — passport fonts are small and need adequate resolution 6. **Select the correct language** — passports use the issuing country's language plus English/French

Security and Privacy Considerations

Passport data is highly sensitive personal information. When using OCR on passports:

  • **Process locally when possible** — FastOCR does not store uploaded documents permanently
  • **Delete extracted data** after use — don't keep passport text on shared devices
  • **Use for legitimate purposes only** — passport OCR should be used for personal record-keeping, visa applications, or hotel check-ins — not for identity fraud
  • **Verify extracted data** — always cross-check OCR output against the original passport for critical applications

Frequently Asked Questions

Can FastOCR read the MRZ code on passports?

Yes. FastOCR extracts the Machine Readable Zone text at the bottom of passport data pages. The MRZ uses a standardized OCR-friendly font that achieves 98-99% accuracy.

How accurate is passport OCR?

Visual text on passports achieves 95-98% accuracy. The MRZ achieves 98-99.5% accuracy due to its standardized OCR-B font and fixed layout. Always verify extracted data against the original.

Can FastOCR read expired passports?

Yes. FastOCR extracts text from any passport regardless of expiry status. The MRZ remains readable as long as the physical page is in good condition.

Is it safe to upload passport images to FastOCR?

FastOCR processes documents without persistent external storage. Images are processed and returned without being stored on external servers. Always exercise caution with sensitive personal documents.