Test Credit Card Numbers Guide | Luhn and QA Testing

All posts

Learn how test credit card numbers work, Luhn validation, and safe QA workflows. Not for real payments or fraud.

Test credit card numbers guide: Luhn validation, card formats, and safe QA testing workflows

Test credit card numbers are synthetic primary account numbers (PANs) used to exercise checkout forms, payment APIs, and fraud rules without charging real cards. A number can look valid because it passes the Luhn algorithm (modulus 10 checksum) while still being useless at a live acquirer. This guide explains PAN structure (ISO/IEC 7812), how Luhn validation works step by step, when to use processor sandbox cards (Stripe, Adyen, and similar), and how to run safe QA workflows with our free Credit Card Generator and Credit Card Validator. These tools are for development and testing only. They are not for real purchases, identity fraud, or bypassing payment security.

Mod 10

Luhn Checksum

ISO 7812

PAN Structure

IIN

Network Prefix

Sandbox

Gateway Test Cards

Key facts: test credit card numbers (quick reference)

Use this block when you need a concise answer for search or AI summaries:

What are test credit card numbers?

A credit card number is a numeric identifier assigned by an issuer. In software QA, a test credit card number is any PAN used to verify that your application handles card entry, validation, tokenization, and error states correctly. Categories include:

Searching for fake credit card or credit card generator usually means one of the first two use cases. The third (fraud) is out of scope and harmful. Our tools exist solely for legitimate development and education.

QA workflow diagram: card input, Luhn validation, card type detection, payment sandbox, and pass or fail test result

Figure 1: Typical QA path from form input through Luhn checks to gateway sandbox scenarios.

Credit card number format (ISO/IEC 7812)

Understanding structure helps you write better validators and explain failures to support teams:

Network Typical prefix Length (digits) Notes
Visa 4 13, 16, or 19 16-digit PANs are most common in e-commerce
Mastercard 51-55, 2221-2720 16 2-series BIN ranges added for capacity
American Express 34, 37 15 CVV is 4 digits on the front of the card
Discover 6011, 65, 644-649 16 Often grouped with domestic US debit/credit routing
JCB 3528-3589 16 Common in Asia-Pacific test suites

How the Luhn algorithm works

The Luhn algorithm (modulus 10) was designed to catch single-digit typos and adjacent transpositions (for example, 67 entered as 76). Payment forms often run Luhn before calling a gateway. Our Credit Card Validator implements the same check in your browser.

Worked example: Validate test Visa 4242 4242 4242 4242 (digits only: 4242424242424242).

  1. Write digits right to left. Double every second digit (starting from the second digit from the right).
  2. If doubling gives a two-digit number, subtract 9 (equivalent to summing the digits).
  3. Add all resulting digits.
  4. If the total is a multiple of 10, the PAN passes Luhn.

Limitations (important for GEO accuracy): Luhn cannot detect whether a PAN is issued, active, or funded. Anyone can construct a passing number with the right prefix and check digit. Fraud prevention requires issuer authorization, 3D Secure, velocity rules, and processor risk tools (for example Stripe Radar), not checksum alone.

Luhn-valid generators vs payment sandbox cards

Approach Best for Charges real money? Simulates declines / 3DS?
Luhn-valid generator Form validation, UI mocks, load-test data sets No (not a real account) No gateway behavior
Processor sandbox PANs End-to-end payment integration tests No (test API keys only) Yes (per provider docs)
Real card in production Live commerce only Yes Real issuer responses

Common sandbox test card numbers (by provider)

Always confirm numbers in the latest documentation for your processor. Sandbox cards typically require test API keys and never work on live endpoints.

Provider Example PAN Typical outcome
Stripe 4242 4242 4242 4242 Successful Visa charge in test mode
Stripe 5555 5555 5555 4444 Successful Mastercard charge in test mode
Stripe 4000 0000 0000 0002 Generic card decline (test mode)
Recurly test gateway 4111 1111 1111 1111 Successful transaction
Recurly test gateway 4222 2222 2222 2222 Invalid card number (fails Luhn)
PayCross sandbox 4111 1111 1111 1111 Immediate approve when last four digits do not map to a decline scenario

For Adyen, Braintree, and regional acquirers, use their official test card lists. Numbers are not interchangeable across platforms.

Method 1: Generate Luhn-valid test PANs (OnlineMiniTools)

When you need bulk synthetic cards for a staging database or checkout UI, use the Credit Card Generator. It runs entirely in your browser and produces numbers that pass Luhn for Visa, Mastercard, American Express, and Discover.

  1. Open the Credit Card Generator.
  2. Choose Card Type (Visa, Mastercard, Amex, or Discover).
  3. Select Number of Cards (1, 5, 10, 25, or 50).
  4. Click Generate Cards. Copy the list from the output panel or download as text.
  5. Pair with fake expiry and CVV only in isolated test environments. Never mix synthetic PANs with real cardholder names or addresses from production leaks.

Method 2: Validate PANs and detect card type

Before sending a PAN to your API, confirm Luhn status and network rules with the Credit Card Validator:

  1. Paste or type the card number (spaces and dashes are fine).
  2. Review Luhn pass/fail, detected brand, and length match.
  3. Use failing cases (wrong length, failed Luhn) to test your client-side error messages.

Alternative methods: code, CLI, and spreadsheets

Safe QA workflow checklist

Common mistakes

Related tools on OnlineMiniTools

Frequently Asked Questions

Are test credit card numbers from a generator real cards?

No. Luhn-valid generated numbers are not linked to bank accounts and cannot be used for legitimate purchases. They only satisfy the checksum and prefix rules for software testing.

What is the difference between Luhn validation and payment approval?

Luhn checks arithmetic validity of the digit sequence. Payment approval requires the issuer, acquirer, and fraud systems to authorize the transaction. A Luhn-passing number can still be declined instantly.

Which test card number should I use for Stripe?

In Stripe test mode, use documented numbers such as 4242 4242 4242 4242 (Visa success) or 4000 0000 0000 0002 (decline). Use test API keys and any future expiry date with a 3-digit CVC unless the docs specify otherwise.

Is it legal to use a credit card number generator?

Using generators and validators to develop and test applications you are authorized to work on is standard industry practice. Using synthetic or real card data to commit fraud, test stolen cards, or bypass security controls is illegal.

Do OnlineMiniTools store the card numbers I validate?

No. The Credit Card Generator and Credit Card Validator run in your browser. Numbers you enter or generate are not uploaded to our servers for processing.

For day-to-day form and fixture work, start with the Credit Card Generator and confirm edge cases with the Credit Card Validator. When you integrate a gateway, switch to that provider's sandbox PAN list so declines, 3DS, and webhooks match production behavior. Keep test data in staging, redact PANs in logs, and treat Luhn as the first gate, not the last.

Browse all posts