How to Extract Data from Passports?

A complete guide with all you need to know about capturing data from passports and ID cards with OCR & AI.

 min. read
May 28, 2024
How to Extract Data from Passports?

The passport: an everyday object of identification, a compact booklet hat holds a person's most crucial data. It is a cornerstone for any business in verifying a client's identity, acting as a bulwark against criminal activities such as fraud, corruption, or money laundering. Still, the traditional methods of capturing this critical information can feel more like a marathon than a sprint.

Within the world of customer onboarding, employees are often tasked with manually inputting information from digital copies of passports, ID cards, or driver's licenses, following the Know Your Customer (KYC) protocol. Picture slogging through thousands of documents a day - a daunting and labor-intensive endeavor, to say the least.

Historically, businesses have turned to Optical Character Recognition (OCR) engines, converting these image-based documents into machine-encoded text to expedite the process. But OCR is not without its limitations and pitfalls. As we delve into this blog post, we will explore passport data extraction, its challenges, benefits, and how automation of this process is paving the way to a more efficient future.

Passport data extraction is about taking critical information, such as the passport number, holder's name, and address, from a passport. However, this process is often complicated as computers, by their very nature, do not understand context, making it hard to organize the extracted information systematically.

So, how do developers and companies automate this process, including reading complex fields like Machine Readable Zones (MRZ)? What challenges need to be addressed during this process?

The answer lies in Intelligent Document Processing (IDP), an advanced solution that goes beyond simple Optical Character Recognition (OCR). IDP doesn't just convert image-based text into machine-readable text. It also interprets it, giving the text meaning and context.

The IDP process usually involves several stages. It starts with preprocessing, where unnecessary noise is removed from images to make them clearer. After that, the OCR phase extracts text from these images. The next phase is the interpretation of the text data.

This is where advanced technologies like Natural Language Processing (NLP) and Machine Learning (ML) come into play. NLP helps the system understand the semantics of the text, while ML allows the system to learn from past operations, thereby improving its future accuracy.

Take, for example, a passport's Machine Readable Zone, or MRZ. This is a two or three-line code at the bottom of the passport, full of characters and numbers that can be difficult for a human to read. However, an effective IDP solution can recognize and decode this MRZ, extracting key passport data such as the passport number, expiry date, and the holder's nationality.

Simply put, by leveraging technologies like OCR, NLP, and ML, IDP enables businesses to automate the extraction of data from passports, significantly reducing manual effort and improving efficiency.

A sample European passport with the machine readable zone code highlighted

The Machine Readable Zone, or MRZ, is a specific area on a passport that typically consists of two lines of characters located at the bottom of the passport page. It's a condensed powerhouse of information, holding the most critical data of the passport, such as the passport number, expiry date, and holder's nationality.

Historically, technologies have honed in on this section to extract passport details from scanned images, seeing it as a one-stop-shop for vital information. Yet, like any process involving data extraction, it isn't without its roadblocks. Scanning and extracting data from the MRZ presents a unique set of challenges. The quality of passport images can vary greatly, leading to potential inaccuracies in data extraction.

Additionally, occasional issues like mistaken photos can contribute to errors in the process. Even the smallest error in extracting passport data can have significant implications, potentially causing issues that could harm your business. As such, it's crucial to consider these potential pitfalls and ensure your data extraction process is as robust and accurate as possible.

While automation using OCR and IDP technologies can significantly streamline passport data extraction, the process isn't without its hurdles. Various factors can impact the performance and accuracy of OCR engines and, consequently, the overall data extraction process. Some of the key challenges are as follows:

Not every document that comes for processing is perfect. Sometimes, the passports or ID cards provided can be blurred or skewed. Whether it's because of a bad scan, improper handling, or a wear-and-tear issue, these imperfections can severely affect the clarity of data in the documents. OCR engines often struggle with such issues as they rely heavily on the quality of the input image. The lower the image quality, the harder it is for OCR to accurately recognize the characters, leading to a higher likelihood of errors in data extraction.

Another common challenge is dealing with low-fidelity or low-resolution images. This can happen when important paper documents like proof of address are scanned or photographed using devices with low-quality cameras. The resultant low-fidelity images may lack sharpness and detail, making it difficult for OCR engines to identify and extract data accurately.

For businesses, these challenges can lead to inaccurate passport data extraction, which may cause issues in customer verification processes, compliance with regulations, and other operational aspects. As such, it's essential to utilize an intelligent document processing solution that can handle such complexities and ensure accurate and efficient data extraction from passports and other ID cards. Such solutions should ideally leverage advanced machine learning techniques to adapt to these challenges and continuously improve their performance.

Passport identity documents around the world come in different formats and templates. For instance, the placement of key information, the language used, or the design elements can vary significantly from country to country. This diversity often poses a significant challenge for OCR engines as they need to identify and correctly extract information from a wide array of formats.

One way to address this issue is by incorporating AI models trained on diverse datasets, including passports and IDs from multiple countries. This allows the system to recognize a broader range of document templates and formats, ensuring a more accurate extraction of data.

Passport data extraction, particularly for complex fields like MRZ, has several use cases across various industries. These industries utilize Intelligent Document Processing solutions like FormX to streamline data capture and improve overall efficiency. Let's explore some of these applications:

Every financial institution, from banks to insurance companies, is obligated by regulatory organizations to conduct comprehensive Know Your Customer (KYC) procedures before onboarding their clients. This is a critical step to deter financial crimes such as money laundering. Central to an effective Know Your Customer program is the acquisition of personal information from the passports or ID cards of the clients.

With automation tools like OCR in finance & accounting, this process is vastly simplified. Clients can simply take a photo of their passports or ID cards, eliminating the need to manually input all their information. This not only enhances customer experience but also reduces operational costs linked to manual data entry.

The COVID-19 pandemic has huge economic impacts on the global economy. In early 2020, COVID-19 lockdowns and other precautionary measures taken drove the global economy into crisis. It has created a variety of challenges for everyone and therefore governments over the world have provided relief funds or grants to not only help local businesses and their citizens persevere but more importantly recover to pre-pandemic levels faster.

However, the entire process can take quite long if it is done manually since the applicants will have to enter their personal information and send scanned copies of passports or ID cards. Afterwards, the information will still have to be manually verified and saved to the database. To speed things up, the public sector automates data capture from passports or ID cards with OCR and other AI technologies so that applications can be processed much faster.

In the telecommunications industry, ensuring client identity verification is essential to prevent misuse of services. Telecom service providers typically request new customers to provide copies of their passports or ID cards to prevent fraudsters from registering devices or numbers under someone else's name.

Using OCR technology can make this process much more efficient, quickly extracting the necessary information from the scanned documents. This helps in faster customer onboarding while maintaining high-security standards.

Other industries, like healthcare, travel, and insurance, also heavily rely on identity verification and further client data analysis. Adopting OCR technology and intelligent document processing solutions enables these industries to efficiently and accurately extract this critical data from passport identification.

Aside from allowing our users to train their own extractors, FormX has also provided several pre-trained extractors for you to use right away. All you have to do is select the corresponding extractor, test it out with some sample images, and integrate with your software/application via API to easily establish an automated passport/ID cards processing workflow.

Step 1: Sign up at

You can create an account at

Step 2: Create an extractor

After creating an account, you can then create different types of extractors based on your needs. FormX provides a set of pre-built extractors and also allows you to train your own extractor by providing sample images and marking the areas where the desired information is located.

Step 3: Select “Government ID / Passport” as your extractor

We’ve pre-trained an extractor allowing our users to extract data from a variety of national IDs, driver’s licenses, and passports.

Step 4: Test your extractor

After selecting your extractor, upload a sample image to test it out. You’ll be able to see the result along with the JSON output.

Step 5: Obtain Form ID and Access Token

Copy the Form ID and Access Token from the “Extract” tab.

Step 7: Process the image with the API

The extractor can be integrated with other software using the RESTful API and enrich the automation workflow. Send the image to the API endpoint *“”* with the Form ID and Access Token. Then, in the API response, you will see the extracted information.

Example with cURL

Example with Python

Empower Your Business With Automated Data Extraction

Extracting data from passports, particularly from complex areas like the MRZ, can be challenging due to factors like blurred images or poor-quality scans. However, this process is crucial for many industries, including finance, public sector, and telecommunications, for identity verification and regulatory compliance.

FormX uses AI and OCR technologies to simplify this process. We automate data extraction, making it more accurate and efficient, reducing costs, and enhancing customer experience.

As the world becomes increasingly digital, the demand for such efficient data extraction methods will only grow. Harnessing the power of intelligent document processing will be essential for industries to keep up, ensuring faster, more accurate data handling, and better service delivery overall.

Sign up for a free account or contact us to see how FormX can help you intelligently digitize your passports and ID cards.