By ToolzHive
About this tool
Developers need card-shaped numbers to test payment forms, input masks and validation. This generator creates numbers with the correct prefix and length for Visa, Mastercard, American Express, Discover, JCB, Diners Club and UnionPay that pass the Luhn checksum, with optional expiry dates and CVV codes. They are not real cards and will be declined everywhere.
How to use Test Card Number Generator
- Choose the card network and how many numbers you need.
- Choose whether to include an expiry date and CVV, and the output format.
- Copy the numbers into your test form, or check any number with the Luhn validator.
Worked example
Use generated Visa numbers to check that your checkout form accepts 16 digits, formats them in groups of four and rejects a number with a mistyped digit.
Can these numbers be used to buy things?
No. They are not linked to any account, have no money and are declined by payment networks. Using card numbers to deceive anyone is illegal.
What is the Luhn algorithm?
A simple checksum that catches most typing mistakes in card numbers. Passing it means a number is correctly formed, not that the card exists.
Which numbers should I use in a payment sandbox?
Use the official test cards from your payment provider, such as Stripe, PayPal or your bank, because their test systems only accept those numbers.
Put this guide into practice
- Test Card Number Generator — Generate Luhn-valid test card numbers for software testing, and validate numbers.