Test Card Number Generator: Free Online Test Card Numbers for Sandbox Testing — How-To Guide
If you build or test payment forms, you need card numbers that behave like real ones — without ever touching a real card. The Test Card Number Generator creates valid-format test card numbers for sandbox and development use, so you can check out flows, error handling, and validation logic safely.
Try it free: Test Card Number Generator
What the Tool Does
The Test Card Number Generator produces card numbers that pass the Luhn checksum — the same algorithm real payment systems use to spot typos. That means your test numbers look and validate like genuine card numbers, but they are not linked to any account and carry no money.
It is built for developers and QA testers working in sandbox environments such as Stripe test mode and the PayPal sandbox. The numbers work with the test gateways those platforms provide, and they are always declined on live payment systems — by design.
The tool is free, needs no signup, and runs entirely in your browser.
How to Use It
Step 1: Open the Tool
Go to the Test Card Number Generator. There is nothing to install and no account to create.
Step 2: Pick a Card Brand or Gateway
Choose the card type you need to test — for example Visa or Mastercard — or pick the gateway you are testing against, such as Stripe or PayPal. Different brands have different number formats, so matching the brand to your test case matters.
Step 3: Generate a Number
Click generate. The tool produces a Luhn-valid number in the correct format for the brand you selected. Generate as many as you need; each one is a fresh, valid-format test number.
Step 4: Copy It Into Your Sandbox
Paste the number into your test checkout form, along with a test expiry date and CVC (your gateway's docs list the values to use — Stripe, for example, accepts any future expiry date and any three-digit CVC in test mode). Submit the form in your sandbox environment and confirm the result you expected: a successful charge, a decline, or a validation error, depending on the scenario.
Step 5: Repeat for Other Scenarios
Generate different numbers to cover different cases — a successful payment, a declined card, an expired card — and check that your form handles each one correctly. Test the unhappy paths, not just the happy one.
Practical Tips
- Use the gateway's documented numbers for known outcomes. Stripe publishes specific test numbers for specific results — 4242 4242 4242 4242 is the standard number for a successful charge. Use the documented number when you need a guaranteed outcome, and use generated numbers when you need variety.
- Keep test data far away from real data. Never paste a real card number into a test environment, and never enter a test number on a live site. Test numbers belong in sandboxes only. If your test setup ever asks for a real card, stop — something is misconfigured.
- Test the validation, not just the payment. The Luhn check catches typos and malformed input before anything reaches the gateway. Feed your form a number with a wrong digit and confirm it is rejected client-side, with a clear message the user can act on.
- Save your test scenarios. Keep a short note of which numbers you used for which outcome (success, decline, expired). It makes re-running the same checks after a code change quick and repeatable.
FAQ
Are these real credit card numbers?
No. They are valid-format test numbers: they pass the Luhn check, but they are not tied to any account, bank, or balance. They will be declined on any real payment gateway.
Which test numbers work with Stripe?
Stripe's documentation lists 4242 4242 4242 4242 for successful charges, plus other numbers for declines and specific error cases. This tool generates Luhn-valid numbers you can use for any gateway's test mode, including Stripe and PayPal.
Can I use these numbers for signup forms?
Only in development sandboxes. Never enter test numbers on live sites, and never use real card numbers in test environments. If a live form is asking for payment details, it needs a real payment method — or a different approach entirely.
Do test card numbers expire?
The numbers themselves do not expire, but the expiry date you enter alongside them matters. In test mode, use any future date (your gateway's docs will confirm what it accepts). An expired date is itself a useful test case for your form's validation.
Privacy Note
The Test Card Number Generator runs 100% in your browser — nothing you generate ever leaves your device. There is no server storing your test numbers, and no account tracking what you create. That said, treat even test numbers with care: never mix them with real payment details, and never share screenshots of test checkouts that include real credentials.
Try it free: Test Card Number Generator

