Skip to content

Test card number generator. Luhn-valid, never chargeable.

For developer & QA testing only. These numbers are mathematically valid, they pass the Luhn checksum and use real brand prefixes, but they are NOT real cards: they aren't linked to any account, can't make purchases, and can't be charged. That checksum-and-prefix similarity is exactly why payment sandboxes and test gateways accept them for form validation. Using generated numbers for real transactions is fraud, and it won't work anyway.

5

Generated entirely in your browser, nothing is sent anywhere or stored.

Why do these numbers “work” in test forms?

Card forms usually validate three things before talking to a bank: the brand prefix (IIN, Visa starts with 4, Amex with 34/37), the length (15 for Amex, 14 for Diners, 16 for most), and the Luhn checksum, a mod-10 check digit invented in 1954 to catch typos. This tool generates numbers that satisfy all three, which is why sandboxes and front-end validators accept them. A real charge still requires an issuing bank to recognize the account, which these numbers don't have. Free forever, runs offline once loaded.

§ · written guide

How to use the Test Card Number Generator

This tool makes fake card numbers for testing payment forms, and checks any number you paste. Each number starts with a real brand prefix, has the right length for that brand and ends in a check digit that passes the Luhn checksum, so form validators accept it. The numbers are not linked to any account and cannot be charged. It is for developers and QA testers filling checkout forms, fixtures and test suites.

Step by step

  1. Pick the brand and length

    On the Generate tab, choose a card network from Brand. Visa is the default. Then choose a Length: Visa offers 16, 13 or 19 digits, Amex is always 15 and Diners Club offers 14, 16 or 19. Mixed (random brands) picks a brand for each number and uses each brand's standard length.

  2. Choose formatting and count

    Set Formatting to spaces, dashes or none. Amex numbers are grouped 4, 6 and 5, and 14 digit Diners numbers 4, 6 and 4; the rest are grouped in fours. Drag How many to make between 1 and 100 numbers. The default is 5.

  3. Add the extra fields

    Future expiry (MM/YY) and CVV (3 digits, 4 for Amex) are ticked by default. Tick Fake holder name to add a made up first and last name. Untick anything your form does not need.

  4. Generate the numbers

    Press Generate. The list shows the brand, the number and the extras on each line. Five Visa numbers are already there when the page opens. Use the copy icon at the end of a line to copy just that line.

  5. Copy or export the batch

    Press Copy all for every line as text, CSV to download test-card-numbers.csv, or JSON to download test-card-numbers.json. Both files hold the unformatted number, and the JSON also holds the formatted one and a note that the numbers are for testing only.

  6. Check numbers you already have

    Open the Validate tab and paste numbers into Paste card number(s), one per line. Spaces and dashes are ignored. Results update as you type. Press Copy results to copy one line per number with its brand, Luhn verdict and length.

Reading the validator

  • Each line gets a brand chip worked out from the opening digits, for example 4 for Visa, 34 or 37 for American Express and 51 to 55 or 2221 to 2720 for Mastercard. An amber unknown brand chip means no supported prefix matched.
  • The Luhn chip says valid or invalid. Invalid usually means a typo, because one wrong digit, or most swaps of two neighboring digits, breaks the checksum.
  • The length chip shows the digit count. If it is not a length that brand uses, it adds atypical in amber, for example a 15 digit number that starts with 4.
  • A line with fewer than 8 or more than 19 digits is marked not a card number. The summary above the list counts how many lines were checked, passed and failed.

Tips and common mistakes

  • Use these numbers to test input masks, length rules, brand icons and Luhn checks in your own forms. For a test payment that has to go through, use the test card numbers your payment provider publishes for its sandbox.
  • Expiry dates are always one to four years ahead, so they pass a not expired check. Type a past date by hand when you need to test the expired path.
  • Use Mixed (random brands) to check that your form switches the card logo and the CVV length correctly between brands.
  • A pass in the validator only means the number is well formed. It says nothing about whether a real account exists.

Privacy and limits

Numbers are generated and checked in your browser with plain JavaScript. Nothing you generate or paste is sent anywhere or saved, and a reload clears the list. These are test numbers only: they cannot buy anything, and trying to use one for a real payment is fraud.

Back to the tool

§ 02 · what you can do

Complete test data, zero risk.

  • Generate test numbers for 6 major brands, Visa, Mastercard, American Express, Discover, JCB and Diners Club, with correct IIN prefixes and lengths, or a mixed random batch.
  • Pick the digit length per brand (e.g. Visa 13/16/19) and format numbers with spaces, dashes, or no separator.
  • Create 1 to 100 at once with optional future expiry dates, CVVs (4-digit for Amex) and fake holder names to fill every payment-form field.
  • Copy line by line or all at once, or export the batch as CSV or JSON for test suites, fixtures and CI pipelines.
  • Validate any card number, live Luhn check, automatic brand detection and a length-sanity flag, one number per line.
  • Private by construction: generation and validation run entirely on your device; nothing is uploaded or stored.
§ 04 · faq

Frequently asked questions.

Are these real credit card numbers?
No. They are mathematically valid, correct brand prefix, length and Luhn checksum, but they aren't linked to any bank account, can't make purchases and can't be charged. They exist purely for developer and QA testing; attempting to use one for a real transaction is fraud and will fail anyway.
Is the Test Card Number Generator free?
Yes, completely free for everyone. No sign-up, no account and no usage limits.
Is it private? Are the numbers uploaded anywhere?
No upload, ever. Generation and validation both run entirely in your browser on your own device, numbers you generate or paste never leave your computer and nothing is stored.
Why do the numbers pass checkout form validation?
Payment forms typically check three things before contacting a bank: the brand prefix (IIN), the number length, and the Luhn mod-10 checksum. Generated numbers satisfy all three, so sandboxes and front-end validators accept them, but a real charge still needs an issuing bank to recognize the account, which these numbers don't have.
Can I validate a card number without generating one?
Yes. Switch to the Validate tab and paste one or more numbers, one per line. Each line gets a live Luhn verdict, detected brand and a length check, plus a summary count, and you can copy the full results.
Does it work offline?
Yes, once the page has loaded, generating, validating and exporting all run locally in your browser, so the tool keeps working without a connection.

Published · Last updated .

Priya sent you a message Online now

Talk to a Developer Now

Share your name and email to reply.

Reply