Validate and generate numbers using the Luhn algorithm.
The Luhn algorithm (also known as the "modulus 10" or "mod 10" algorithm) is a checksum formula used to validate identification numbers such as credit card numbers (PANs), IMEI numbers, Canadian Social Insurance Numbers, and US National Provider Identifiers. Invented by Hans Peter Luhn in 1954 at IBM and patented in 1960, it is in the public domain and is described by ISO/IEC 7812-1, the international standard that governs payment card numbering. The Luhn check is designed to catch the most common human entry errors: any single-digit substitution (caught 100% of the time) and any transposition of two adjacent digits (caught in all cases except 09↔90). It is not a cryptographic hash and provides zero protection against deliberate tampering — it is purely an error-detection mechanism used as the last line of defense before a card number is sent to a payment processor. Every PAN issued by Visa, Mastercard, American Express, Discover, JCB, and UnionPay carries a Luhn-valid check digit in its rightmost position, making this calculator a daily tool for anyone developing or testing payment integrations.