ToolLineup

Credit Card Number Validator (Luhn)

This validator runs a card number through the Luhn algorithm, the checksum built into every payment card number so that a mistyped or transposed digit is caught before the number is sent anywhere. It also identifies the issuer from the leading digits and checks the length against what that issuer actually uses, since a number can pass the checksum while still being the wrong length to be genuine. What it cannot tell you is whether a card exists, is active, or has any money behind it — the Luhn check is a format test and nothing more. Use published test numbers rather than real ones: no website should ever be given a real card number outside a payment form.

How it works

Checks a card number against the Luhn algorithm, the checksum printed into every payment card number so that a mistyped digit is caught before the number is sent anywhere.

It also identifies the issuer from the leading digits and checks the length against what that issuer actually uses. This validates the format only — it says nothing about whether a card exists, is active or has funds.

Everything runs in your browser — nothing you enter is sent to a server.

How the Luhn algorithm works

Take 4111 1111 1111 1111. Working from the right:

  1. Double every second digit.
  2. If doubling gives more than 9, subtract 9 (so 14 becomes 5).
  3. Add every digit together.
  4. The number is well formed if the total is a multiple of ten.

The final digit of a card number is the check digit — chosen precisely so that the total comes out right.

What it catches, and what it does not

It catches every single-digit error and almost every transposition of adjacent digits, which between them are the overwhelming majority of typing mistakes. It does not catch a transposition of 09 and 90, and it obviously cannot tell whether a well-formed number was ever issued.

Please use test numbers

Every payment provider publishes card numbers for testing — 4111 1111 1111 1111 for Visa, 5555 5555 5555 4444 for Mastercard, 3782 822463 10005 for American Express. They pass the Luhn check and belong to nobody.

This page performs its check locally and makes no network request. That is worth stating, and it is also worth saying plainly that you have no way to confirm it from the outside — which is exactly why you should never type a real card number into any site other than a payment form you trust.

Frequently asked questions

What does the Luhn check prove?

That the number is well formed. It catches a single mistyped digit and most transpositions, which is what it was designed for. It says nothing about whether the card exists or has funds.

Should I enter a real card number?

No. Use a published test number such as 4111 1111 1111 1111. This tool runs entirely in your browser and sends nothing anywhere, but you cannot verify that from the outside — so treat any site asking for a card number outside a payment form with suspicion.

How does the algorithm work?

Starting from the right, every second digit is doubled, and any result above 9 has 9 subtracted. All the digits are then added together, and a valid number gives a total that is a multiple of ten.

How is the issuer identified?

From the leading digits. 4 is Visa, 51 to 55 and 22 to 27 are Mastercard, 34 and 37 are American Express, and so on. These are the Issuer Identification Numbers.

Why does a number pass the checksum but get flagged?

Because its length is wrong for the issuer. American Express numbers are 15 digits and Visa 13, 16 or 19 — a 16-digit number starting 34 fails that test regardless of the checksum.

Is the number I type transmitted?

No. The check is arithmetic performed in your browser, with no network request of any kind.

Related tools