Validators
Credit Card Validator: Luhn Check & Card Type Detector
Validate credit card numbers using the Luhn algorithm. Detects Visa, Mastercard, Amex, Discover, and more. No data is sent to any server.
Enter a card number to validate. No real card data is transmitted - all checks run in your browser.
Credit Card Number Validator
Enter any card number to check whether it passes the Luhn checksum, identify the card network (Visa, Mastercard, American Express, Discover, etc.), and verify that the length matches the expected format.
The Luhn Algorithm
The Luhn algorithm (also known as the "mod 10" algorithm) is a simple checksum formula used to validate identification numbers such as credit card numbers. It can detect any single-digit error and most transpositions of adjacent digits. It is not a cryptographic check: it only protects against accidental errors.
Privacy
All validation runs entirely in your browser using JavaScript. Your card number is never sent to any server. The test numbers shown are synthetic numbers for demonstration only.
Luhn algorithm: step-by-step walkthrough
Using the number 4539 1488 0343 6467 as an example:
- Starting from the rightmost digit (the check digit), double every second digit going left.
- If a doubled value exceeds 9, subtract 9 from it.
- Sum all digits (original and doubled).
- If the total is divisible by 10, the number is valid.
4 5 3 9 1 4 8 8 0 3 4 3 6 4 6 7 (original)
8 5 6 9 2 4 7 8 0 3 8 3 3 4 3 7 (doubled alternating, subtract 9 if > 9)
Sum = 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3+7 = 80
80 mod 10 = 0 -> Valid Card type IIN/BIN prefixes
| Network | Starts with | Length |
|---|---|---|
| Visa | 4 | 13 or 16 digits |
| Mastercard | 51–55 or 2221–2720 | 16 digits |
| American Express | 34 or 37 | 15 digits |
| Discover | 6011, 622126–622925, 644–649, or 65 | 16 digits |
| JCB | 3528–3589 | 16 digits |
| Diners Club | 300–305, 36, 38 | 14 digits |
Test card numbers for developers
These synthetic numbers pass the Luhn check but are not real cards and cannot be charged:
- Visa: 4242 4242 4242 4242 (Stripe test card)
- Mastercard: 5555 5555 5555 4444
- Amex: 3782 822463 10005
- Discover: 6011 1111 1111 1117