A practical test card guide
Build better checkout tests with the right card data.
Generate sample card details for interface mockups, formatting checks, and form validation. Learn when to use a random Luhn-valid number and when to reach for a gateway's official sandbox card.
Generate a test card
The Credit Card Generator creates synthetic card data for checkout layouts, tutorials, demos, automated form tests, and payment-field formatting. It starts with Visa. Select Generate new card to get a new number, future expiry, security code, sample cardholder, and sample billing address for your selected country.
The preview shows a card front with a chip, network logo, number, name, and expiry. Click it to flip to a security-code view. This is a simplified visual mockup, not a replica of a particular bank's card; American Express normally prints its four-digit code on the front.
Every field in Card details has a copy button. Copying a number removes visual spaces, so it is ready to paste into your test form. Generated names and billing details are sample data, not verified customer identities.
Choose a country
Choose United States, United Kingdom, Canada, Australia, Germany, or France in Country. Each preset generates sample names and a matching street, city, region, country, and postal-code format. Names are fictional combinations; addresses are sample fixtures, not verified residences.
Address display follows local conventions: UK postcodes appear beneath the city, Canadian addresses use province abbreviations and alphanumeric postal codes, Australian addresses use state abbreviations and four-digit postcodes, and German and French addresses place the five-digit postcode before the city.
The country presets provide these common local credit-card networks:
| Country | Available network presets |
|---|---|
| United States | Visa, Mastercard, American Express, Discover |
| United Kingdom | Visa, Mastercard, American Express |
| Canada | Visa, Mastercard, American Express |
| Australia | Visa, Mastercard, American Express |
| Germany | Visa, Mastercard, American Express |
| France | Visa, Mastercard, American Express |
This is a curated set of common domestic credit-card presets, not an exhaustive list of merchant acceptance or issuing banks. Foreign cards may be accepted in countries where the tool does not offer that network. Retired debit schemes and domestic networks not implemented here are not listed.
Changing country immediately generates fresh local details and clears the previous custom BIN. It retains the selected network if available in the new preset; otherwise it switches to Visa. The network buttons, recent-card list, and official sandbox table follow the chosen country. Selecting a country does not verify that the generated BIN was issued there: generated numbers still use network-level prefix rules.
Choose a network and BIN
Choose one of the networks available for your selected country. Changing the network immediately generates a new card and clears the previous custom prefix.
| Network | Generated number length | Security-code length |
|---|---|---|
| Visa | 16 digits | 3 digits |
| Mastercard | 16 digits | 3 digits |
| American Express | 15 digits | 4 digits |
| Discover | 16 digits | 3 digits |
These are the formats generated by this tool. Some networks support additional lengths or issuer ranges. The About panel shows the supported prefixes for the selected network; it is not a live issuer database.
A BIN or IIN is the identifying prefix at the beginning of a card number, commonly six or eight digits. Custom BIN generator also accepts shorter prefixes, from one to eight digits, so you can test an entire family of numbers. For example, choose Visa and enter 411111. The remaining digits are randomized and the last digit is calculated to satisfy Luhn.
The prefix must match the selected network. A prefix starting with 4 will not generate a Mastercard. The tool displays a validation message instead of silently changing the network. Once a custom prefix is active, Generate new card keeps it. Choose Reset prefix to return to that network's normal ranges.
The generator uses browser randomness for digits and chooses an expiry between six and sixty calendar months in the future. It does not look up an issuing bank, account, balance, or cardholder.
Understand the Luhn check
Luhn is a checksum that catches many common data-entry errors. Starting from the rightmost digit, it doubles every second digit, subtracts nine from results above nine, and adds everything together. A valid checksum has a total divisible by ten.
The generator chooses the final digit to make that check pass. A Luhn-valid number is useful for client-side form validation and formatting tests, but it does not prove that a card was issued, is active, belongs to anyone, or can make a payment. Expiry dates and CVVs here are generated placeholders, not verified payment credentials.
All currently selectable networks in this tool use Luhn. This tool is not a payment authorization service or a live-card checker.
Copy and export test data
Choose JSON, XML, CSV, or PIPE above the data panel. The preview updates to the selected format. The copy icon copies the complete data, and the download icon saves it as a file.
Exports include the card number, network, expiry, security code, name, sample address, ISO country code (US, GB, CA, AU, DE, or FR), custom prefix when used, a synthetic-test-data marker, and creation time. JSON and XML preserve the address structure; CSV and PIPE use flat address columns.
- JSON: readable structured data for fixtures and application tests.
- XML: escaped values inside a card element.
- CSV: a header row and quoted values, suitable for importing into test datasets.
- PIPE: a header and a pipe-delimited row; backslashes, pipes, and newlines are escaped.
Card numbers and security codes are text identifiers. When importing CSV into a spreadsheet, choose Text for those columns to retain leading zeroes and avoid number rounding. CSV exports quote fields and protect against spreadsheet formula prefixes.
Keyboard shortcuts are Alt + G to generate and Alt + C to copy the current number. They do not activate while you type into a form field. If your browser reserves a shortcut, use the corresponding button.
The downloads contain data, not a card image. This tool does not currently export the visual preview as PNG or PDF.
Use official sandbox cards
For an actual test-mode payment request, use the payment gateway's published test values. Randomly generated numbers can pass your local form validator and still be rejected by the gateway.
The Official payment gateway test cards table above contains numbers published in Stripe's testing documentation, including 4242 4242 4242 4242 for Visa. The table filters by the selected country’s available network presets; these gateway fixtures do not become local issuer numbers when you change country. Stripe documents these with any future expiration date and any three-digit CVC, or four digits for American Express. Use your Stripe test environment and test API keys; these examples are not for live payments.
Other gateways, including PayPal, Adyen, and Braintree, have their own sandbox instructions. Do not assume that a Stripe test number behaves the same way elsewhere. Additional authentication, declines, and special test scenarios require the specific examples from the gateway's documentation.
Manage recent cards
Recent cards keeps your latest twelve generated cards across all countries and shows the supported cards for the currently selected country. Click a visible card to load it into the preview, copy its number, or export that country’s visible list as CSV. Clear all removes saved history for every country. Clearing history leaves the currently displayed card available for the rest of your visit.
Saved records include their country. Reloading restores the latest supported card and its country. Existing records from before country selection are treated as US sample data; records outside a country’s current network presets remain stored but are not shown in its list. History is stored in this browser using local storage. It does not sync across devices or accounts. If storage is blocked or full, the tool reports that history stays in memory. You can still copy or download your data.
Generation, checksum calculations, and file creation happen in your browser. Card details are not sent to a payment provider, a Fake Generator account, or an application database. See the privacy policy for hosting and analytics details.
Common questions
Is the credit card generator free?
Yes. Generate test data, copy fields, and download files without signing up.
Can the generated numbers make purchases?
No payment capability is created or verified. These are synthetic test values, not payment credentials. Use your own legitimate payment method for real purchases and official gateway fixtures for sandbox transactions.
Can I generate Visa or Mastercard numbers with a chosen prefix?
Yes. Select the network, enter a compatible prefix of one to eight digits, and choose Generate in the Custom BIN section. The tool preserves that prefix and calculates the final Luhn digit.
Does a custom BIN identify a real bank?
This generator only checks supported prefix ranges. It does not query bank records, verify that a BIN is assigned, or identify an issuer.
Why is a generated card rejected in test mode?
Payment gateways generally require their own published test numbers. Passing Luhn is a formatting check, not a promise that the gateway will accept the number. Use the official table and check your gateway's documentation.
Can I recover a card after clearing history?
Cleared history is removed from browser storage when storage access is available. The current card remains visible until you leave or generate another one, and downloaded files remain on your device. There is no server copy to restore.
For related mockups, try the Free Receipt Generator, Fake MRR Generator, or Fake Gmail Generator.