Test card only

Credit Card Number Generator

Generate dummy card details for development and QA. Nothing is stored or sent to a server.

Card network
These numbers are dummy, Luhn-valid test values for software testing only. They are not real active cards and cannot be used for payments.

This Visa card generator produces Luhn-valid test Visa card numbers on the 4 prefix for payment form validation, checkout QA, and automated test fixtures. What follows is the part most tools in this category leave out: Visa’s actual format rules, why the 13/16/19-digit question breaks so many checkout forms, and where these numbers stop being useful.

Visa card number format

PropertyValue
Major Industry Identifier (first digit)4
IIN / BIN range4 — every Visa number begins with it
Standard length16 digits
Legacy length13 digits (older cards, still valid)
Extended length19 digits (some Visa Electron and co-branded products)
Check digitLuhn (mod 10)
Security code nameCVV2
Security code length3 digits

The 13/16/19-digit problem

A common validation bug is hard-coding Visa numbers to 16 digits. ISO/IEC 7812 permits a primary account number of up to 19 digits, and Visa has issued 13-digit numbers historically and 19-digit numbers on some products. If your form rejects anything that is not 16 digits, it will reject cards that are perfectly valid — and the cardholder has no way to work around it.

Test all three lengths. These are Luhn-valid and safe to paste into a test form:

13 digits   4222 2222 2222 2
16 digits   4539 1488 0343 6467
19 digits   4532 0151 1283 0366 187

The generator above emits the 16-digit form, which is what nearly every issued Visa card uses. For the two rarer lengths, use the numbers above, or construct your own — the checksum arithmetic is identical at any length.

Visa product types and their BIN ranges

Visa is a family of products, not one card, and their BIN characteristics differ:

  • Visa Classic / Credit — begins with 4, 16 digits, the default case
  • Visa Debit — also begins with 4; nothing in the number distinguishes it from credit
  • Visa Electron — issued on 4026, 417500, 4405, 4508, 4844, 4913, and 4917
  • Visa Purchasing / Corporate — separate commercial BIN ranges
  • V PAY — a Europe-only chip-and-PIN product, also on 4

You cannot tell whether a Visa number is credit or debit from the number alone. That information lives in the issuer’s BIN table, not in the digits. If your routing logic needs to know — to apply different interchange handling, or to block credit funding on a payout flow — you need a BIN lookup service. See the BIN and IIN guide for how those tables are structured, and the BIN lookup tool when it ships.

How this Visa card generator builds test numbers

Three steps, all in your browser:

  1. Prefix. The number starts with 4, Visa’s entire network prefix.
  2. Account body. The digits between the prefix and the final position are drawn from crypto.getRandomValues(), the browser’s cryptographically secure random source.
  3. Check digit. The last digit is computed so the whole number satisfies Luhn.

Worked through for a real Visa payload:

Partial number: 4539 1488 0343 646_

Step 1 — Double every second digit, from the rightmost payload digit leftwards:
4  5  3  9  1  4  8  8  0  3  4  3  6  4  6
×2    ×2    ×2    ×2    ×2    ×2    ×2    ×2
8  5  6  9  2  4 16  8  0  3  8  3 12  4 12

Step 2 — Subtract 9 from any result above 9:
8  5  6  9  2  4  7  8  0  3  8  3  3  4  3

Step 3 — Sum: 8+5+6+9+2+4+7+8+0+3+8+3+3+4+3 = 73

Step 4 — Check digit = (10 − (73 mod 10)) mod 10 = (10 − 3) mod 10 = 7

Result: 4539 1488 0343 6467

The full Luhn walkthrough lives in the guides.

Testing scenarios specific to Visa

These are the cases a Visa card generator is actually good for — each one exercises your own code rather than a processor’s.

Length flexibility. Feed the form all three lengths above and confirm each is accepted. This is the single highest-value test on this page.

Brand detection on the first keystroke. The Visa mark should appear as soon as the user types 4, not on blur and not after 16 digits. Visa is the one network where a single digit is enough to decide.

CVV2 field length. Three digits for Visa, four for American Express. If your CVV field is a fixed maxlength=3, Amex breaks; if it is fixed at 4, Visa accepts a code that is too long. The field has to react to the detected brand.

Input mask. Visa groups as 4444 4444 4444 4444 at 16 digits. At 19 the grouping runs 4444 4444 4444 4444 444, and at 13 it is 4444 4444 4444 4 — masks that assume four even groups mangle both.

Luhn rejection. Change the last digit of any generated number and confirm the form rejects it. A form that accepts both is not running the checksum.

BIN routing. If Visa traffic goes to a particular acquirer, generate a batch and confirm the routing table picks it up on the leading 4.

A brand-detection regex that handles every valid Visa length:

// Visa brand detection — matches all three valid Visa lengths
const VISA = /^4\d{12}(\d{3})?(\d{3})?$/;

const normalise = value => value.replace(/\D/g, '');

VISA.test(normalise('4222 2222 2222 2'));        // 13-digit → true
VISA.test(normalise('4539 1488 0343 6467'));     // 16-digit → true
VISA.test(normalise('4532 0151 1283 0366 187')); // 19-digit → true

VISA.test(normalise('4539 1488 0343 646'));      // 15-digit → false
VISA.test(normalise('5425 2334 3010 9903'));     // Mastercard → false

The two optional three-digit groups are what admit exactly 13, 16, and 19 while rejecting everything between. Strip separators before testing — the pattern matches digits only. Note that this checks shape, not the checksum; run both.

Visa’s own test card numbers

Visa publishes test card numbers for merchants and processors through its developer programme, and every major gateway ships its own Visa test numbers. Those numbers are registered in the processor’s sandbox and return genuine authorisation responses. Ours do not.

This generatorGateway sandbox card
Passes client-side Luhn checkYesYes
Triggers Visa brand detectionYesYes
Unlimited unique numbersYesNo — a handful of fixed numbers
Returns an authorisation responseNoYes
Triggers specific decline codesNoYes
Works with 3-D Secure flowsNoYes

The split is clean: use a Visa card generator like this one while you are testing your own code, and switch to the gateway’s numbers the moment the processor’s behaviour is what you are testing. Stripe and PayPal both publish full tables, and we collect the equivalents on the test card numbers reference.

Visa card anatomy

Taking 4539 1488 0343 6467 apart:

4  5  3  9  1  4    8  8  0  3  4  3  6  4  6    7
└──────┬────────┘   └───────────┬────────────┘   └┬┘
       │                        │                 │
       │                        │                 └── Check digit (Luhn)
       │                        └──────────────────── Individual Account Identifier
       └───────────────────────────────────────────── IIN / BIN (first 6–8 digits)
 ↑
 └─ MII: 4 = banking and financial, and Visa's network prefix

The leading 4 does double duty — it is both the Major Industry Identifier for banking and finance and Visa’s entire scheme prefix. The next five digits complete the six-digit IIN identifying the issuing bank, though under ISO/IEC 7812-1:2017 that field is migrating to eight digits, so lookup code should not assume six. The nine digits after it are the account identifier, and the final 7 is the Luhn check digit computed above.

For a network-by-network comparison, the all-network credit card generator carries the full format table; Mastercard, American Express, and Troy have their own pages, and the tool directory lists everything else. The FAQ covers what a Luhn-valid number does and does not prove.

Frequently Asked Questions

Yes. Every Visa card number begins with the digit 4, which is both its Major Industry Identifier and the whole of its network prefix. That makes Visa the simplest network to detect — one digit is enough. The reverse does not hold as neatly: a few other schemes also issue in ranges beginning with 4, so production BIN lookups check more than the leading digit.
Usually 16. Visa’s specification also permits 13 digits, which appears on older cards, and 19 digits, used on some Visa Electron and co-branded products. Validation that accepts only 16 digits will reject cards that are perfectly valid.
CVV2 is Visa’s name for the three-digit security code printed on the signature panel on the back of the card. It is computed by the issuer from the card number, the expiry date, and two secret keys, so it cannot be derived from the number by anyone else. The codes this generator shows are random three-digit values that only satisfy the length check.
Not from the number. The digits encode the network and the issuer, not the funding source. Whether a card draws on a credit line or a deposit account is recorded in the issuer’s BIN table, so routing logic that needs to know requires a BIN lookup service.
No. They pass client-side format and checksum validation, which is what makes them useful for testing your own form. They are not registered with any issuer, so a payment processor will decline them at authorisation.
Almost always because the validation hard-codes a 16-digit length. ISO/IEC 7812 permits a primary account number of up to 19 digits and Visa has issued 13-digit numbers, so a length check should accept 13, 16, and 19 rather than a single value.
No. It is the most widely published Visa test number in the industry and appears in the documentation of nearly every payment gateway. It is Luhn-valid and deliberately not assigned to any account. If you find it in a data set, that data set is test data.