---
title: "Discussion on \"How passport MRZ check digits work (with a validator in Python and JavaScript)\" | Hashnode"
description: "Discussion on \"How passport MRZ check digits work (with a validator in Python and JavaScript)\". The 7-3-1 algorithm behind every passport and ID card MRZ, where each check digit sits in TD1, TD2 and TD3, and a validator you can paste."
url: "https://hashnode.com/posts/how-mrz-check-digits-work/6ab4c5b258047cbc31000d1b"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How passport MRZ check digits work (with a validator in Python and JavaScript)](https://doccheap.hashnode.dev/how-mrz-check-digits-work?utm_source=hashnode&utm_medium=feed)

The 7-3-1 algorithm behind every passport and ID card MRZ, where each check digit sits in TD1, TD2 and TD3, and a validator you can paste.

Sep 24 · 12 min read · doccheap.hashnode.dev  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#algorithms](https://hashnode.com/tag/algorithms)
-   [#tutorial](https://hashnode.com/tag/tutorial)
-   [#ocr](https://hashnode.com/tag/ocr)

## Written by

[Teoh Chin Heng](https://hashnode.com/@doccheap)

@doccheap

  
[View profile](https://hashnode.com/@doccheap)

Passport and ID card OCR API. Free – 100 documents every month, then 1¢ each

doc.cheap reads passports, ID cards and driver's licences from a photo and returns JSON in one HTTP call. Free – 100 documents every month, then 1¢ per recognised document; failed scans are free. Try it with the public sandbox key sk\_sandbox\_public, no signup. There is also an MCP server for agents: https://doc.cheap/mcp

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
