Credit card generator

What is a Credit Card Generator?

When building a checkout, you need card numbers that pass format validation without being real cards. This generator creates numbers that follow the correct prefix and length for each card network and pass the Luhn checksum, along with a random future expiry date and CVV. They are for testing and development only. They are not linked to any account and cannot be used to buy anything.

How to use it

  1. Choose the card network.
  2. Generate one or more numbers.
  3. Use them to test front-end validation, input masks and form logic.

How card numbers are structured

  • Prefix (IIN/BIN): Visa starts with 4, Mastercard with 51 to 55 or 2221 to 2720, American Express with 34 or 37, Discover with 6011 or 65.
  • Length: 16 digits for most networks, 15 for Amex.
  • Check digit: the last digit is computed with the Luhn algorithm.

The Luhn check

From the rightmost digit, double every second digit; if the result is above 9, subtract 9. Sum all digits. The number is valid if the sum is divisible by 10. For example, 4111 1111 1111 1111 passes, which is why it is a widely used Visa test number.

Testing with payment providers

Payment gateways reject Luhn-valid but unknown numbers in sandbox mode. For end-to-end tests with Stripe, Adyen, Braintree or Razorpay, use the official test cards from their documentation, such as Stripe's 4242 4242 4242 4242, which also let you simulate declines and 3-D Secure.

Responsible use

Using generated numbers to obtain goods, services or free trials is fraud. These numbers are for software testing only.

Frequently Asked Questions

Are these real credit card numbers?

No. They only follow the format and checksum rules. They are not linked to any bank account and cannot make payments.

What is the Luhn algorithm?

A simple checksum used to catch typing errors in card numbers. It does not verify that a card exists.

Can I use these numbers in Stripe test mode?

Stripe and other gateways require their own published test card numbers for sandbox payments. Use generated numbers for form validation testing.

How many digits does an Amex card have?

American Express cards have 15 digits and start with 34 or 37.