Luhn Check Digit Calculator
Inputs
| Mode | Compute check digit |
|---|---|
| Number | 7992739871 |
Luhn Check Digit Calculator
Compute the Luhn (mod 10) check digit for a number, or validate whether a number passes the Luhn checksum. Works on any digit string — ID numbers, IMEI, and barcodes.
Inputs
Number
compute_hint
Results
Enter a value to see results.
Result
Luhn Check Digit
The Luhn algorithm — also known as the mod 10 algorithm — is a checksum formula that guards long identifier numbers against accidental typos. It works by appending one extra digit, the check digit, that is derived from all the other digits. A quick arithmetic test on the complete number then reveals whether it is internally consistent. Hans Peter Luhn described the method at IBM in 1954, and it is now standardised as part of ISO/IEC 7812.
This calculator has two modes: compute a check digit for a number that does not have one yet, and validate whether a complete number satisfies the Luhn condition. It operates on any digit string, so it is equally suited to ID numbers, IMEI device identifiers, and barcodes.
How the algorithm works
Starting from the rightmost digit and moving left, every second digit is doubled. When doubling produces a two-digit number, its digits are added together — equivalently, subtract 9. All the resulting values are then summed. For a payload without a check digit, the check digit is:
where is the weighted sum. A complete number is valid when the same weighted sum, this time including the check digit, is a multiple of 10.
Worked example — 7992739871
Take the payload 7992739871 (the neutral example from the algorithm's specification). Number the digits from the right, then double every second one starting at position 1:
| Position (from right) | Digit | Step | Value |
|---|---|---|---|
| 1 | 1 | ×2 | 2 |
| 2 | 7 | — | 7 |
| 3 | 8 | ×2 | 16 → 7 |
| 4 | 9 | — | 9 |
| 5 | 3 | ×2 | 6 |
| 6 | 7 | — | 7 |
| 7 | 2 | ×2 | 4 |
| 8 | 9 | — | 9 |
| 9 | 9 | ×2 | 18 → 9 |
| 10 | 7 | — | 7 |
The values sum to . The check digit is therefore:
Appending it gives the full number 79927398713. To validate that complete number, the weighted sum comes to 70, which is a multiple of 10 — so it passes.
What errors it catches
The single check digit cannot catch every mistake, but it is tuned to the errors people actually make when copying long numbers:
- Any single-digit error — one digit typed wrong — is always detected.
- Most transpositions of two adjacent digits are detected. The one exception is swapping the pair 09 for 90 (and vice versa), because those two produce the same weighted contribution.
Because it uses a base-10 weighted sum, the Luhn scheme is a lightweight integrity check, not an error-correcting code: it can tell you that something is wrong, but not which digit is wrong. For error correction, coding-theory tools such as a Hamming Distance Calculator or a CRC Checksum Calculator are the appropriate next step.
Where Luhn check digits appear
The mod 10 scheme is embedded in many everyday identifier formats:
- IMEI numbers, the 15-digit identifiers of mobile phones, end in a Luhn check digit.
- Payment and loyalty card numbers use a trailing Luhn digit so a point-of-sale terminal can reject an obvious mistype before contacting the network.
- National and tax identification numbers in several countries include a Luhn digit.
- Product and shipping barcodes use Luhn or closely related mod 10 variants.
What passing the check does and does not mean
The Luhn algorithm is a public formula with no secret key. Passing it proves only that a number's digits are mutually consistent — never that the number was actually issued, registered, or belongs to anyone. Anyone can write down a digit string that satisfies the check.
For that reason, Luhn is used as a fast first-pass filter: reject clearly mistyped input immediately, then defer to an authoritative lookup for anything that survives. It is a data-quality aid, and this tool is meant for understanding how the checksum works and for testing arbitrary digit strings such as IDs, IMEI numbers, and barcodes. For a keyed, tamper-resistant integrity check you would use a cryptographic hash instead — see the Hash Collision Probability Calculator for why checksum length matters there.
Frequently Asked Questions (FAQ)
What is the Luhn algorithm?
The Luhn algorithm, also called the mod 10 algorithm, is a simple checksum formula published by IBM scientist Hans Peter Luhn in 1954 and standardised as part of ISO/IEC 7812. It appends one extra digit — the check digit — to a number so that a short arithmetic test can catch the most common data-entry mistakes.
To compute the check digit, start from the rightmost digit of the payload and double every second digit. If doubling produces a two-digit result, add its digits together (or equivalently subtract 9). Sum all the resulting values, then the check digit is (10 − sum mod 10) mod 10. A complete number is valid when the same weighted sum, including the check digit, is a multiple of 10.
Where is the Luhn check digit used?
Luhn check digits appear on many identifier numbers. The IMEI that identifies a mobile phone uses a Luhn digit, as do the account numbers on payment and loyalty cards, some national identification numbers, and a range of product and shipping barcodes.
The algorithm is designed only to catch accidental errors: a single mistyped digit, or most cases of two adjacent digits being swapped. It is a data-integrity aid for forms and scanners, not a way to prove that an identifier is genuine or registered.
Does passing the Luhn check mean a number is real?
No. The Luhn algorithm is a public formula with no secret key, so passing it only means the digits are internally consistent — not that the number was ever issued to anyone. Anyone can construct a digit string that satisfies the check.
Because of that, Luhn is used as a first-pass filter to reject obviously mistyped input before a slower authoritative lookup, never as proof of validity or ownership. This tool is intended for learning how the checksum works and for testing arbitrary digit strings such as IDs, IMEI numbers, and barcodes.