Credit/Debit Card Generator and Validator

Generate and validate fictitious card numbers for software testing.

Notice: the numbers generated by this tool are fictitious and intended exclusively for software testing. They satisfy the Luhn algorithm (mathematically valid), but do not correspond to any card issued by any financial institution, and cannot be used for real transactions.

Generate card

Validate number

What is the Luhn algorithm?

The Luhn algorithm (also called the "Luhn formula" or "mod 10") is a checksum method created by Hans Peter Luhn, of IBM, in 1954. It is widely used to validate identification numbers, and is the standard adopted by the credit and debit card industry (Visa, Mastercard, American Express and others) to detect simple typing errors.

The calculation works as follows:

  1. Walk through the digits from right to left.
  2. Double the value of every second digit (positions 2, 4, 6…).
  3. If doubling a digit results in a value greater than 9, subtract 9 from the result.
  4. Sum all the digits (original and doubled/adjusted).
  5. The number is valid if the total is divisible by 10 (sum % 10 === 0).

What is generating fictitious card numbers useful for?

While developing and testing payment-processing systems, it is necessary to work with card numbers that pass format validation without, however, using real customer data. This tool generates numbers that mathematically satisfy the Luhn algorithm and use the correct prefixes for each brand — which makes them suitable for:

Important: the generated numbers are fictitious. They are not associated with any account, cardholder or financial institution, and cannot be used to carry out transactions. Payment gateways in production mode reject these numbers, since they check, besides Luhn, whether the number exists in their database of issued cards.

Supported brands and their prefixes

Frequently Asked Questions (FAQ)

Can the generated cards be used for purchases?

No. The numbers are fictitious and generated exclusively for software testing. They pass the Luhn algorithm's mathematical validation, but do not correspond to cards issued by any financial institution. Any attempt to use them in real transactions will result in immediate refusal.

What is CVV?

The CVV (Card Verification Value) is a security code printed on the card. For Visa, Mastercard, Elo and Hipercard, it is 3 digits. For American Express (Amex), it is 4 digits. This tool generates random CVVs — for testing purposes only.

Does the tool automatically detect the brand during validation?

Yes. In the validation section, the system analyzes the prefix and length of the entered number to identify the likely brand (Visa, Mastercard, Amex, Elo, Hipercard) and then applies the Luhn algorithm to determine whether the number is mathematically valid.

Why can a number be valid by Luhn but invalid on gateways?

Luhn is only the first level of verification. Production payment gateways also check whether the number exists in the database of cards issued by the brands, whether it has not expired, whether the CVV matches and whether the account has a balance. None of these checks can be performed with fictitious numbers.

Does formatting with spaces change the number?

No. The "Format" checkbox only adds spaces every 4 digits to make it easier to read (e.g., 4111 1111 1111 1111). The "Copy number" button copies the number without spaces or mask, ready to use in form fields.