4

When generating fake United States credit card numbers, I know that any random number that passes the Luhn algorithm would work, but then I run the risk, even if small, of generating a CCN in current use.

Has the American Banking Association set aside a range of bank identifier numbers specifically for sample numbers? Does any standard range exist?

This would be similar to the example.com domains, the TEST-NET-1, TEST-NET-2, TEST-NET-3 IP addresses, or the (xxx) 555-01xx telephone range.

I guess I could generate numbers that would fail the Luhn check, but would prefer to generate numbers that pass it.

2

I don't have a definitive list, but a quick search yielded lots of results.

A small selection of numbers:

  • VISA: 4111 1111 1111 1111

  • MasterCard: 5555 5555 5555 4444

  • Discover: 6011 6011 6011 6611

  • AmEx: 3782 8224 6310 005

These numbers all pass the Luhn algorithm.

I haven't seen any standard range of "test" numbers. However, the first 6 digits of a credit card number are the Issuer Identification Number (IIN) and are assigned to individual card issuers. It is likely that the IIN in the test numbers above are unused. I would guess, for example, that you could use any 16 digit number beginning with "411111" and it would be safe to use.

  • 1
    Yes, those are individual numbers that pass Luhn, but I'm curious about number ranges, so I can generate random numbers in that range. – Aaron Toponce Nov 30 '18 at 4:37
  • 1
    @AaronToponce I've added a thought to my answer about number ranges, but it is just speculation on my part. I don't have a source. – Ben Miller Nov 30 '18 at 5:16
  • Yeah. It's a standard I'm looking for, either set aside by the ABA, or an ANSI or ISO standard, that says something like: "xYYY YYxx xxxx xxxx" are reserved sample ranges for YYYY1 through YY999", or something similar. – Aaron Toponce Nov 30 '18 at 5:38
  • 2
    Some merchant gateways I've seen support a bunch of test card numbers, where each one fails for a specified reason. But there isn't any One True Range Of Example Card Numbers that I've ever heard of, and for various reasons, such a range wouldn't be useful for much. One of those reasons: fake numbers don't even need to pass a Luhn check, so 90% of the range already works for 555-like purposes. – cHao Nov 30 '18 at 14:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .