Developer Tools
Luhn Algorithm Calculator
Validate any digit string with the Luhn (mod 10) algorithm, compute the missing check digit, and inspect the doubling and sum step by step.
Check whether a complete identifier passes the Luhn check.
Paste a complete number. Spaces, dashes, dots, and slashes are ignored.
Passes Luhn check
Sum is 80. 80 mod 10 is 0, so the check digit is correct.
Sum
80
Sum mod 10
0
Result
VALID
Step by step
Counting from the right, every other digit is doubled. If the doubled value is more than 9, subtract 9 (equivalent to summing its two digits). All contributions are then summed; the total is divisible by 10 if and only if the input passes the Luhn check.
| Pos. | Digit | Doubled | Contribution |
|---|---|---|---|
| 1(r16) | 4 | x2 | 8 |
| 2(r15) | 2 | no | 2 |
| 3(r14) | 4 | x2 | 8 |
| 4(r13) | 2 | no | 2 |
| 5(r12) | 4 | x2 | 8 |
| 6(r11) | 2 | no | 2 |
| 7(r10) | 4 | x2 | 8 |
| 8(r9) | 2 | no | 2 |
| 9(r8) | 4 | x2 | 8 |
| 10(r7) | 2 | no | 2 |
| 11(r6) | 4 | x2 | 8 |
| 12(r5) | 2 | no | 2 |
| 13(r4) | 4 | x2 | 8 |
| 14(r3) | 2 | no | 2 |
| 15(r2) | 4 | x2 | 8 |
| 16(r1) | 2 | no | 2 |
| Sum | 80 |
Try a preset
Quick samples from different identifier families. They all use the same Luhn engine.
About the Luhn algorithm
The Luhn algorithm, also called the mod 10 algorithm, was patented by IBM scientist Hans Peter Luhn in 1960 and is now in the public domain. It catches almost every single-digit error and most adjacent-digit transpositions, which is exactly the pattern of mistakes humans make when copying long numbers by hand. Because it uses no cryptographic secret it is a checksum, not a signature: it tells you whether a number could be valid, never whether it has been issued or activated. Identifier systems that use Luhn include credit and debit card primary account numbers (ISO/IEC 7812-1), IMEI device identifiers (3GPP TS 23.003 Annex B), the US National Provider Identifier, the Canadian Social Insurance Number, and many internal account, customer, and survey IDs.
How to use
- Pick a mode: Validate to check a full identifier, Generate check digit to find the missing trailing digit, or Batch validate to check many lines at once.
- Paste the digits. Spaces, dashes, dots, and slashes are stripped automatically, so a formatted card number, IMEI, or NPI works without reformatting.
- In Validate, read the pass or fail banner, the running sum, sum mod 10, and the step-by-step table that shows which digits were doubled and how each contribution was reduced.
- In Generate check digit, copy the computed check digit, the full identifier, or a 4-grouped version of it. The derivation panel shows the body sum and the (10 minus sum mod 10) mod 10 calculation.
- In Batch validate, paste one identifier per line. The results table shows VALID or INVALID, the digit count, and the sum detail; use Copy results to grab a TSV summary for a spreadsheet.
About this tool
Luhn Algorithm Calculator is a general-purpose checker for the Luhn (mod 10) algorithm defined in ISO/IEC 7812-1. The Luhn checksum is the most common single-digit error detector for numeric identifiers: it backs credit and debit card numbers (PAN), IMEI device identifiers (3GPP TS 23.003 Annex B), US National Provider Identifier (NPI) numbers, Canadian Social Insurance Numbers, and a long list of internal account, customer, and survey IDs. Three modes share one engine. Validate accepts a complete identifier (with or without spaces, dashes, dots, or slashes), strips separators, and reports pass or fail with the running sum, sum mod 10, and a row-by-row table that shows which digits were doubled, the doubled value, the standard subtract-9 reduction when the doubled value is greater than 9, and the contribution that went into the total. Generate check digit accepts an identifier body without its trailing check digit and computes the missing digit as (10 minus body sum mod 10) mod 10, returning the full identifier ready to copy. Batch validate takes one identifier per line, reports valid or invalid for each row with the cleaned digit count and a short detail (sum and remainder), and offers a copy-as-TSV summary for spreadsheets or test logs. Because Luhn is a checksum and not a signature, this tool only tells you whether a number could be valid; it never claims a card was issued, an IMEI is active, or an NPI is in use. Length-aware brand detection for credit cards lives in the Credit Card Validator; ISBN-10 uses mod 11, ISBN-13 uses a different weighted mod 10, and CRC32 is a different algorithm entirely. This tool is the pure Luhn primitive that the card check shares with the other Luhn-protected identifier systems. Everything runs in your browser. No identifier is uploaded, logged, or stored.
Free to use. Works in your browser. No signup, no login.
Related tools
You may also like
Credit Card Validator
Luhn checksum, brand detection, length rules, and public test card numbers in your browser.
Open tool
DeveloperIMEI Validator
Luhn check, TAC and serial breakdown, IMEISV support, and per-digit math in one view.
Open tool
DeveloperISBN Validator
Validate ISBN-10 and ISBN-13 and convert between formats with verdicts and expected check digits.
Open tool
SecurityCRC32 Checksum Calculator
Compute CRC-32 and CRC-32C of text or files with hex, decimal, and byte-order output.
Open tool
DeveloperIBAN Validator
Mod-97 checksum, country format check, and bank identifier extraction in one view.
Open tool