Credit card validator: verify the Luhn check digit

A card number passes the Luhn algorithm if, after doubling every second digit starting from the second-to-last one (subtracting 9 when the result is greater than 9) and adding everything up, the total is a multiple of 10. This card validator applies Luhn and also checks whether the prefix belongs to a known test BIN range.

Paste a card number and we check the Luhn sum and whether the prefix matches a recognized test BIN.

Quick validator

Check whether a DNI, NIE, CIF, IBAN, card number, NSS or CCC has a valid format and check digit.

The validator checks format and check digits. It does not check whether the document or account exists. The value is never sent to any server or stored in the URL.

How it's calculated

BINs from public test ranges + Luhn check digit (mod 10).

Generated sample
4242424123836621

Every other digit (from the right) is doubled and all the digits are added up.

  1. 1
    Number without the check digit
    424242412383662
  2. 2
    Luhn sum (alternate digits doubled, -9 if over 9)
    69
  3. 3
    Check digit = (10 − sum mod 10) mod 10
    1

Frequently asked questions

Does the validator accept real cards?

No. The Luhn algorithm is the same one real cards use, but the validator only accepts the test BIN ranges in its catalog.

Why does a real card show as invalid?

Because its BIN is not in the catalog of test ranges, even if the Luhn digit is correct.

Is it safe to paste a real card number into the validator?

The value never leaves your browser, but as a rule you should not enter real cards into third-party tools.

Keep exploring

Need to validate another data type? Use the full validator.