What algorithm is commonly used to validate credit card numbers?

The story behind the answer

What algorithm is commonly used to validate credit card numbers? The Luhn algorithm is commonly used to validate credit card numbers.

Luhn is a checksum test designed to catch common transcription errors in identification numbers. Starting from the right side of a number, digits in alternating positions are doubled; when a doubled value exceeds 9, its digits are effectively reduced by subtracting 9. The resulting values are added, and a number passes when the total is divisible by 10.

The method is associated with IBM scientist Hans Peter Luhn, who patented it in 1960. It is also known as the modulus-10 formula. Payment systems use it as a quick first check for a mistyped or structurally invalid Primary Account Number.

Passing Luhn does not prove that a card exists, that it belongs to a particular person, or that a transaction is authorized. It is not encryption and does not replace issuer checks, expiration-date verification, chip authentication, or fraud screening. SHA-256 and MD5 are hashing algorithms, while RSA is a public-key cryptosystem.

Source: Wikipedia · fact-checked Sept. 2026

Add question to a list

Choose a list to keep this question in: