Credit card number generator

Generate structurally valid credit card numbers that pass Luhn checksum validation. Every number uses the correct BIN prefix for its network, paired with a valid CVV length and future expiry date. For software testing and development only — these numbers will be declined by every real payment processor.

For testing only. Generated card numbers are mathematically valid but completely fictitious. They will be rejected by all real payment processors. Using fake card numbers for fraudulent transactions is illegal.

Generated card numbers

Network Card number Expiry CVV Valid

What are test credit card numbers?

Test credit card numbers are fictitious card numbers that are structurally identical to real credit card numbers — they follow the same format, use the correct network prefix, and pass the same mathematical validation checks — but are not registered to any account, bank, or financial institution. They exist solely for software testing purposes and will be declined by every real payment processor.

Every major payment gateway — including Stripe, PayPal, Braintree, Square, and Adyen — provides its own set of test card numbers for use in sandbox environments. This generator creates additional test numbers following the same structural rules, which is useful when you need large volumes of test data or need numbers that aren't in the standard test sets provided by payment processors.

How the Luhn algorithm works

The Luhn algorithm, also called the mod-10 algorithm, is a simple checksum formula used to validate identification numbers. It was invented by IBM scientist Hans Peter Luhn in 1954 and is now used to validate credit card numbers, IMEI numbers, Canadian Social Insurance Numbers, and other identification strings.

The algorithm works by processing the digits from right to left. Every second digit is doubled. If doubling produces a number greater than 9, subtract 9. Sum all the digits. If the total is divisible by 10, the number is valid. This single check digit at the end of every card number means that any single digit error or transposition of adjacent digits (the most common human data entry mistakes) will be detected immediately.

Credit card network prefixes

Each card network uses specific number ranges called BIN (Bank Identification Number) ranges. Visa card numbers always start with 4 and are 16 digits long. Mastercard numbers start with 51 through 55 (or 2221 through 2720 for newer cards) and are 16 digits. American Express cards start with 34 or 37 and are 15 digits long — the shorter length is why Amex CVV codes are 4 digits instead of 3. Discover cards start with 6011, 622, 644–649, or 65 and are 16 digits long.

CVV and expiry date explained

The CVV (Card Verification Value) is a 3-digit security code on Visa, Mastercard, and Discover cards printed on the back. American Express uses a 4-digit CID (Card Identification Number) on the front. The CVV is not encoded in the magnetic stripe or chip — it exists specifically to prove the physical card is present during card-not-present (online) transactions. Generated CVVs are random numbers of the correct length for each network. Expiry dates are set 1–4 years in the future to simulate active cards.

API access

Generate test card numbers programmatically via the Toolpad REST API:

GET https://api.toolpad.in/api/v1/financial/credit-card?network=visa&count=25

Valid network values: visa, mastercard, amex, discover. Omit the network parameter for random networks.

Will these card numbers work for real payments? +
No. These numbers are fictitious and will be declined by every real payment processor. They do not correspond to any real bank account, cardholder, or financial institution. They are structurally valid (they pass Luhn checks and use correct network prefixes) but that is where the similarity to real cards ends.
What is the difference between a test card and a real card number? +
Structurally, nothing — both use the same format, same network prefixes, and same Luhn algorithm. The difference is that real card numbers are issued by banks to specific cardholders and registered in payment network databases. Generated test numbers are not registered anywhere and will fail authorization checks at the payment network level.
Can I use these for payment gateway sandbox testing? +
For most sandbox testing, yes — generated numbers that pass Luhn validation will work in sandbox environments for testing form validation and basic flow logic. However, many payment gateways (Stripe, PayPal, etc.) use specific test card numbers with predetermined behaviors (success, decline, 3DS required). For testing specific gateway responses, use the test numbers provided by your payment gateway documentation.
Why does American Express have 4-digit CVV codes? +
American Express uses a 4-digit CID (Card Identification Number) printed on the front of the card, while Visa, Mastercard, and Discover use 3-digit CVV/CVC codes on the back. Amex cards are also 15 digits rather than 16. These differences reflect the proprietary specifications Amex developed independently before industry standardisation.
What does BIN mean? +
BIN stands for Bank Identification Number (also called IIN, Issuer Identification Number). It is the first 6 digits of a card number and identifies the card network, issuing bank, and card type. Payment processors use BIN lookups to route transactions to the correct network and apply the correct validation rules.