Test card numbers

Eight card numbers that payment providers publish for testing, each with a correct Luhn check digit, and broken ones your payment form should refuse.

Where the numbers come from

A card column and qadg quick card only ever give one of eight numbers: two Visa, one Mastercard, two American Express, one Discover, one JCB and one UnionPay. At least two of Stripe, Braintree, Adyen and Checkout.com publish each of them as a test number. The program never makes up a number that merely passes the check digit, because such a number can be a real card.

A test number works in its provider’s test system. None of the four providers says that no bank has issued the same number to a real card, so treat these as test values and keep them out of production.

The check digit

The last digit is a Luhn check digit. Start at the digit just left of it and double every second digit going left. Where a doubled digit comes to 10 or more, add its two digits together. Add up everything, the check digit included. The number is correct when the total ends in 0.

For 4111111111111111, the eight doubled digits give 8 and seven 2s, which is 22. The other eight digits are all 1, which is 8, and 22 + 8 is 30.

Valid card numbers for your tests

terminal
$ qadg quick card --count 5 --seed example
4242424242424242
378282246310005
5555555555554444
5555555555554444
4242424242424242

With only eight numbers behind it, a longer list repeats them. --count 1000 gives a thousand lines drawn from the same eight.

What your form should do with a broken one

Refuse it before it reaches the payment provider. On these eight numbers a changed digit always fails the Luhn check, and so does swapping two different digits side by side, so your form can catch both.

Broken ones for your tests

The recipe below makes 100 values and asks for damage in 20% of the rows. Download it and run it as it is, then change the count or the share to fit your tests.

The recipe

test-card-numbers.yaml
# Card numbers for a payment form, with one broken value asked for in about a
# fifth of the rows.
#
# Every card number is one of the test numbers payment providers publish, never
# a number that only passes the check digit. The damage changes a digit or swaps
# two, and the manifest says your form should reject each one. It also lists the
# damage this build could not carry out, with the reason.
#
#   qadg generate test-card-numbers.yaml
#
# writes payment.csv, expectation-manifest.json and run-note.json. The same
# seed breaks the same values on every machine.
version: "0.1"
seed: "test-card-numbers"
locale: en-US
entities:
  payment:
    count: 100
    fields:
      card: { generator: card }
policy:
  layers: [L3]
  rows: 20%
  per_row: exactly_one
output:
  format: csv

Run it

Save the recipe, then run this in the same folder. This is what the program printed for it.

terminal
$ qadg generate test-card-numbers.yaml
       payment: 100 rows, 1 column
1 table, 100 rows written
18 defects ordered, 5 applied, manifest in expectation-manifest.json
13 defects could not be applied, and the manifest carries the reason for each one
  2 because this run lacks something they need, and the manifest says what for each one
  11 because this build has no implementation of them yet

What it damaged

The recipe ordered 18 defects, and this build applied the 5 below. The other 13 are in the manifest as not applied, each with its reason, and the run above counts them by reason.

L3.checksum.transposed_digitsreject

payment 5, column card

3530111333300000 → 5330111333300000

L3.checksum.off_by_onereject

payment 40, column card

4242424242424242 → 4242424242424243

L3.checksum.transposed_digitsreject

payment 42, column card

4242424242424242 → 4242442242424242

L3.checksum.off_by_onereject

payment 73, column card

3530111333300000 → 3530111333300001

L3.checksum.transposed_digitsreject

payment 77, column card

6243030000000001 → 6243300000000001

Sources

  • Test card numbers in the documentation of Stripe, Braintree, Adyen and Checkout.com, read on 2 November 2026.