Skip to main content
Premier SEO Services

Generators and utilities

Test Credit Card Number Generator

Generate Luhn-valid dummy card numbers with real network prefixes for testing form validation, and check any number's Luhn checksum. They aren't real cards and can't be used to pay.

  • Runs in your browser
  • Free, no sign-up
  • Unlimited use
  • Updated 30 September 2026

Test Card Number Generator

Set the options, then copy or download the result

  • For testing form validation only. The numbers are random digits with a valid checksum: they have no expiry date, security code or account, and gateways decline them.
  • To test real payment flows, use your payment provider's sandbox and its official test cards.

How to use the test card number generator

  1. 1Choose a Card network (prefix) and the Quantity.
  2. 2Press Generate numbers. Untick Group digits with spaces to get plain digits.
  3. 3Press Copy all, CSV or JSON to use them in your tests.
  4. 4Paste any number into the Luhn validator to check its checksum and prefix.

Three Visa-prefix test numbers (one run) and a validator check

Input
Visa · Quantity 3
Validator: 4242 4242 4242 4242 and 4242 4242 4242 4243
Output
4387 7257 9634 3223
4233 7923 1759 8624
4004 5766 3281 2803
4242 4242 4242 4242 passes (Visa prefix, 16 digits)
4242 4242 4242 4243 fails: the last digit would need to be 2

What these numbers are and aren't

These are test numbers: a network prefix followed by random digits and a check digit, so they pass the same Luhn check that payment forms run before submitting. They're useful for testing input masks, card-type detection, validation messages and database fields.

They aren't issued by any bank, have no expiry date or security code, and aren't linked to an account. A payment gateway will decline them at authorization. Using made-up numbers to obtain goods, services or free trials is fraud in most countries; this page is for software testing only.

How the Luhn check works

The Luhn algorithm (ISO/IEC 7812-1) catches single-digit typos and most swapped neighbors:

  1. Starting from the right, double every second digit (the check digit itself is not doubled).
  2. If doubling gives more than 9, subtract 9.
  3. Add all the digits. The number is valid when the total is a multiple of 10.

For 4242 4242 4242 4242 the total is 80, so it passes; change the last digit to 3 and the total is 81, so it fails. The generator works backwards: it picks every digit except the last, then chooses the last digit that makes the total a multiple of 10.

Card prefixes by network

The first digits (the IIN or BIN) identify the network and card length:

NetworkPrefixLength
Visa416
Mastercard51–55, 2221–272016
American Express34, 3715
Discover6011, 644–649, 6516
JCB3528–358916
Diners Club International3614
UnionPay6216

Some networks also issue other lengths (Visa 13 or 19 digits, for example). Make your form accept 12 to 19 digits and rely on the gateway for the final check.

Use your gateway's official test cards

To test payments end to end (authorization, 3-D Secure, declines, refunds), use the sandbox and published test cards from your provider. Stripe documents numbers such as 4242 4242 4242 4242 with outcomes for each, and PayPal's sandbox has its own card generator. Those numbers trigger predictable responses in test mode and are rejected in live mode.

Never use real customer card numbers in test environments; PCI DSS requires that live card data stays out of development and testing.

Is anything I enter stored?

This tool runs entirely in your browser. Your text is not uploaded to our servers.

Sources

Questions about the test card number generator

Can these numbers be used to buy things?

No. They aren't connected to any account and have no expiry date or security code, so authorization fails. They're for checking that your forms validate input correctly.

Why do payment gateways reject them?

Gateways ask the issuing bank to authorize each payment. No bank issued these numbers, so the request is declined. In test mode, gateways accept only their own published test cards.

Where are Stripe or PayPal test cards?

In their developer documentation: Stripe's testing guide lists cards by brand and outcome, and PayPal's sandbox card testing page generates test cards for its sandbox.

Last updated 30 September 2026Maintained by Premier SEO Services

Report a problem