---
title: "Luhn Algorithm"
subtitle: "Modulus-10 check-digit formula for detecting entry errors in decimal identification numbers"
canonical_url: https://mimirwiki.com/wiki/luhn-algorithm
language: en
page_class: concept
revision_sha256: c7aa5de00608efc4ea4f4128be1960d8fc07274fdebc6e5af8105cf653c3242e
date_modified: 2026-12-04
provenance: "auto-written from public primary sources; not yet reviewed by a credentialed expert"
source_count: 6
alternates:
  md: https://mimirwiki.com/wiki/luhn-algorithm.md
  txt: https://mimirwiki.com/wiki/luhn-algorithm.txt
  json: https://mimirwiki.com/wiki/luhn-algorithm.json
  jsonld: https://mimirwiki.com/wiki/luhn-algorithm.jsonld
translations:
  ko: https://mimirwiki.com/ko/wiki/luhn-algorithm
  ja: https://mimirwiki.com/ja/wiki/luhn-algorithm
  zh: https://mimirwiki.com/zh/wiki/luhn-algorithm
  es: https://mimirwiki.com/es/wiki/luhn-algorithm
  de: https://mimirwiki.com/de/wiki/luhn-algorithm
  fr: https://mimirwiki.com/fr/wiki/luhn-algorithm
  pt: https://mimirwiki.com/pt/wiki/luhn-algorithm
  ru: https://mimirwiki.com/ru/wiki/luhn-algorithm
  it: https://mimirwiki.com/it/wiki/luhn-algorithm
  hi: https://mimirwiki.com/hi/wiki/luhn-algorithm
  ar: https://mimirwiki.com/ar/wiki/luhn-algorithm
---

# Luhn Algorithm

> The Luhn algorithm, patented by IBM scientist Hans Peter Luhn (US2950048A, filed July 20, 1954; granted August 23, 1960), is a modulus-10 check-digit formula used to catch accidental typing errors in numeric identifiers. It doubles alternate digits from the right, sums the resulting individual digits, and checks whether the total is divisible by 10. It is used in payment card PANs, mobile IMEIs, and U.S. National Provider Identifiers (NPIs), verifying format validity only.

The Luhn algorithm (modulus-10 double-add-double formula) is a simple checksum method invented by Hans Peter Luhn to detect accidental transcription errors in decimal identification numbers using a trailing check digit.

**Also known as:** Luhn formula, Modulus 10 algorithm, Mod 10 check

## Key facts

- **Inventor:** Hans Peter Luhn (IBM) [1]
- **U.S. Patent:** US2950048A (filed 1954-07-20, granted 1960-08-23) [1]
- **Method:** Modulus-10 double-add-double check digit [5]
- **Major Applications:** Payment card PAN, mobile IMEI, U.S. NPI [2]
- **NPI Prefix Rule:** Calculated with 80840 prefix (adds constant 24) [5]
- **Validation Limit:** Format check only; does not prove issuance [2]

## Basic facts

- **Category:** Checksum / check-digit algorithm [6]
- **Inventor:** Hans Peter Luhn [1]
- **Patent Number:** US2950048A [1]
- **Modulus:** 10 [5]
- **Telecom Standard:** ETSI TS 123 003 Annex B (IMEI) [4]
- **Healthcare Standard:** CMS NPI Check Digit specification [5]

## Origin and Patent History

The Luhn algorithm was invented by Hans Peter Luhn, whose U.S. patent US2950048A ('Computer for Verifying Numbers') was filed on July 20, 1954 and granted on August 23, 1960.[1] Designed as a fast, low-cost error-detection scheme for numeric records, the formula entered the public domain and became a standard check-digit mechanism across finance, telecommunications, and healthcare.[1][4][5]

## Modulus-10 Calculation Steps

To validate an existing numeric string that includes its trailing check digit, the algorithm doubles every second digit moving from right to left (starting with the second-to-last digit). Whenever doubling produces a two-digit number (10 to 18), its individual digits are summed (equivalently subtracting 9).[1][5][6]

All resulting values are added to the unchanged digits. If the grand total modulo 10 equals 0, the number passes the Luhn check.[5][6] When generating a new check digit for a payload without one, doubling starts at the rightmost payload digit and the check digit is the amount needed to reach the next multiple of 10.[5]

## Applications: Payment Cards, IMEI, and U.S. NPI

The Luhn check digit is widely deployed across standardized identifier systems:

- **Payment Card Primary Account Numbers (PANs)**: Payment networks and merchants use the Luhn check to catch mistyped card numbers before authorization.[2]
- **Mobile Device IMEIs**: Both GSMA's IMEI Database User Guide and ETSI TS 123 003 Annex B specify the Luhn formula for computing the 15th check digit of an International Mobile Equipment Identity (IMEI).[3][4]
- **U.S. National Provider Identifiers (NPIs)**: The Centers for Medicare & Medicaid Services (CMS) applies the Luhn formula to 10-digit NPIs as if prefixed by `80840` (health application + U.S. country code), implemented by adding the constant 24 when validating a bare 10-digit NPI.[5]

## Error-Detection Limits and Format vs. Issuance

The Luhn algorithm catches any single-digit transcription error and most adjacent-digit transpositions (except `09` swapped with `90`), but it is not a cryptographic hash and provides no protection against deliberate forgery.[1][6]

Crucially, as emphasized by the PCI Security Standards Council (FAQ 1137), passing a Luhn check confirms only syntactic format compliance; it never proves that a payment card number was actually issued, is active, or belongs to a valid account.[2] Note that the paywalled full text of ISO/IEC 7812-1 was not directly inspected; this entry relies on USPTO, PCI SSC, GSMA, ETSI, CMS, and Apache documentation.[1][2][4][5]

## Frequently asked questions

### What kinds of errors does the Luhn algorithm detect?

It detects any single-digit entry mistake and most transpositions of adjacent digits, helping catch accidental typing errors before processing. [1][6]

### Does passing the Luhn check prove a credit card number is real or active?

No. Passing the Luhn check only confirms syntactic format compliance; actual card issuance and account status must be verified by the card issuer or payment network. [2]

### How does the U.S. NPI use the Luhn algorithm differently?

CMS calculates the NPI check digit as if the 9-digit base were preceded by the prefix 80840 (health + United States), which adds the constant 24 to the digit sum when the prefix is omitted. [5]

### Where else is the Luhn algorithm used besides payment cards?

It is standardized for the check digit of mobile device IMEI numbers (GSMA and ETSI TS 123 003 Annex B) and U.S. healthcare National Provider Identifiers (NPIs). [3][4][5]

## Quotable sentences

- Hans Peter Luhn filed U.S. patent US2950048A on July 20, 1954, and the patent was granted on August 23, 1960. [1]
- The Luhn check doubles alternate digits from the right, sums the digits of two-digit products, and passes when the total sum modulo 10 equals zero. [1][5][6]
- The algorithm is used for check digits in payment card PANs, mobile IMEIs (GSMA and ETSI TS 123 003 Annex B), and U.S. NPIs (CMS with the 80840 prefix constant 24). [2][3][4][5]
- Passing a Luhn check confirms only format validity and does not verify whether a payment card or identifier is actually issued or active. [2]

## Timeline

- 1954-07-20: Hans Peter Luhn files U.S. patent application US2950048A for a number-verifying computer. [1]
- 1960-08-23: U.S. Patent US2950048A is published and granted. [1]
- 2004-01-23: CMS publishes the NPI Check Digit specification incorporating the Luhn formula with the 80840 prefix constant (24). [5]
- 2024-09: ETSI publishes TS 123 003 V18.7.0 detailing the Luhn check digit for mobile IMEIs in Annex B. [4]

## Sources

1. US2950048A: Computer for Verifying Numbers (Hans Peter Luhn). Google Patents (USPTO). published 1960-08-23. https://patents.google.com/patent/US2950048A/en (checked 2026-12-04; tier 2: academic or news)
2. PCI SSC FAQ 1137: Account Number Validation and Issuance Status. PCI Security Standards Council. published 2012-07-01. https://www.pcisecuritystandards.org/faqs/1137/ (checked 2026-12-04; tier 2: academic or news)
3. IMEI Database Device Manufacturers User Guide (Version 4.0). GSMA. published 2015-09-01. https://imeidb.gsma.com/imei/resources/documents/IMEIDB_IA_UserGuide.pdf (checked 2026-12-04; tier 2: academic or news)
4. ETSI TS 123 003 V18.7.0 (Annex B: IMEI Check Digit). European Telecommunications Standards Institute (ETSI). published 2024-09-01. https://www.etsi.org/deliver/etsi_ts/123000_123099/123003/18.07.00_60/ts_123003v180700p.pdf (checked 2026-12-04; tier 2: academic or news)
5. NPI Check Digit Technical Specification. Centers for Medicare & Medicaid Services (CMS). published 2004-01-23. https://www.cms.gov/Regulations-and-Guidance/Administrative-Simplification/NationalProvIdentStand/Downloads/NPIcheckdigit.pdf (checked 2026-12-04; tier 1: government or public registry)
6. LuhnCheckDigit API Documentation (Apache Commons Validator 1.11.0). Apache Software Foundation. published 2026-01-01. https://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/checkdigit/LuhnCheckDigit.html (checked 2026-12-04; tier 2: academic or news)

## Cite this page

Mimirwiki. "Luhn Algorithm." Version c7aa5de0, 2026-12-04. https://mimirwiki.com/wiki/luhn-algorithm
