Test Card Number Generator

For testing and development only. Generates Luhn-valid numbers from published test BINs. These are not real cards and carry no balance.

Published test BINs used

Related tools

How this tool works

This tool generates card numbers that pass the Luhn checksum, using published test prefixes. They are the numbers the schemes publish for development use, and they are deliberately not connected to any account, so an authorisation against one is declined however well formed it is.

That is exactly the behaviour a test suite wants: the number passes every structural check and every checksum, gets as far as the authorisation, and is then declined. A test that used random digits would fail at the first validator instead, and a test that used a real card would put a real card in your test environment.

What it produces

PropertyValue
BrandVisa, Mastercard, American Express and others
ChecksumValid, the Luhn check passes
LengthValid for the brand
Connection to an accountNone, the prefixes are published test ranges

An authorisation against one of these returns a decline, and that is the correct and expected result.

When to use it

Frequently asked questions

Are these real card numbers?

No. They use prefixes the schemes publish for testing. They are well formed and pass the checksum, but no account exists behind them, so an authorisation is declined.

Why does a test number get declined?

Because no issuer holds the account. The decline is the correct result, and a test that expects an approval against a test number is testing something that cannot happen.

What are the standard test numbers?

The published ones for each brand, most commonly 4242 4242 4242 4242 for Visa, 5555 5555 5555 4444 for Mastercard and 3782 822463 10005 for American Express.

Why not use random numbers in tests?

Because a random number fails the Luhn check about nine times in ten, so the test fails at the validator rather than at the behaviour you are testing.

Is it safe to use these in a production environment?

They carry no value, so there is no risk in that sense, but they will not work, and a system that accepts them in production has a validation gap.