If you need card numbers to test a checkout, skip the random credit card generator. Randomly generated numbers pass a Luhn check, but real payment sandboxes such as Stripe reject them. Use the official sandbox test card numbers below instead: they work in test mode, can trigger specific declines, and can never charge anyone. Use the free checker to confirm any test number is well formed and see which brand it belongs to.
Official test credit card numbers (Stripe test mode)
For every card below, use any future expiry date, any 3 digit CVC (4 digits for American Express) and any postcode. These numbers only work in test mode.
| Brand | Test card number | CVC |
|---|---|---|
| Visa | 4242 4242 4242 4242 |
Any 3 digits |
| Mastercard | 5555 5555 5555 4444 |
Any 3 digits |
| Mastercard (2 series) | 2223 0031 2200 3222 |
Any 3 digits |
| American Express | 3782 822463 10005 |
Any 4 digits |
| Discover | 6011 1111 1111 1117 |
Any 3 digits |
| Diners Club | 3056 9300 0902 0004 |
Any 3 digits |
| JCB | 3566 0020 2036 0505 |
Any 3 digits |
| UnionPay | 6200 0000 0000 0005 |
Any 3 digits |
Source: Stripe testing documentation. Check the provider’s page before a release, because lists change.
Test card numbers that trigger declines and 3D Secure
A happy path test is not enough. These numbers let you prove your error messages and retry logic work.
| Scenario | Test card number | Result in Stripe |
|---|---|---|
| Generic decline | 4000 0000 0000 0002 |
card_declined |
| Insufficient funds | 4000 0000 0000 9995 |
insufficient_funds |
| Expired card | 4000 0000 0000 0069 |
expired_card |
| Incorrect CVC | 4000 0000 0000 0127 |
incorrect_cvc |
| Processing error | 4000 0000 0000 0119 |
processing_error |
| Always requires 3D Secure | 4000 0027 6000 3184 |
Authentication challenge on every payment |
Free Luhn checker for test card numbers
Paste a test number to see if it passes the Luhn (mod 10) check and which card brand it belongs to. It runs in your browser and nothing is sent or stored. Only use sandbox numbers here, never a real card.
Luhn Checker for Test Card Numbers
Checks the mod 10 digit and detects the brand. Runs in your browser; nothing is sent or stored. Only paste sandbox test numbers, never a real card.
Why a random credit card generator is the wrong tool for payment testing
Most credit card generator sites produce a random number that passes the Luhn check and attach a random expiry date and CVV. That looks useful, but it causes three problems for testers.
- Sandboxes reject them. Stripe, Braintree, Adyen and PayPal only accept their own published test numbers in test mode. A random number fails before your code is even exercised.
- You cannot test failure paths. A random number cannot ask the gateway for an insufficient funds or 3D Secure response. Official test cards can, and failure paths are where most checkout bugs hide.
- A random number might be real. A Luhn valid number with a real bank prefix can belong to an actual cardholder. Typing it into a live payment form is a real transaction attempt. Sandbox numbers carry no such risk.
The Luhn check only proves a number is well formed. It is a typo filter, not proof that a card exists. That is why the checker above is useful for validating your form logic, but the table is what you should paste into your checkout.
Where to find test cards for other payment gateways
- Stripe: docs.stripe.com/testing
- Braintree (PayPal): the testing page in the Braintree developer documentation
- Adyen: the test card numbers page in the Adyen docs
- PayPal: the sandbox testing guide in the PayPal developer portal
- Razorpay and other regional gateways: each publishes its own test cards in its test mode docs
Each gateway’s numbers only work in that gateway’s sandbox, so always use the list from the provider you are integrating.
A payment testing checklist
- Successful payment for every card brand you accept.
- Each decline type shows a clear, specific message to the shopper.
- 3D Secure challenge passes, fails and gets abandoned without leaving a broken order.
- Card number field accepts spaces, rejects letters and handles 15 digit Amex numbers.
- Expired dates and wrong CVC lengths are caught before the request is sent.
- Double clicks on the pay button never create two charges.
- Refunds and partial refunds update the order status.
- No full card number appears in your logs, analytics or error reports.
Want more ideas? See how interviewers expect you to test a payment gateway integration, and keep your test cards organised with good test data management.
Frequently asked questions
Are these test credit card numbers free to use?
Yes. Payment providers publish them so developers can test checkouts. They only work in test mode and cannot make real purchases.
What CVV and expiry date should I use with test cards?
In Stripe test mode, use any future expiry date and any 3 digit CVC, or 4 digits for American Express.
Do credit card generator numbers work for real purchases?
No, and you should never try. Generated numbers either fail or, in rare cases, match a real person’s card. Using someone else’s card details is fraud.
What is the Luhn algorithm?
The Luhn algorithm, also called mod 10, is a simple checksum that catches most typing mistakes in card numbers. Passing it means the number is well formed, not that the card exists or has funds.
Can I use the same test card in every payment gateway?
Not always. 4242 4242 4242 4242 is specific to Stripe. Other gateways publish their own lists, so check the documentation for the one you use.
How do I test a declined payment?
Use a decline test number such as 4000 0000 0000 0002 in Stripe test mode. Other numbers simulate insufficient funds, an expired card or an incorrect CVC.
Bottom line
For payment testing, official sandbox test cards beat any random credit card generator. They work in test mode, they let you trigger the exact failure you want, and they never touch a real account. Bookmark this page for the numbers, and use the Luhn checker to validate your own form logic.