Skip to content
Developer & Security

Test Credit Card Number Generator

Generate Luhn-valid test card numbers for Visa, Mastercard, American Express, Discover, JCB and Diners Club — with expiry date and CVV — to test payment forms.

  • 100% free
  • Runs in your browser
  • No sign-up
  • CSV · JSON · TXT export
Options

Tip: press Enter or Space to generate again.

Ready

What is the Test Credit Card Number Generator?

Every number uses the correct issuer prefix (IIN) and length for its network and ends with a valid Luhn check digit, so it passes the client-side checks in checkout forms. The numbers are not connected to any bank account and will be declined by any real payment processor.

Tip: for end-to-end tests against Stripe, Braintree or Adyen sandboxes, use the official test cards those providers publish — they trigger specific success and failure scenarios.

The first six to eight digits of a card form the Issuer Identification Number (IIN), often called the BIN, which tells systems which network and bank issued the card. Visa numbers start with 4; Mastercard with 51–55 or 2221–2720; American Express with 34 or 37; JCB with 3528–3589; Discover with 6011 or 65, among other ranges. Lengths differ too: American Express uses 15 digits and a four-digit security code on the front, while most other cards use 16 digits and a three-digit code on the back.

How to use the Test Credit Card Number Generator

  1. Adjust the options above to match what you need.
  2. Press Generate (or hit Enter / Space) to create fresh results instantly.
  3. Click any result to copy it, or use Copy all.
  4. Download everything as CSV, JSON or TXT, or share a link with your settings.

Popular uses

  • Front-end validation — test card-type detection, formatting and Luhn checks.
  • QA automation — feed Cypress/Playwright tests with varied card numbers.
  • UI design — show realistic cards in wallet and checkout mock-ups.
  • Education — learn how the Luhn algorithm and IIN ranges work.

Why use RandNow?

  • Instant & unlimited — no sign-up, no daily caps.
  • Private by design — results are generated in your browser, not on our servers.
  • Export-ready — copy, CSV, JSON and TXT downloads built in.
  • Cryptographically random — powered by the Web Crypto API.

How the Luhn algorithm works

Starting from the rightmost digit and moving left, every second digit is doubled; if doubling gives a number above 9, subtract 9. Add all digits together — a valid card number’s total is divisible by 10. The final digit (the check digit) is chosen to make this true.

What a good payment-form test covers

Beyond the Luhn check, confirm that your form detects the network as the user types and switches the card logo, groups digits correctly (4-6-5 for American Express, 4-4-4-4 for most others), accepts a four-digit CVV only for Amex and rejects expiry dates in the past. Paste numbers with spaces and dashes to check normalisation. Never log or store full card numbers, even in test environments, so your code follows good PCI DSS habits from day one. These numbers are for testing only — using them to deceive a merchant is fraud. Press Generate to create a fresh set for your next test run.

Frequently asked questions

Can these cards be used to buy things?

No. They have no account, balance or real expiry/CVV pairing. Any payment processor will decline them. Attempting fraud is a crime.

Why do they pass validation?

They use the right prefix and length and end with a valid Luhn check digit — exactly what client-side validators check.

Which card networks are supported?

Visa, Mastercard (including 2-series), American Express, Discover, JCB and Diners Club.

What is a BIN or IIN?

The Issuer Identification Number — the first six to eight digits of a card number. It identifies the card network and issuing bank, which is how forms detect the card type.

Should test card numbers appear in my logs?

No. Mask card numbers everywhere, showing at most the last four digits. Building that habit with test data keeps real numbers safe in production.

Need random data? Get it now.

Pick any of 144 generators, hit Generate and copy or export the results as CSV, JSON or TXT. No account, no limits, nothing stored.

Start generating — free