Credit Card Validator (Luhn)

Is my card number valid?

How it is calculated

The tool removes spaces and hyphens, then runs the Luhn checksum. Starting from the rightmost digit, every second digit is doubled; if a doubled value is above 9, 9 is subtracted. All digits are added up, and the number passes if the total is a multiple of 10. Any non-digit character makes it fail.

The card type is guessed only from the first digits: 4 is Visa, 51 to 55 and 2221 to 2720 Mastercard, 34 or 37 American Express, 6011, 65 or 644 to 649 Discover, 36, 38 or 300 to 305 Diners Club, 3528 to 3589 JCB and 9792 Troy (JCB per the Discover Global Network IIN range list, which marks 3528-3589 as JCB). A pass means the number is correctly formed, not that the card exists, is active or has funds. No number is stored or sent to a bank.

Worked example

Check 4539 1488 0343 6467. After removing spaces it has 16 digits. From the right, double every second digit: 6→12→3, 6→12→3, 4→8, 0→0, 8→16→7, 1→2, 3→6, 4→8. Add these to the undoubled digits (7, 4, 3, 3, 8, 4, 9, 5) and the total is 80, a multiple of 10. The result is Valid, and the leading 4 identifies it as Visa.

Try this example →

Common mistakes

  • Assuming a valid result means the card is real or has money. Only the check digit is verified.
  • Typing letters or the letter O for zero, which makes the number invalid.
  • Entering the card expiry date or CVV in the number field.
  • Expecting every card to be detected; unlisted prefixes are shown as unknown even if the number passes.

Sources

About this calculator

This tool checks whether a card number is structurally valid using the Luhn algorithm, a checksum formula that doubles every second digit, adjusts values over 9, and sums the result to see if it lands on a multiple of 10. Every legitimate Visa, Mastercard, American Express and Troy card number is generated to satisfy this checksum, so a number that fails it is guaranteed to be mistyped or fake, though passing it does not prove the card is active or has funds.

It is used by developers testing payment forms and checkout flows without needing a real card, by customer support staff double-checking a number a customer read aloud over the phone, and by anyone who wants to catch a typo before submitting an order. The calculator also guesses the likely card network from the number's first digits (its prefix) alone, which is the same kind of logic checkout pages use to show the right card-brand icon as you type.

Was this helpful?

You can pick up to 3 reactions.

Note from the editors

A pass only means the digits satisfy the Luhn checksum, which catches a mistyped or transposed digit: changing the last digit of the sample 4539 1488 0343 6467 to 8 turns Valid into Invalid, though the Visa guess stays. We would rather you did not type a real card number into any online tool; the test numbers that payment providers publish work just as well. Which card network's prefixes do you need that we do not recognize?

Comments

  • Be the first to comment.

Popular calculators

All Calculators