Test Credit Card Numbers Explained: Luhn Check and Safe Use

Test Credit Card Numbers Explained: Luhn Check and Safe Use

Test credit card numbers have the right length and prefix and pass the Luhn checksum, so payment forms accept their format – but they are not linked to any bank account and cannot buy anything. Use them for form validation and QA, and use your payment provider's official sandbox numbers for real checkout tests.

Test Credit Card Numbers Explained: Luhn Check and Safe Use

Key facts

  • Format-valid numbers that pass the Luhn check – not real cards
  • Generator: Visa, Mastercard, Amex, Discover, JCB · expiry · optional CVV · 5–50 numbers
  • For checkout tests use the provider's official sandbox cards
  • Using generated numbers to pay is fraud

What a card number contains

What a card number contains
PartMeaningExample
First digit(s)Card network (IIN)4 = Visa, 51–55 / 2221–2720 = Mastercard, 34/37 = Amex
Middle digitsIssuer and account numberVaries
Last digitLuhn check digitMakes the checksum work
LengthDepends on network16 for most Visa/Mastercard, 15 for Amex

The Luhn check by hand

The Luhn check by hand

Number: 4539 1488 0343 6467
1) Starting from the second digit from the right, double every other digit: 6→12, 6→12, 4→8, 0→0, 8→16, 1→2, 3→6, 4→8
2) Subtract 9 from results over 9: 12→3, 12→3, 16→7
3) Add all digits: total = 80
4) 80 ends in 0 → passes the Luhn check

🧪 If one digit is mistyped, the total no longer ends in 0, so the form can warn the user before anything is sent to the bank.

Generate test numbers – step by step

Generate test numbers – step by step
  1. Open the Credit Card Generator.
  2. Choose the card type (or random), expiry month and year, and an optional CVV.
  3. Pick how many numbers you need (5–50).
  4. Generate and copy them into your test forms.

Correct uses

  • Testing that a form accepts valid formats and rejects typos.
  • Checking how your UI shows Visa, Mastercard or Amex logos.
  • Filling demo screens and screenshots.
  • Teaching how checksums work.

Never

  • Try them on real shops, subscriptions or free trials.
  • Use them to pass identity or age checks.
  • Share them as "working cards" – that misleads people and may be illegal.
Try the free Credit Card Generator now

Open the Credit Card Generator on pdfseotools.com – free, no sign-up and it works on any device.

Open Credit Card Generator →

Questions fréquentes

Are generated card numbers real cards?

No. They follow the correct format and pass the Luhn check, but no bank issued them, there is no money behind them and they cannot be used to pay.

What is the Luhn check?

A simple checksum that catches typing mistakes in card numbers. Payment forms run it before sending a number to the bank.

Which card types can the generator create?

Visa, Mastercard, American Express, Discover and JCB, with an expiry month and year, an optional CVV and 5 to 50 numbers at a time.

Can I use them in Stripe, Razorpay or PayPal test mode?

Use the official test card numbers published by your payment provider – sandboxes often accept only those specific numbers.

Is it illegal to generate test numbers?

Generating format-valid numbers for testing is legal. Trying to buy anything with them, or using them to get free trials, is fraud.

Why does a shop reject them?

Because the bank finds no such account. The Luhn check only confirms the format, not that a card exists.

Summary

Right format, valid checksum, no bank account – perfect for testing, useless for paying. Create numbers with the Credit Card Generator and see more free test data tools.


Partager sur les réseaux sociaux :