Credit Card Number Validator (Luhn Check)
Validate card numbers with the Luhn check and detect the card brand.
Checked in your browser and never sent anywhere. Even so, do not paste real card numbers into websites; use the test numbers below.
Official test card numbers
Published by payment providers for sandbox testing. They pass the Luhn check but are not real cards.
| Brand | Number | Source | Actions |
|---|---|---|---|
| Visa | 4242 4242 4242 4242 | Stripe | |
| Visa | 4111 1111 1111 1111 | PayPal / Braintree | |
| Visa | 4012 8888 8888 1881 | PayPal / Braintree | |
| Visa (debit) | 4000 0566 5566 5556 | Stripe | |
| Mastercard | 5555 5555 5555 4444 | Stripe | |
| Mastercard (2-series) | 2223 0031 2200 3222 | Stripe | |
| Mastercard | 5105 1051 0510 5100 | PayPal / Braintree | |
| Mastercard (debit) | 5200 8282 8282 8210 | Stripe | |
| American Express | 3782 822463 10005 | Stripe | |
| American Express | 3714 496353 98431 | Stripe | |
| Discover | 6011 1111 1111 1117 | Stripe | |
| Discover | 6011 0009 9013 9424 | Stripe | |
| Diners Club | 3056 9300 0902 0004 | Stripe | |
| Diners Club (14-digit) | 3622 720627 1667 | Stripe | |
| JCB | 3566 0020 2036 0505 | Stripe | |
| JCB | 3530 1113 3330 0000 | PayPal / Braintree | |
| UnionPay | 6200 0000 0000 0005 | Stripe |
Use via API
Check a payment card number's format: brand from its IIN prefix, length and Luhn check digit. Does not contact any bank or check whether the card exists. Send JSON, get JSON back.
POST https://pithlab.com/api/v1/tools/credit-card-validator
curl https://pithlab.com/api/v1/tools/credit-card-validator \
-H "Authorization: Bearer $PITHLAB_KEY" \
-H "Content-Type: application/json" \
-d '{"number":"4111 1111 1111 1111"}'About the Credit Card Validator
Check a card number with the Luhn algorithm, detect Visa, Mastercard, Amex and other brands, check the length and format it. Bulk mode included, all offline.
How to use the Credit Card Validator
- Type or paste a card number. Spaces and dashes are ignored.
- Read the detected brand, the Luhn check result and whether the length suits that brand.
- Switch to Bulk to check many numbers at once, one per line, then copy the results.
- Use the payment providers' published test numbers below when you need a sample, never a real card.
Examples
Input
4242424242424242
Output
4242 4242 4242 4242: Visa, valid (Luhn pass, length OK)
Input
378282246310005
Output
3782 822463 10005: American Express, valid (Luhn pass, length OK)
Input
4242 4242 4242 4241
Output
4242 4242 4242 4241: Visa, invalid (Luhn fail, length OK)
Frequently asked questions
Does a valid result mean the card is real?
No. The Luhn check only catches typing mistakes. A number can pass it and still not exist, be expired or be blocked. Only the card issuer can say whether a card is real and active, through a payment authorisation.
Should I paste my real card number here?
You should never paste a real card number into any website you do not need to pay on. This tool runs entirely in your browser and sends nothing anywhere, but there is no reason to risk it: use the published test numbers instead.
How does the Luhn algorithm work?
Starting from the rightmost digit, double every second digit, subtract 9 from any result over 9, then add all the digits. If the total ends in 0, the number passes.
How is the card brand worked out?
From the first digits, the Issuer Identification Number. For example, Visa starts with 4, Mastercard with 51 to 55 or 2221 to 2720, and American Express with 34 or 37.
Why doesn't this generate card numbers?
Payment providers publish official test numbers for development, so there is no need to generate new ones. Those are listed on this page.