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
- Visa: 4242424242424242
- Mastercard: 5555555555554444
- AMEX: 378282246310005
- Discover: 6011111111111117
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
| Property | Value |
|---|---|
| Brand | Visa, Mastercard, American Express and others |
| Checksum | Valid, the Luhn check passes |
| Length | Valid for the brand |
| Connection to an account | None, 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
- Seed a test suite with valid-format card numbers
- Test a checkout end to end, including the decline path
- Test a card-formatter or a masker
- Test an authorisation integration without a real card
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.