Skip to content

Test Credit Card Number Generator

Create up to 20 Luhn-valid dummy card numbers for Visa, Mastercard, American Express or Discover to test how a payment form validates its input. None of them can pay for anything.

Runs in your browserFree, no sign-upLast reviewed

Settings

Fill in the settings to see your result here.

Your result appears here instantly — nothing is uploaded.

Quick answers

Do fake credit card numbers work for purchases?
No. A generated number only has the right prefix, length and check digit. It is not issued by any bank, so an authorisation request is declined. Knowingly trying to pay with a made-up card number can be treated as fraud, whether or not it goes through.
What is a Luhn-valid card number?
A number whose digits pass the Luhn checksum: double every second digit from the right, subtract 9 from any result over 9, add everything up, and the total must be divisible by 10. It proves the number is well formed, not that a card exists.
What is the test credit card number for Visa?
The most widely documented Visa test number is 4242 4242 4242 4242, used in Stripe's test mode with any 3-digit CVC and any future expiry date. For form validation alone, any Luhn-valid 16-digit number starting with 4 behaves the same.
Can I use generated card numbers in Stripe or PayPal test mode?
Usually not. Sandboxes respond only to the specific test cards listed in their own documentation and decline other numbers. Generated numbers are for the layer before the payment provider: your own form, validation code and card-brand detection.
How many digits are in a credit card number?
Visa, Mastercard and Discover cards normally have 16 digits and American Express has 15. The ISO/IEC 7812 standard allows up to 19 digits, and some Visa and Discover numbers are longer than 16.
Is it legal to generate fake credit card numbers?
Generating structurally valid numbers for software testing is common practice, and payment providers publish their own. It becomes illegal when a number is presented as real payment details, for example to get a free trial, goods or services.

Why use Fake Credit Card Number Generator

This tool makes card numbers that look right to a form and mean nothing to a bank. Each number starts with the chosen network's prefix, has the correct length (16 digits, or 15 for American Express) and ends in a check digit that satisfies the Luhn algorithm, so client-side validators accept it. You can add a random CVV of the right length and switch digit grouping on or off. The numbers are not linked to any account, so any real charge is declined, and they are not sandbox cards either: a payment provider's test mode normally accepts only that provider's own published numbers. Use these for input masks, brand detection, validation rules and demo screenshots.

Card number formats by network: prefix, length and CVV

The real numbering rules, and the subset this tool generates.

NetworkReal prefixesUsual lengthSecurity codeWhat this tool generates
Visa416 digits3 digitsStarts with 4, 16 digits, grouped 4-4-4-4
Mastercard51 to 55 and 2221 to 272016 digits3 digitsStarts with 51 to 55 only, 16 digits, grouped 4-4-4-4
American Express34 and 3715 digits4 digitsStarts with 34 or 37, 15 digits, grouped 4-6-5
Discover6011, 644 to 649 and 6516 digits3 digitsStarts with 6011 only, 16 digits, grouped 4-4-4-4

Mastercard 2-series numbers, 19-digit numbers and other networks such as JCB, Diners Club and UnionPay are not generated.

Sample Luhn-valid test numbers from the tool

Real output from single runs. Every one passes the Luhn check and none is a working card. Your own results will differ each time you press Generate.

Visa with CVV

Card network: Visa, Include a CVV: on, Group digits with spaces: on

4348 5307 9849 8969 | CVV 243 4867 7640 3271 2064 | CVV 932

Mastercard with CVV

Card network: Mastercard, Include a CVV: on, Group digits with spaces: on

5534 8530 7984 9895 | CVV 624 5278 6776 4032 7127 | CVV 069

A CVV can start with zero, so store it as text, not as a number.

American Express, 15 digits and a 4-digit code

Card network: American Express, Include a CVV: on, Group digits with spaces: on

3734 853079 84981 | CVV 9624 3478 677640 32714 | CVV 2069

Discover with CVV

Card network: Discover, Include a CVV: on, Group digits with spaces: on

6011 3485 3079 8492 | CVV 896 6011 4378 6776 4035 | CVV 271

Plain digits for a test fixture

Card network: Visa, Include a CVV: off, Group digits with spaces: off

4348530798498969 4437867764032717

How the Luhn check digit is calculated

check digit = (10 - (sum of the processed digits mod 10)) mod 10

Take every digit except the last. Starting from the right-hand end of that string, double every second digit, beginning with the rightmost one. If doubling gives a number above 9, subtract 9. Add the processed digits together, and choose the final digit that brings the grand total to a multiple of 10. Worked example with 4348 5307 9849 8969. The first 15 digits are 4 3 4 8 5 3 0 7 9 8 4 9 8 9 6. Doubling every second digit from the right turns them into 8 3 8 8 1 3 0 7 9 8 8 9 7 9 3, which add up to 91. The next multiple of 10 is 100, so the check digit is 9. Change that last digit to 8 and the total becomes 99, so 4348 5307 9849 8968 fails validation. The method was devised by IBM engineer Hans Peter Luhn, whose patent was granted in 1960. It catches any single mistyped digit and most swaps of two neighbouring digits. It is an error check, not a security feature.

Published sandbox test cards (Stripe test mode)

If you are testing against a payment provider's sandbox, use the numbers from that provider's documentation. These are the basic success cards listed in Stripe's testing guide; they accept any future expiry date.

BrandTest numberCVC
Visa4242 4242 4242 4242Any 3 digits
Mastercard5555 5555 5555 4444Any 3 digits
Mastercard (2-series)2223 0031 2200 3222Any 3 digits
American Express3782 822463 10005Any 4 digits
Discover6011 1111 1111 1117Any 3 digits

These work only with Stripe test API keys. Other providers publish their own lists, so check the documentation for the one you use.

What generated numbers can and cannot test

  • Can test: Luhn validation in your own form or back-end code, including that a one-digit typo is rejected.
  • Can test: card-brand detection from the first digits, and switching the logo, number mask and CVV length for American Express.
  • Can test: input formatting, such as automatic spacing, paste handling and maximum length.
  • Can test: demo screens, training material and screenshots that must not show a real card.
  • Cannot test: authorisation, declines, 3D Secure, refunds or anything that needs a response from a payment provider. Use the provider's sandbox cards for those.
  • Cannot test: expiry date handling with generated data, because the tool does not produce an expiry date. Enter any future month and year by hand.

How to use it

  1. 1

    Choose a Card network: Visa, Mastercard, American Express or Discover.

  2. 2

    Set How many numbers you want, from 1 to 20.

  3. 3

    Tick Include a CVV to add a random 3-digit code, or 4 digits for American Express.

  4. 4

    Tick Group digits with spaces for 4-4-4-4 display (4-6-5 for American Express), or untick it for plain digits.

  5. 5

    Press Generate, then copy the Plain text list or download fake-credit-cards.txt.

Frequently asked questions

Why does my checkout form accept a generated number?
Most forms check three things in the browser: the prefix, the length and the Luhn digit. Generated numbers satisfy all three. Whether a card really exists is decided later, when the payment provider asks the card network and issuing bank, and that step rejects them.
Does the generator create an expiry date or cardholder name?
No. It outputs the card number and, if you tick the box, a random CVV. For a form that also needs an expiry date, type any month and year in the future. For a name, any placeholder text will do.
Is the CVV calculated from the card number?
No. On a real card the security code is derived by the issuer using secret keys, so it cannot be worked out from the number. The CVV here is simply random digits of the right length: three, or four for American Express.
Could a generated number match someone's real card?
It is possible by chance, since real cards use the same prefixes and pass the same checksum. A number alone is not enough to pay with: the expiry date, security code and often the billing address must match too. Never try a generated number on a live payment page.
Can I use one to start a free trial without my real card?
No. Free-trial forms run a real authorisation or card check, which fails for an unissued number, and giving false payment details to obtain a service is fraud. If you do not want to share your main card, ask your bank about virtual card numbers.
What are the first digits of a card number called?
The first digit is the major industry identifier, and the first six to eight digits are the issuer identification number (IIN), often still called the BIN. They identify the network and the issuing bank. This tool uses only network-level prefixes, not any particular bank's range.
How many numbers can I generate, and are they saved?
Up to 20 per run, for one network at a time. They are created in your browser and are not uploaded or stored. Press Generate again for a new set, and download the text file if you need to keep one.

Looking for something else? Browse all generators or see every tool.