Every credit card number follows a specific pattern and includes a built-in check digit. The Luhn algorithm (also known as the "modulus 10" algorithm) is used to validate these numbers and catch common input errors.
How the Luhn Algorithm Works
Step-by-Step Example
Card number: 4539 1488 0343 6467
| Position | Digit | Doubled | Adjusted | Final |
|---|---|---|---|---|
| 16 (check) | 7 | — | — | 7 |
| 15 | 6 | 12 | 3 | 3 |
| 14 | 4 | — | — | 4 |
| 13 | 6 | 12 | 3 | 3 |
| ... | ... | ... | ... | ... |
Card Network Identification
| Network | Starts With | Length |
|---|---|---|
| Visa | 4 | 16 |
| Mastercard | 51-55, 2221-2720 | 16 |
| American Express | 34, 37 | 15 |
| Discover | 6011, 65 | 16 |
| Troy | 9792 | 16 |
What Luhn Does NOT Check
The Luhn algorithm only verifies the mathematical validity of the number. It does not:
Common Use Cases
Try It Yourself
Validate any credit card number with our free Credit Card Validator. Check the Luhn algorithm, detect the card network, and verify the format.