Skip to main content

Luhn Algorithm Validator

Validate any number with the Luhn (mod 10) checksum — see the digit-by-digit math, detect the card network from its IIN, generate check digits, or batch-check a whole list.

100% client-side — nothing leaves your browser Step-by-step breakdown Check digit generator Batch mode

Validate a number

Type or paste a number (spaces and dashes are ignored). The tool runs the Luhn mod 10 formula and shows every step.

Luhn check digit generator

Enter a number without its final check digit (e.g. a 15-digit card body) and get the digit that makes it Luhn-valid.

Batch validator

Paste one number per line (up to 500). Each line is checked independently with its card type.

Worked examples — the Luhn algorithm step by step

Pick an example to see the full digit-by-digit calculation, computed live by the same engine above.

How to read the table: positions are counted from the right (position 1 = the check digit). Every digit in an even position is doubled; if the doubled value exceeds 9, subtract 9 (same as adding its two digits). All contributions are summed — the number is valid only if the total ends in 0 (total mod 10 = 0).
Honest limitation: a passing Luhn check proves only that the digits satisfy the checksum formula. It does not prove a card number is real, active, issued by a bank, or has funds — that requires verification with the card issuer. Use test numbers (e.g. 4111 1111 1111 1111) rather than real card details on any website.

How the Luhn (mod 10) formula works

The Luhn algorithm, published by IBM scientist Hans Peter Luhn in 1954 and standardized in ISO/IEC 7812, is a checksum designed to catch accidental digit errors — every single-digit mistake and most adjacent transpositions. It works like this:

  1. Starting from the rightmost digit (the check digit), move left and double every second digit.
  2. If doubling produces a value over 9, subtract 9 (e.g. 7 × 2 = 14 → 14 − 9 = 5).
  3. Sum all the resulting values, doubled and untouched alike.
  4. The number is valid if the total modulo 10 equals 0.

Because the check digit is chosen to make the total a multiple of 10, the formula can also generate a valid check digit for any partial number — exactly what the generator tab does.

Card network detection (IIN ranges)

The first digits of a card number — the Issuer Identification Number (IIN/BIN) — identify the network. This tool matches these public prefix ranges:

NetworkPrefix (IIN)Lengths
Visa413, 16, 19
Mastercard51–55, 2221–272016
American Express34, 3715
Discover6011, 622126–622925, 644–649, 6516, 19
JCB3516–19
Diners Club300–305, 36, 3814
UnionPay6216–19
Maestro5018, 5020, 5038, 5893, 6304, 6759, 6761–676312–19

Detection is prefix-based for education only — IIN ranges are reassigned over time, and a matching prefix says nothing about whether the number is real.

Frequently asked questions

What is the Luhn algorithm?

The Luhn algorithm (also called the mod 10 or modulus 10 formula) is a checksum formula created by IBM scientist Hans Peter Luhn in 1954. It validates identification numbers by running their digits through a simple doubling-and-summing routine; the number passes only if the final total is a multiple of 10. It is described in ISO/IEC 7812 and is built into virtually every payment form on the web.

How does the Luhn check work, step by step?

Starting from the rightmost digit (the check digit) and moving left: double every second digit. If doubling gives a two-digit result, subtract 9 (equivalent to adding its digits). Add all resulting values together. If the total modulo 10 equals 0, the number is valid. Example: 79927398713 doubles to a digit-sum of 70, and 70 mod 10 = 0, so it passes.

Does a valid Luhn check mean a credit card number is real or active?

No. A passing Luhn check proves only that the digits satisfy the checksum formula — it catches typos and transcription errors. It does not prove the number was ever issued, is active, belongs to an account, or has available funds. This tool is for education, testing, and form-validation development only.

What is the difference between Luhn validation and real card verification?

Luhn validation is pure mathematics performed on the digits themselves, and it runs entirely offline. Real verification happens with the card issuer or payment network: they confirm the account exists, is active, has funds, and authorize the transaction — using data like expiry date, CVV, and 3-D Secure that no checksum can reproduce.

Which numbers use the Luhn algorithm?

Credit and debit card numbers (Visa, Mastercard, Amex, Discover, and others under ISO/IEC 7812), IMEI numbers on mobile phones, Canadian Social Insurance Numbers, US National Provider Identifiers for healthcare, and several national ID and loyalty-card schemes all embed a Luhn check digit.

How do I calculate a Luhn check digit?

Take your number without its final digit, append a 0, and run the Luhn sum. The check digit is (10 − (sum mod 10)) mod 10. Example: for 7992739871 the sum with a trailing 0 is 67, so the check digit is (10 − 7) = 3, giving the valid number 79927398713. Use the Check Digit Generator tab above to do this automatically.

Why does my number fail the Luhn check?

The most common causes are a mistyped digit or two swapped digits — the algorithm was designed to catch exactly these errors (it detects every single-digit error and most adjacent transpositions, though not all, e.g. 09 swapped to 90). Spaces and dashes are ignored automatically, so retype the digits carefully or paste them again.

Is it safe to type a card number into this tool?

This validator runs 100% in your browser with zero network requests — no fetch, no XHR, nothing is sent to any server or stored anywhere. Even so, as a general safety habit, prefer published test numbers (like 4111111111111111) over real card details on any website.

Related: luhn algorithm checker · luhn algorithm validator online · credit card number validator · mod 10 check calculator · luhn check digit calculator · luhn formula calculator · card type detector · luhn algorithm step by step · credit card checksum validator · check digit generator · imei validator · how to calculate luhn check digit · visa test card number · credit card number format checker

Free tool by NRTechStudio