Test Credit Card Number Generator

Generate credit card numbers that pass the Luhn checksum, with correct brand prefixes and lengths for Visa, Mastercard, American Express and Discover. Meant for dev and form testing; these cannot be charged.

Numbers pass Luhn with correct prefixes and lengths, but no real account sits behind them. Do not use them for real purchases.
How the Luhn checksum works

Counting from the right, double every second digit, subtract 9 from any result over 9, then sum everything. The number passes if the total divides by 10. The last digit here is derived from that rule, so it always passes.

Note that Luhn only catches typos; it does not prove an account exists. An all-ones number can satisfy it.

Check any number offline

Official brand test numbers you can use as-is
4111111111111111Visa official universal test number, always valid
5555555555554444Mastercard official test number
378282246310005Amex official test number (15 digits)
6011111111111117Discover official test number

These come from public card-scheme docs, but gateway sandboxes differ; follow your provider's docs.

About this tool

Wiring up a payment provider or testing a checkout flow is the last place you want to swipe a real card. Test numbers need to actually pass Luhn, match the right length and carry the right brand prefix — otherwise the front-end rejects them before you learn anything.

This generator follows each brand's real rules: Visa starts with 4 and runs 16 digits, Mastercard uses 51-55 or 2221-2223, Amex is 34/37 at 15 digits, Discover uses 6011, 65 or 644-646. The final digit is computed with Luhn, so every generated number validates by construction.

Common use cases

FAQ

More tools