mimirwiki.com/wiki/luhn-algorithm
rev c7aa5de0Updated 2026-12-04EN · KO · JA · ZH · ES · DE · FR · PT · RU · IT · HI · AR
Concept/Technology and AI

Luhn Algorithm

Modulus-10 check-digit formula for detecting entry errors in decimal identification numbers

Expert review pending
Written automatically from public sources6 sources
View the page in the format AI receives
Summary

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.

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 digit5
Major Applications
Payment card PAN, mobile IMEI, U.S. NPI2
NPI Prefix Rule
Calculated with 80840 prefix (adds constant 24)5
Validation Limit
Format check only; does not prove issuance2

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

01

Origin and Patent History

Government and public records Academic and news Official sites

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.145

02

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).156

All resulting values are added to the unchanged digits. If the grand total modulo 10 equals 0, the number passes the Luhn check.56 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

03

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).34
  • 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
04

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.16

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.1245

05

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.16
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).345
06

Quotable sentences

Each sentence has a source, so you can quote it as it is.
  1. Hans Peter Luhn filed U.S. patent US2950048A on July 20, 1954, and the patent was granted on August 23, 1960.1
  2. 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.156
  3. 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).2345
  4. Passing a Luhn check confirms only format validity and does not verify whether a payment card or identifier is actually issued or active.2
07

Timeline

  1. Hans Peter Luhn files U.S. patent application US2950048A for a number-verifying computer.1
  2. U.S. Patent US2950048A is published and granted.1
  3. CMS publishes the NPI Check Digit specification incorporating the Luhn formula with the 80840 prefix constant (24).5
  4. ETSI publishes TS 123 003 V18.7.0 detailing the Luhn check digit for mobile IMEIs in Annex B.4
08

Sources

6 sources

Government and public records

  1. 5
    NPI Check Digit Technical Specification · Centers for Medicare & Medicaid Services (CMS) · published 2004-01-23 · checked 2026-12-04https://www.cms.gov/Regulations-and-Guidance/Administrative-Simplification/NationalProvIdentStand/Downloads/NPIcheckdigit.pdf

Academic and news

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

Review and writing

review signature

Expert review pending

When a credentialed expert reviews this page, the reviewer's name and the review date appear here. (Current version c7aa5de0)

How this page was written

Written automatically from the public information in the sources above.

10

Version

SHA-256

c7aa5de00608efc4ea4f4128be1960d8fc07274fdebc6e5af8105cf653c3242e

Each edit gives the page a new version number.

Cite this page

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

Formats for AI
# Markdown
curl https://mimirwiki.com/wiki/luhn-algorithm.md

# JSON-LD, by content negotiation
curl -H "Accept: application/ld+json" \
  https://mimirwiki.com/wiki/luhn-algorithm

Add an extension to the address to get the same content in that format.