Credit Card Generator (Test Numbers)

Generate Luhn-valid dummy card numbers for testing payment forms.

What are test credit card numbers?

Test credit card numbers are fake numbers with a real brand prefix and a valid Luhn checksum. They pass basic format validation in forms but are not linked to any account, so they cannot be charged — developers use them to test checkout forms.

How the numbers are built

  1. Start with a brand prefix (IIN): Visa 4, Mastercard 51–55, Amex 34/37, Discover 6011, JCB 3528–3589.
  2. Fill random digits up to the correct length (16, or 15 for Amex).
  3. Add the final Luhn check digit so the number passes checksum validation.
  4. Generate a random future expiry date and CVV (4 digits for Amex).

What they are for

  • Testing client-side validation, formatting and brand detection in forms.
  • Filling demo and staging environments with realistic-looking data.
  • Teaching how card numbers and the Luhn algorithm work.

What they cannot do

These numbers are not issued by any bank. Any real payment will be declined. Attempting to use generated numbers for purchases is fraud. For end-to-end payment testing, use your payment provider's official sandbox cards — Stripe's 4242 4242 4242 4242, PayPal sandbox accounts and similar — which also simulate declines and 3-D Secure.

Check a number's checksum and brand with the Credit Card Validator.

Frequently asked questions

Can I buy things with these card numbers?

No. They are fake numbers that only pass format checks. Real transactions are declined, and trying to use them is fraud.

What is the Luhn algorithm?

A checksum formula that validates card numbers by doubling every second digit from the right and checking that the total is divisible by 10.

What test cards should I use with Stripe or PayPal?

Use the official sandbox numbers from your payment provider's documentation, such as Stripe's 4242 4242 4242 4242 in test mode.