Test credit card number generator (Luhn)

A test credit card number is valid if it passes the Luhn algorithm: after doubling every second digit from the right and adding everything up, the total is a multiple of 10. This generator only uses public test BIN ranges, so the cards work in forms and payment sandboxes, but any real payment gateway rejects them.

Each card uses a public test BIN range (never a real production one) and calculates the check digit with the Luhn algorithm.

5 generated examples
378282003487780Valid
378282391153291Valid
5555555809428247Valid
371449510649452Valid
371449135809762Valid

How it's calculated

BINs from public test ranges + Luhn check digit (mod 10).

Generated sample
378282003487780

Every other digit (from the right) is doubled and all the digits are added up.

  1. 1
    Number without the check digit
    37828200348778
  2. 2
    Luhn sum (alternate digits doubled, -9 if over 9)
    70
  3. 3
    Check digit = (10 − sum mod 10) mod 10
    0

Frequently asked questions

Can I use test credit cards to make purchases?

No. The numbers use public test BIN ranges, so any real payment gateway rejects them. They are only for development, QA and sandbox environments.

Which card brands does it generate?

Visa, Mastercard and American Express. You can pick the brand or let it be chosen at random.

Do the test cards include a CVV and expiry date?

Yes. The full generator adds a CVV and a future expiry date to each card number.

Keep exploring

Looking for more data types? Try the full generator.