Test credit card numbers are synthetic 15- or 16-digit strings constructed so that the final digit satisfies the Luhn checksum (ISO/IEC 7812-1) and the leading digits match a real Issuer Identification Number (IIN) prefix. They look exactly like real cards to client-side validators but are not registered with any issuing bank, so a payment processor will reject them at the authorization step.
This generator builds each number directly in the browser using Math.random for the body digits, then computes the Luhn check digit with a small TypeScript implementation you can read in the source above. The Luhn pass works by doubling every second digit from the right, summing the digits of any result greater than 9, and choosing the final digit so the total is a multiple of 10.
Each card type uses a real IIN range: Visa starts with 4 (16 digits), Mastercard starts with 5 (16 digits, ranges 51-55), American Express starts with 34 or 37 (15 digits), and Discover starts with 6011 (16 digits). These ranges are public information published by ISO and the card networks - they identify the issuing system, not any individual account, so generating a number in the range cannot match a live card.
The CVV (Card Verification Value, sometimes CVC or CID) is a 3-digit code on Visa, Mastercard, and Discover, or a 4-digit code printed on the front of an American Express card. The real CVV is computed from the card number, expiry, and a bank-held secret using a DES-based MAC; this tool just generates a random number of the right length, which is sufficient for client-side form validation but will fail any actual processor check.
Expiry dates are randomized to a month within the next 1-5 years, formatted MM/YY, which is how processors expect them on the wire. The tool deliberately avoids generating past dates because most payment SDKs reject expired cards before the network call, which would defeat the purpose of a smoke-test fixture.
Where this is useful: testing the visual states of a payment form, exercising your input mask, smoke-testing a checkout flow against a sandbox like Stripe's testmode (where Stripe's own dedicated test numbers - 4242 4242 4242 4242, etc. - are usually a better fit), and populating UI mockups so your screenshots don't leak real PANs. Where it is not useful: anything beyond the format validation gate. Real authorization, AVS, fraud scoring, and 3DS will all reject these numbers immediately.
Important legal note: generating a number that happens to match a real account is not fraud, but attempting to charge any card you don't own is. Use these strictly for development, automated tests, and demos. For real production-style testing, every major payment provider (Stripe, Adyen, Braintree, Square) publishes a small set of dedicated test numbers that interact correctly with their sandbox - prefer those when integrating against a specific gateway.