Free Credit Card Generator for Testing
Create synthetic, Luhn-valid card numbers for Visa, Mastercard, American Express, Discover, JCB, Diners Club and UnionPay, with optional expiry dates, security codes and fictional names. Built for developers and QA testers checking payment forms. Everything is generated in your browser.
Synthetic test data only. These numbers are not real payment cards and cannot be used for purchases.
•••• •••• •••• ••••
Name
FICTIONAL NAME
Expires
MM/YY
Code
•••
Pick a network and press Generate test data. Records appear here.
How to Use the Credit Card Generator
- Choose a card network, or Random to mix all seven.
- Choose how many records you need: 1, 5, 10 or 20, or type any number up to 50.
- Tick the optional fields you want: a future expiry date, a security code and a fictional name.
- Select Generate test data (or press G).
- Copy a single value, copy a whole record, or download the batch as CSV or JSON.
- Use the results in development and test environments, such as form validation and UI tests, never for payments.
What Is a Test Credit Card Number?
A test credit card number is a made-up number that follows the same structural rules as real card numbers, so software can be tested without using anyone’s real details. Those rules are public:
- Prefix. The first digits indicate the card network. Every Visa number starts with 4, for example, and American Express numbers start with 34 or 37.
- Length. Each network uses particular lengths, such as 16 digits for most Visa and Mastercard numbers and 15 for American Express.
- Check digit. The last digit is calculated with the Luhn algorithm so that the whole number passes a checksum.
A number that meets all three rules is well-formed. That’s all it is. Being well-formed doesn’t show that an account exists, and it doesn’t mean a payment would be authorised. Those decisions are made by the card issuer, not by the digits.
Supported Card Networks
The prefixes below are the ranges this tool generates from. They are a subset of the ranges recognised by Braintree’s open-source credit-card-type (opens in a new tab) library, which also supplies the lengths, spacing and security-code details. Every generated number is checked against that library before it’s shown.
| Network | Length generated | Other recognised lengths | Prefixes used | Security code |
|---|---|---|---|---|
| Visa | 16 digits | 18, 19 | Starts with 4 | 3 digits (CVV) |
| Mastercard | 16 digits | – | 51–55 or 2221–2720 | 3 digits (CVC) |
| American Express | 15 digits | – | 34 or 37 | 4 digits (CID) |
| Discover | 16 digits | 19 | 6011, 644–649 or 65 | 3 digits (CID) |
| JCB | 16 digits | 17, 18, 19 | 3528–3589 | 3 digits (CVV) |
| Diners Club | 14 digits | 16, 19 | 300–305, 36, 38 or 39 | 3 digits (CVV) |
| UnionPay | 16 digits | 14, 15, 17, 18, 19 | 62 (selected ranges) | 3 digits (CVN) |
The network tells you nothing about whether a card is credit, debit or prepaid, or which bank issued it. This tool doesn’t generate or label those attributes.
How the Luhn Algorithm Works
The Luhn (or “mod 10”) check catches most single-digit typos and swapped neighbouring digits. To check a number:
- Start from the rightmost digit and move left.
- Double every second digit, starting with the one just left of the check digit.
- If doubling gives a number greater than 9, subtract 9 (so 16 becomes 7).
- Add up all the digits, including the ones you didn’t double.
- If the total is divisible by 10, the number passes.
Worked example
To find the check digit for 7992739871, double every second digit starting from the right-hand end (it will sit next to the check digit):
| Digit | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
|---|---|---|---|---|---|---|---|---|---|---|
| Original | 7 | 9 | 9 | 2 | 7 | 3 | 9 | 8 | 7 | 1 |
| Doubled? | No | Yes | No | Yes | No | Yes | No | Yes | No | Yes |
| Value | 7 | 9 | 9 | 4 | 7 | 6 | 9 | 7 | 7 | 2 |
The values add up to 67. The check digit is whatever brings the total to the next multiple of 10: 3, giving 79927398713, which passes the check. This example is verified by the tool’s automated tests.
Common Use Cases
- Payment form formatting: checking that numbers group correctly as people type, including Amex’s 4-6-5 pattern.
- Front-end validation: testing that forms accept well-formed numbers and reject wrong lengths or failed checksums.
- Checkout UI development: filling realistic-looking data into designs and prototypes.
- QA fixtures: exporting CSV or JSON records for test suites and seed data.
- Automated form tests: feeding varied networks and lengths into end-to-end tests.
- Network detection: confirming that your form shows the right network as digits are entered.
For testing the payment itself, such as authorisations, declines, 3-D Secure or refunds, use your payment provider’s sandbox and its published test cards. Stripe, for example, documents specific test card numbers for its testing environments and asks that real card details are never used for testing (Stripe Docs (opens in a new tab)).
Privacy: Browser-Based Generation
Here is exactly what happens when you use the generator:
- Numbers, expiry dates, security codes and names are created by JavaScript running in your browser, using its built-in secure random number generator.
- Copying uses your browser’s clipboard. CSV and JSON files are built in the browser and saved directly to your device.
- Generated values are not sent to our server or any other service, and they aren’t stored in cookies or local storage. The “Earlier this session” list lives only in the open page and disappears when you reload or leave.
As with any website, loading the page itself involves a normal request to our web server, which may record standard technical details such as the time and the page requested. That request happens before you generate anything and doesn’t contain generated data.
Important Limitations
Generated values:
- are not real payment credentials and aren’t linked to any bank account;
- say nothing about whether a card is active, has a balance or belongs to anyone;
- may pass a checksum but will still be declined by payment gateways;
- use random expiry dates, security codes and placeholder names that don’t correspond to any account;
- must not be used for purchases, sign-ups that require payment, or any unauthorised activity.
Frequently Asked Questions
What is a credit card generator?
It creates made-up card numbers that follow the same format rules as real ones: the right starting digits for a network, the right length and a valid Luhn check digit. Developers and testers use them to check that payment forms format and validate input correctly.
Are generated credit card numbers real?
No. They are random numbers built to pass a format check. They aren’t issued by any bank, aren’t linked to any account, and the expiry dates, security codes and names are random too.
Can I use generated numbers to make purchases?
No. A payment needs a real, active account approved by the issuer. Generated numbers aren’t connected to any account, so payments are declined, and attempting to use them to obtain goods or services may be illegal.
What does Luhn-valid mean?
It means the number passes the Luhn checksum, a simple formula that catches most typing mistakes. It’s a format check only: it doesn’t show that an account exists, is active or has funds.
Can I generate Visa, Mastercard, American Express and Discover test numbers?
Yes. The generator supports Visa, Mastercard, American Express, Discover, JCB, Diners Club and UnionPay, plus a Random option that mixes them.
Can I generate multiple test card numbers at once?
Yes. Choose 1, 5, 10 or 20, or enter any whole number up to 50 per batch.
Can I copy or export the generated results?
Yes. You can copy the number, expiry, security code or all details of any record, copy the whole batch, or download it as CSV or JSON. Files are created in your browser.
Does this tool send generated card data to a server?
No. Numbers are generated in your browser with JavaScript, and copying and downloading also happen locally. The generated values aren’t included in any network request.
Will generated numbers work in Stripe or PayPal test mode?
Don’t rely on them for that. Payment providers publish their own sandbox test cards that trigger specific results, such as a successful payment or a particular decline. Stripe, for example, asks you to use its listed test card numbers in its testing environments. Use the provider’s official test data for payment-flow testing.
What is the difference between a credit card and a debit card?
A credit card borrows from a credit line that you repay later; a debit card takes money directly from a bank account. You can’t tell which one a card is from the network or the number format alone, and this tool doesn’t label records as credit or debit.
Can I use this tool to test a payment form?
Yes, for the parts that run before a payment is attempted: input masks, number grouping, length and checksum validation, network detection, expiry and security-code fields. For the payment itself, use your provider’s sandbox and test cards.
Does a valid checksum mean a card is active?
No. The checksum only confirms the digits are internally consistent. Whether a card exists, is active or can be charged is decided by the issuer when a payment is authorised.
Sources
- Testing (test card numbers and sandbox guidance) – Stripe Docs (opens in a new tab)
- credit-card-type: card network patterns, lengths and security codes – Braintree (open source, MIT licence) (opens in a new tab)