Reference · Validation
Check-digit algorithms explained.
Which numbers use which checksum, how each is calculated by hand, and what a passing check does and does not prove.
Which checksum does what
| Number | Algorithm | Weights and modulus | Passing means |
|---|---|---|---|
| Payment card number, Canadian SIN, Ontario health card number | Luhn | Double every second digit from the right, subtract 9 from any result over 9, sum, total must be divisible by 10 | Well-formed. Not that an account or person exists. |
| ISBN-10 | Mod 11 | Weights 10 down to 1; X stands for 10; total divisible by 11 | Well-formed ISBN-10 |
| ISBN-13 and EAN-13 barcodes | Mod 10 | Weights alternate 1 and 3 across all 13 digits; total divisible by 10 | Well-formed ISBN-13 or EAN-13 |
| IBAN | ISO 7064 mod 97-10 | Move the first four characters to the end, turn letters into numbers (A=10 to Z=35), remainder after dividing by 97 must be 1 | Well-formed IBAN. Not that the account is open. |
| BC Personal Health Number | Mod 11 | Weights 2, 4, 8, 5, 10, 9, 7, 3 on digits 2 to 9 | Well-formed PHN |
A check digit is designed to catch typing errors such as a single wrong digit or two swapped neighbours. It is not a security feature and says nothing about whether the number was ever issued.
Luhn, step by step
Take 79927398713. Work from the right-hand digit, which is not doubled, and double every second digit moving left. Any doubled result above 9 has 9 subtracted.
- Digits right to left: 3, 1, 7, 8, 9, 3, 7, 2, 9, 9, 7.
- Double every second digit (positions 2, 4, 6, 8, 10): 1×2=2, 8×2=16→7, 3×2=6, 2×2=4, 9×2=18→9.
- Sum all digits with those replacements: 70.
- 70 is divisible by 10, so the number passes.
Two more passes you can verify the same way: the SIN example 046 454 286 totals 50 and the standard Visa test number 4111 1111 1111 1111 totals 30. Neither is a real account or person.
ISBN-10
Multiply the digits of 0306406152 by 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 and add the products: the total is 132, and 132 ÷ 11 = 12, so it passes. If the last character is X it counts as 10.
ISBN-13 and EAN-13
Multiply the digits of 9780306406157 alternately by 1 and 3 from the left and add: the total is 100, divisible by 10, so it passes. This is the same check GS1 uses for EAN-13 retail barcodes.
IBAN mod 97
Take GB82WEST12345698765432, a widely published example IBAN (not a real account). Move the first four characters to the end to give WEST12345698765432GB82. Replace letters with numbers (W=32, E=14, S=28, T=29, G=16, B=11) to get 3214282912345698765432161182. The remainder when that 28-digit number is divided by 97 is 1. A remainder of 1 means the IBAN is well-formed. Divide in chunks, because the number is too large for ordinary integers in many languages.
What a checksum cannot tell you
Passing proves the digits are internally consistent, so a typo is likely to be caught. It does not prove the card, account, ISBN or person exists. Roughly one random number in ten passes a mod 10 check, and about one in eleven passes a mod 11 check, so only the issuer can confirm a real number. Use the validators below to run each check in your browser; nothing is sent to a server.
Sources
- ISO/IEC 7812-1, identification cards: numbering system (defines the Luhn algorithm). Luhn algorithm overview for the same method with further examples.
- International ISBN Agency: ISBN standard (ISBN-10 and ISBN-13 check digits, ISO 2108)
- GS1: How to calculate a check digit manually (EAN/UPC weights)
- ISO 13616 (IBAN structure) and ISO 7064 (mod 97-10). The IBAN registry is maintained by SWIFT.
- BC Ministry of Health, Conformance Standards Vol. 4B (PHN Mod 11)
Every figure above is copied from the primary source linked here. Check the source before relying on a number for a filing, a payroll run or a legal decision; governments revise these tables.
Cite this page
You are welcome to quote or link this table. A suggested citation: