Skip to content
ZeroServer.tools

Fake Credit Card Generator

Generate Luhn-valid test credit card numbers for Visa, Mastercard, Amex, and Discover.

Test numbers only. These numbers pass the Luhn checksum but are not linked to any real account. Use them only for development and QA — never for actual transactions.
Card Type

What is the Luhn algorithm?

The Luhn algorithm is a simple checksum formula used to validate credit card numbers. It verifies that the check digit (the last digit) is correct given the preceding digits. Note: a valid Luhn number does notmean it's a real, active credit card account — it's only a mathematical check. These generated numbers use each brand's real prefix (Visa starts with 4, Amex with 34/37, and so on) and a correctly computed Luhn check digit, so they pass format validation in payment forms and test suites. Generation happens entirely in your browser using the Web Crypto API.

Built and maintained by Meet Shah · Last updated

What this tool is used for

  • Producing Luhn-valid numbers to test a payment form's client-side validation.
  • Checking that a form refuses a number whose brand and length disagree.
  • Filling a fixture with numbers across brands and lengths.
  • Testing that a field masks and truncates card numbers correctly.
  • Checking a validator rejects a number whose check digit is wrong.

Frequently Asked Questions

Do these numbers work for real purchases?
No, and they cannot. They pass the Luhn checksum, which is the format check a form does client-side, but they are not attached to any account or issuer. A payment processor's authorisation request fails immediately — the number is structurally valid and financially meaningless.
What is the Luhn algorithm doing?
Catching typos. Double every second digit from the right, subtract 9 from any result over 9, sum everything, and a valid number is divisible by 10. It detects every single-digit error and almost every transposition of adjacent digits — which is why forms can reject a mistyped card without contacting anyone.
Why do the prefixes matter?
Because the leading digits are the issuer identification number. Visa starts with 4, Mastercard with 51–55 (and the newer 2221–2720 range), Amex with 34 or 37 at 15 digits rather than 16, Discover with 6011. That is how a form shows the right card logo before you finish typing.
Should I use these instead of a processor's test cards?
No — use Stripe's `4242 4242 4242 4242` and its siblings, or the equivalents from your own processor. Those trigger specific documented behaviours: a decline, an insufficient-funds error, a 3-D Secure challenge. A generated number only ever produces one outcome, and it is not a useful one.
Is generating these legal?
Generating Luhn-valid digits is arithmetic and is how every test suite works. Attempting to use one for a transaction is fraud regardless of whether it succeeds. The tool exists for form validation and UI testing, which is a real need that does not require touching a real card number.

Common errors and gotchas

  • Expecting a generated number to work at a gateway. Use the gateway's own published test numbers instead.
  • Storing generated numbers in a system that treats them as real cardholder data and triggers compliance scope.
  • Confusing Luhn-valid with issued, which it never implies.
  • Testing only 16-digit numbers, so 15-digit Amex and 19-digit variants go unhandled.
  • Using a generated number in a live environment, which produces a decline and a fraud signal.

Related Generators tools

Private & free — this tool runs entirely in your browser.

CloudwaysManaged cloud hosting on AWS, GCP & DO — from $11/mo.affiliate