Advertisement

8 card networks · 374,788 BINs · 90 IBAN countries

Credit Card Number Generator

Create Luhn-valid test card numbers with expiry date and CVV for any major brand or your own BIN. Built for developers and QA teams — the numbers are not real cards and cannot be used to pay.

Advertisement
Generated cards

Test data only — these numbers are not issued by any bank and every real payment with them will be declined.

Advertisement

Generated locally with your browser’s crypto API — nothing is sent to a server.

Visa format

Starts with
4
Length
13, 16, 19
Security code
3
Stripe
4242 4242 4242 4242
Visa generator
Advertisement

Check, look up, then test in the sandbox

The generator covers format testing. These tools cover the rest of a card-form test plan.

More free tools

Brand ranges at a glance

The prefixes and lengths your checkout must accept. Each brand has its own generator page.

Advertisement

From BIN to test fixture in three steps

  1. Choose a network

    Pick a brand, or enter a BIN or pattern such as 453201xxxx.

  2. Generate test cards

    Get Luhn-valid numbers with expiry date and CVV in one click.

  3. Copy or export

    Paste them into your form, or download CSV, JSON or XML.

For developers & QA

Test data that stays out of PCI scope

Use generated numbers for everything before the payment request, then switch to your gateway’s official sandbox cards for approvals, declines and 3-D Secure.

  • Test form validation & input masks
  • Seed staging databases and demos
  • Reproduce declines and 3-D Secure in the sandbox
Browse gateway test cards

Official sandbox cards, per gateway

All 18 gateways →

What is a test credit card number?

A test credit card number is a number that looks and behaves like a real card number in every check a website can run on its own — the right brand prefix, the right length and a correct check digit — but that no bank has ever issued. It is not linked to an account, a person or any money. Developers and testers use these numbers to check checkout forms, payment flows and databases without exposing real customer data.

The generator above builds each number the same way card networks do: it starts with a genuine issuer prefix (the IIN or BIN), fills the account digits at random with your browser's cryptographic random generator, and calculates the final digit with the Luhn algorithm. It then adds a random future expiry date and a security code of the right length for the brand. Everything happens on your device; nothing is sent to our server.

Not for payments. Generated numbers pass format validation only. A real purchase needs approval from the issuing bank, so any attempt to pay with them is declined — and using card details you are not authorized to use is a crime.

Card number format by brand

The first digits of a card number identify the network and issuing bank. This table lists the ranges the generator uses, so you can see what your validation code needs to accept.

BrandStarts with (IIN)LengthSecurity code
Visa416 (also 13 and 19)3-digit CVV2 on the back
Mastercard51–55 and 2221–2720163-digit CVC2 on the back
American Express34 and 37154-digit CID printed on the front
Discover6011, 644–649, 65 (and 622126–622925)16 (up to 19)3-digit CID on the back
JCB3528–358916 (up to 19)3-digit CAV2 on the back
Diners Club300–305, 36, 38–3914 (up to 19)3-digit code on the back
UnionPay6216–193-digit CVN2 on the back
Maestro5018, 5020, 5038, 5893, 6304, 6759, 6761–676312–193-digit code (optional on some cards)
Advertisement

How the Luhn check digit works

The Luhn algorithm (also called mod 10) was published by IBM engineer Hans Peter Luhn in the 1950s and is used by every major card brand to catch typing mistakes. Take the well-known test number 4111 1111 1111 1111:

  1. Starting from the rightmost digit, double every second digit (the highlighted ones in the table).
  2. If doubling gives a number above 9, subtract 9 (so 8 stays 8, but 7×2 = 14 becomes 5).
  3. Add up all the values. Here the total is 30.
  4. If the total ends in 0, the number is valid. 30 is a multiple of 10, so this number passes.
Digit4111111111111111
Doubled?8–2–2–2–2–2–2–2–
Value added8121212121212121

To generate a number, we do the same thing in reverse: fill every digit except the last, compute the sum, and choose the final digit that brings the total to the next multiple of 10. You can check any number step by step with our credit card validator.

How to use the generator

  1. Pick a brand — Visa, Mastercard, American Express, Discover, JCB, Diners Club, UnionPay or Maestro.
  2. Optionally enter a BIN or pattern. A 6–8 digit BIN creates numbers for a specific issuer range. Use x as a wildcard (for example 5425xxxxxxxx1234) to fix some digits; the generator keeps every digit you type and solves one wildcard so the number still passes Luhn.
  3. Choose quantity and details — up to 1,000 cards, a random or fixed expiry month and year, and a random or fixed CVV.
  4. Export — copy the list or download it as CSV, JSON, XML or pipe-separated text (number|mm|yyyy|cvv).

What developers use test card numbers for

Testing with a payment gateway

When you test a real payment integration in sandbox mode, use the gateway's own documented test cards. They are wired to return specific results such as approvals, declines or 3-D Secure challenges, which random numbers cannot do. Generated numbers are ideal for everything that happens before the request reaches the gateway. Official test card lists:

Frequently asked questions

Are these real credit card numbers?

No. The numbers follow the public format rules of each card network (prefix, length and Luhn check digit), but they are not linked to any bank account, cardholder or credit line. They exist only to test software.

Can I buy something or start a free trial with a generated card?

No. A real payment needs an authorization from the issuing bank, and no bank has issued these numbers, so every charge is declined. Trying to pay with a number you do not own is fraud. Use them only in sandboxes, forms and test data.

Why do the numbers pass card validation?

Most checkout forms only check the format: the brand prefix, the length and the Luhn checksum. Our numbers are built to satisfy those three rules, which is exactly what you need to test validation code. A payment gateway in live mode will still reject them.

Are the expiry date and CVV real?

They are random values in a realistic format: a future month/year and a 3-digit code (4 digits for American Express). You can also fix the month, year or CVV if your test case needs a specific value.

Can I generate cards from a specific BIN?

Yes. Type a BIN (the first 6–8 digits) in the BIN / pattern field. You can also use x as a wildcard, for example 453201xxxxxxxxxx. Every x is filled at random and the check digit is calculated so the result passes Luhn.

Which format should I export?

Use the pipe format (number|mm|yyyy|cvv) for quick copy-paste, CSV for spreadsheets and test fixtures, JSON for API mocks and unit tests, and XML for older integrations. You can generate up to 1,000 cards at once.

Related tools

Advertisement