How Check Digits Work: The Math Behind GTIN, ISBN and SSCC
GS1 mod-10, ISBN-10 mod-11, and Code 128's mod-103 in plain English — why one trailing digit catches every single-digit typo. The mod-10 and mod-11 methods are worked through step by step, and the GS1 example opens in the free ReadBarcode Check Digit Calculator so you can repeat the math on your own codes.
A supplier sends a spreadsheet of GTINs for a product onboarding. Five hundred rows. Someone copies it into the master data and the import fails on row 247: GTIN reported as invalid. The two rows on either side validate fine. The trailing digit on row 247 is a 1; the supplier insists it should be a 0. Pull up the check-digit calculator and the answer falls out in a second — the rest of the row computes a check digit of 0, the printed 1 is the typo, the supplier needs to fix their feed before re-sending.
That whole exchange exists because of check digits. Every UPC, EAN, GTIN, ISBN, ISSN and SSCC ends in a single trailing digit computed from the rest by a fixed algorithm. The math behind it is small enough to do on paper, the cost is one digit of address space, and the payoff is catching every single-digit typo, and most swapped digits, that would otherwise propagate quietly through pipelines. This guide unpacks the GS1 mod-10 algorithm in plain English, walks through the ISBN-10 mod-11 variant for completeness, and explains where Code 128's invisible modulo-103 checksum fits.
The Short Answer
A check digit is the last digit of an identifier, computed from the preceding digits by a fixed formula. UPC-A, EAN-13, GTIN-8/12/13/14, ISBN-13 and SSCC all use the same GS1 mod-10 algorithm. ISBN-10 uses an older mod-11 variant that introduces X as a check character. Code 128 carries an internal modulo-103 checksum that's invisible in the decoded payload — only relevant when you're generating the symbol itself.
If you only learn one of these algorithms, learn GS1 mod-10. It covers every retail GTIN length, every modern ISBN, every SSCC pallet identifier and every GS1-128 traceability barcode. The other algorithms are footnotes by comparison.
GS1 Mod-10: The Math Walkthrough
Take the worked example that runs through this site's guides: GTIN-13 5012345678900. The first twelve digits are the body; the last digit is the check.
- Take the body. Strip the trailing check digit, leaving
501234567890. - Read right-to-left, alternating weights of 3 and 1, starting with 3. For
501234567890:Body (reversed): 0 9 8 7 6 5 4 3 2 1 0 5 Weights: 3 1 3 1 3 1 3 1 3 1 3 1 Products: 0 9 24 7 18 5 12 3 6 1 0 5 Sum: 0+9+24+7+18+5+12+3+6+1+0+5 = 90 - The check digit is whatever brings the sum to the next multiple of 10. 90 is already a multiple of 10, so the check digit is
0. Append to the body and you have the full GTIN-13:5012345678900.
UPC-A (GTIN-12), EAN-8 (GTIN-8), GTIN-14 (the carton form) and SSCC (18 digits, AI 00) all use the identical right-to-left ×3/×1 weighting. Only the body length changes. ISBN-13 (978/979 prefix) is just a GTIN-13 with a fixed prefix, so the algorithm and answer are identical.
The calculator runs this same algorithm for any GTIN body — useful when you're minting new identifiers from a fresh company prefix:
Check Digit Calculator: Compute the GS1 mod-10 check digit for any partial UPC, EAN or GTIN body. Compute for 501234567890 →
To verify the complete identifier in one step (length class plus check digit) feed it to the validator:
GTIN Validator: Confirm a complete GTIN-8 / 12 / 13 / 14 has the correct mod-10 check digit. Open with 5012345678900 →
Why Mod-10 Catches Typos and Transpositions
Mod-10 isn't a cryptographic hash — it's a deliberately cheap algorithm that catches the most common human errors with one digit of address-space tax. Two properties make it useful:
- Every single-digit error is caught. Change any one digit of the body by 1, the sum changes by either 1 or 3, and the resulting check digit moves with it. Mismatch → flagged.
- Most adjacent transpositions are caught. Swap two neighbouring digits and the sum changes by 2×(difference between them). Whenever that difference is anything other than 0 or 5, the check digit moves and the typo is caught. The blind spot — swapping a
0and a5, or a1and a6— accounts for about 11% of transpositions.
It doesn't catch double transpositions, deliberate fraud or two errors that happen to cancel out. It's a hygiene check, not a security check. If you're validating identifiers as part of a fraud-prevention pipeline, mod-10 is the first filter, not the last one.
In practice, mod-10 catches the entire class of single-digit typos and the vast majority of transpositions — the two errors people make most often when re-keying numbers. The math is often credited to Hans Peter Luhn at IBM, but his formula is a different mod-10 scheme (compared below); the 3-1 weighting has been the GS1 default since GS1 existed.
ISBN-10's Mod-11 Variant
ISBN-10 — the old ten-digit book identifier — uses a different algorithm. Same spirit (a trailing check digit), different math.
- Take the body — the first nine digits of the ISBN-10.
- Read left-to-right and multiply each digit by a descending weight starting at 10:
Body (left-to-right): 0 1 4 3 0 3 3 4 4 Weights: 10 9 8 7 6 5 4 3 2 Products: 0 9 32 21 0 15 12 12 8 Sum: 0+9+32+21+0+15+12+12+8 = 109 - The check digit is whatever brings the sum to the next multiple of 11. 109 → next multiple of 11 is 110, so the check digit is
1. Full ISBN-10:0143033441.
Mod-11 can produce a check value of 10, which doesn't fit in a single decimal digit. The publishing convention is to write the Roman numeral X instead. You'll only ever see X as the final character of an ISBN-10, never anywhere else. ISBN-13 (introduced in 2007) uses GS1 mod-10, which has no X-as-10 edge case.
Most book systems today carry ISBN-13 alongside the legacy ISBN-10; the ISBN reader on this site validates both and surfaces whichever your input started from.
Code 128's modulo-103 checksum
Code 128 (and its GS1-128 cousin) carries an internal checksum that uses modulo-103 — the symbology has 103 data values (0 to 102), so the sum is taken modulo 103, and each value is weighted by its position (1, 2, 3 and so on). The checksum is appended as an extra codeword inside the bar pattern; it's never part of the decoded payload.
Scanning a Code 128 returns the payload string. The modulo-103 check is verified silently by the scanner's firmware. If the check fails, the scanner returns a read error rather than a corrupted payload — the entire point of the checksum is to make that failure clean.
For most readers and developers, the practical takeaway is short: Code 128 has its own check digit, you don't compute it, you don't see it, and it's why a scratched Code 128 either reads correctly or doesn't read at all. For the spec-level walkthrough of subsets and FNC1, see the Code 128 explained guide.
Common Mistakes
Most check digit failures in real data come from how numbers are handled, not from the formula. Five habits cause most of them:
- Recomputing the check digit and overwriting the supplier's value. If the supplied check doesn't match, the right action is to flag the row for human review — not to silently rewrite the digit. The original input might be the source of truth.
- Using the wrong algorithm. ISBN-10 input fed into a GS1 mod-10 validator returns garbage; an ISBN-13 fed into a mod-11 validator does the same. Route inputs to the correct algorithm based on length and prefix.
- Storing the check digit separately from the body. Some legacy systems split GTIN into "body" and "check" columns. That makes it too easy to re-concatenate them in the wrong order. Store the complete identifier as a single string.
- Skipping validation on internal SKUs. If your internal codes happen to be 12 or 13 digits, they'll look like GTINs but won't validate. Either give them an obviously non-GTIN format, or add a check digit of your own.
- Assuming a valid check digit means the GTIN exists. Mod-10 checks the math; it doesn't confirm the identifier was issued to a real company by GS1. For ownership verification you need GS1 Verified-by-GS1, not a local check.
What Is a Check Digit?
A check digit is a redundant digit added to an identification number so that a computer can tell whether the number was keyed or scanned correctly. It carries no information of its own: its value is fixed by the other digits.
A check digit detects errors but never corrects them. A failed check says that something in the number is wrong, not which digit, so a system should reject the input or ask for it again rather than guess.
In GS1 identification keys the check digit always takes the last position, and it is part of the key: the GTIN-13 5012345678900 is thirteen digits long including its final 0. A scanner verifies it on every read of an EAN or UPC symbol, and software should verify it again whenever a GTIN is typed, imported or copied from a document. The GTIN Validator runs that test on a complete 8-, 12-, 13- or 14-digit GTIN.
Luhn vs GS1 Mod 10
Luhn and GS1 mod 10 are both modulus-10 check digit formulas, but they weight the digits differently. GS1 multiplies the digits alternately by 3 and 1, while Luhn doubles every second digit and adds up the digits of each product.
The Luhn algorithm is the check on payment card numbers (ISO/IEC 7812-1) and on the IMEI numbers that identify mobile phones. GS1 mod 10 is the check on every GTIN, SSCC and GLN. The table sets the two side by side.
| Aspect | GS1 mod 10 | Luhn |
|---|---|---|
| Used on | GTIN, SSCC, GLN and other GS1 keys | Payment card numbers, IMEI |
| Weights, from the right of the body | 3, 1, 3, 1 … | 2, 1, 2, 1 … |
| Products of 10 or more | Added as they are | Digits added together (16 counts as 7) |
| Check digit | Lifts the total to a multiple of 10 | Lifts the total to a multiple of 10 |
| Adjacent swaps missed | Digits that differ by 5, such as 1 and 6 | Only 0 and 9 |
The two formulas give different answers for the same body. Luhn applied to 501234567890 returns a check digit of 8, not the 0 that GS1 mod 10 gives, so a Luhn routine would reject many correct EANs and pass some wrong ones. Use a GS1 routine, such as the one in the Check Digit Calculator, for anything printed in an EAN, UPC or GS1-128 barcode.
Check Digit Examples
The examples below show one worked GS1 check digit per identifier length, so you can compare your own results. In every case the check digit formula is the same: weight the body 3, 1, 3, 1 from the right, add the products, and take whatever lifts the sum to the next multiple of 10.
| Identifier | Body | Weighted sum | Check digit | Full number |
|---|---|---|---|---|
| EAN-8 (GTIN-8) | 7351353 | 63 | 7 | 73513537 |
| UPC-A (GTIN-12) | 03600029145 | 58 | 2 | 036000291452 |
| EAN-13 (GTIN-13) | 501234567890 | 90 | 0 | 5012345678900 |
| ISBN-13 | 978014303344 | 82 | 8 | 9780143033448 |
| GTIN-14 | 1061414100041 | 55 | 5 | 10614141000415 |
| SSCC | 10614141123456789 | 143 | 7 | 106141411234567897 |
The ISBN-13 row is the same book as the ISBN-10 0143033441 worked above: drop the old check digit, put 978 in front and recalculate with mod 10. The two check digits differ, 1 under mod 11 and 8 under mod 10, because each comes from its own formula.
Check Digit for a UPC Code
To find the check digit for a UPC code, take the first 11 digits of the UPC-A and count positions from the left. For 03600029145, the digits in odd positions (0, 6, 0, 2, 1, 5) add up to 14, and three times 14 is 42. The digits in even positions (3, 0, 0, 9, 4) add up to 16.
The total is 42 + 16 = 58, and the next multiple of 10 is 60, so the check digit is 2 and the full UPC-A is 036000291452. This is how a check digit is calculated for any 11-digit UPC body, and the Check Digit Calculator gives the same answer when you paste the body in.
A UPC-E has no formula of its own. Its check digit is the one calculated for the 12-digit UPC-A it expands to, so expand the UPC-E first and check that UPC-A.
Key takeaways
- Every UPC, EAN, GTIN, ISBN-13 and SSCC uses the same GS1 mod-10 check digit — right-to-left ×3/×1 weighting, sum to next multiple of 10.
- ISBN-10 is the odd one out: mod-11 with descending weights, and X as the check character for value 10.
- Mod-10 catches every single-digit error and about 89% of adjacent transpositions — the two most common re-keying mistakes.
- Code 128's modulo-103 checksum lives inside the symbol; it's verified silently and never appears in the decoded payload.
- If a supplied check digit doesn't match, flag the row for review — don't silently rewrite it.
References
The three algorithms in this guide are defined in these standards.
- GS1 General Specifications — defines the mod-10 algorithm for every GS1 identifier. Published by GS1 and updated annually.
- ISO 2108 (ISBN) — the international standard that defines ISBN-10 (mod-11) and ISBN-13 (GS1 mod-10). Available from the ISO catalogue.
- ISO/IEC 15417 (Code 128) — defines the modulo-103 checksum and the symbol's internal structure: iso.org/standards.
The fast path: paste a body into the Check Digit Calculator to compute the correct trailing digit, or a full identifier into the GTIN Validator to confirm the printed one matches.
Frequently Asked Questions
What's a check digit, in plain English?
It's an extra digit at the end of an identifier — UPC, EAN, GTIN, ISBN, SSCC — that's computed from the other digits using a fixed formula. If the rest of the number gets typed wrong, the computed value won't match the printed one, and the system flags the input as invalid before it does any damage.
Is the check digit the same algorithm for UPC, EAN, GTIN and ISBN-13?
Yes for the four most common cases. UPC-A, EAN-13, GTIN-8/12/13/14, ISBN-13 and SSCC all use the GS1 mod-10 algorithm. ISBN-10 is the odd one out — it uses a separate mod-11 algorithm with X as a possible check character. Code 128 has its own internal modulo-103 checksum that's invisible in the decoded string.
What Kinds of Typos Does Mod-10 Catch?
Every single-digit error (one digit typed wrong) is guaranteed to be caught. Most adjacent-digit transpositions (swapping two neighbouring digits) are caught too — except a handful of specific pairs like 0↔5 where the weighting cancels out. Together those are the two most common mistakes people make when re-keying a number, and catching them costs one extra digit.
Why does ISBN-10 use a different algorithm?
ISBN-10 predates GS1 mod-10 by a few years and was designed around a mod-11 check (which catches every single-digit error and every transposition of two digits). When ISBN-13 was introduced in 2007, the publishing industry standardised on the GS1 mod-10 already used everywhere else, so any new ISBN minted today uses the EAN-13 algorithm.
Where Does the X in Some ISBN-10s Come From?
It's the check character for the number 10 — mod-11 can produce a remainder of 10, which doesn't fit in a single decimal digit. The convention is to write X (the Roman numeral) instead. You'll only see X at the very end of an ISBN-10, never anywhere else.
Does Code 128's check digit appear in the decoded string?
No. Code 128's modulo-103 checksum is part of the symbol's internal structure, not the encoded payload. The scanner verifies it during decoding and either returns the plain payload or an error — your software sees clean text either way. Only the symbol designer needs to think about modulo-103.
Can a Check Digit Be Zero?
Yes. In GS1 mod 10 a check digit of 0 appears whenever the weighted sum of the body is already a multiple of 10, as with the GTIN-13 5012345678900 used throughout this guide. A 0 is just as valid as any other check digit and must be printed and stored like one.
What Is the Difference Between a Check Digit and a Checksum?
A check digit is a single character added to a number that people read, type and print, such as the last digit of a GTIN. Checksum is the broader term for any value computed from data to detect errors, and it can be longer or hidden, like the modulo-103 check character inside a Code 128 symbol that never appears in the decoded text. Every check digit is a kind of checksum, but not every checksum is a check digit.
Next Read
The identifier the check digit protects, in four lengths.
The symbology where the check digit is invisible — modulo-103 inside the symbol.
Compute the GS1 mod-10 check digit for a GTIN-8, 12, 13 or 14 body.
Confirm that a complete GTIN carries the right check digit.