Luhn Check Digit Calculator

Luhn check digits and validation for card-style numbers.

Technology and NetUpdated 2026-10-121 min read
Luhn Check Digit Calculator
Answer
...
Full number...
Sum detail...

What it does

Card numbers carry their own typo check: the Luhn sum doubles alternate digits so single errors break the mod 10 total. Issuers from ISO 7812 frame their numbering on it.

The tool above takes digits with generate or validate mode. It returns the check digit or verdict with the full number and sum.

The default 7992739871 takes check 3, giving 79927398713. The patent 4872148 takes 4.

Algorithm follows USPTO patent 2950048 with ISO 7812 framing and university code behind them. All three agree on double-subtract-9 used here.

How to use

  1. Type the digit string.
  2. Pick generate or validate.
  3. Read the answer first.
  4. Read the full number beside it.
  5. Check the sum detail.
  6. Re-type on invalid.

Formula

Double alternate digits from right, minus 9 past 9. Check = (10 - sum%10)%10. Valid at sum%10 = 0.
sum
Running digit total.
payload
Number without its check.
check
Appended digit 0 to 9.

String math preserves leading zeros with integer sums only. Generation appends 0 first; validation needs 2+ digits. ISO 7812 frames card numbering around this check.

Worked example

Example: classic 7992739871

Defaults: payload 7992739871, generate mode.

  1. Payload: 7992739871.
  2. Append 0: 79927398710.
  3. Keep from right: 0+7+9+7+9+7 = 39.
  4. Double rest: 2+7+6+4+9 = 28.
  5. Sum: 39 + 28 = 67, mod 7.
  6. Check: 10 - 7 = 3.
  7. Full: 79927398713 validates at 70 mod 0.
  8. Tool shows check digit 3, full number.

Reference table

Luhn examples
PayloadCheckFull
7992739871379927398713
4872148448721484
123455123455

Limits

  • Format only; no account proof.
  • Digits only, 19 max.
  • Twins and 09 swaps slip.
  • Issuers add their own rules.

Common mistakes

  • Validating short strings.
  • Dropping leading zeros.
  • Trusting valid as funded.
  • Skipping re-types.
  • Mixing check positions.

Try it yourself

Quick checks. Answers sit tucked under each question.

Generate for 4872148?

Patent example: check digit 4.

Validate 79927398713?

Sum 70 mod 0: valid number.

Validate 79927398714?

Sum mod nonzero: invalid, re-type.

Questions

How does Luhn work?

Double every second digit from the right, subtract 9 past 9, sum, check = (10 - sum%10)%10.

Is there a patent example?

Yes: 4872148 takes check 4 per the original patent example.

Does Luhn catch every typo?

No: it catches single-digit errors and most adjacent swaps, not 09 swaps or twins.

What inputs qualify?

Digits only, leading zeros kept as text. Spaces and dashes strip out.

Can it validate too?

Yes: full numbers validate when total sum mod 10 hits 0.

Does valid mean chargeable?

No: check digits authenticate format only, never funds or accounts.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.