The GS1 modulo-10 algorithm
- Exclude the check digit position.
Start with the 7, 11, 12 or 13 data digits that will precede the final digit.
- Work from the right.
Multiply the rightmost data digit by 3, the next digit by 1, and continue alternating 3 and 1 as you move left.
- Add the products.
The result is the weighted sum of all data digits.
- Move to the next multiple of ten.
Subtract the sum from the nearest equal or higher multiple of ten. The difference, from 0 to 9, is the check digit.
A compact formula is (10 − (sum mod 10)) mod 10. The final modulo handles the case where the sum is already a multiple of ten, producing a check digit of zero.
Worked example: data digits 629104150021
This GTIN-13 example is published by GS1 and was separately recomputed for this guide rather than being taken from ProductPassKit’s implementation.
| Digit | 6 | 2 | 9 | 1 | 0 | 4 | 1 | 5 | 0 | 0 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 6 | 6 | 9 | 3 | 0 | 12 | 1 | 15 | 0 | 0 | 2 | 3 |
- The weighted products total 57.
- The next multiple of ten is 60.
- 60 − 57 = 3, so the check digit is 3.
- The complete GTIN-13 is
6291041500213.
How to verify the result
Append the calculated digit, then validate the complete GTIN. A validator should report both the detected format and the expected check digit. If it fails, first check the direction of the alternating weights: the rightmost data digit is weighted by 3.
You can also repeat the arithmetic independently in a spreadsheet or another trusted calculator. Independent verification is especially useful before identifiers are loaded into packaging, catalogue or master-data systems.
A correct check digit is not an assigned GTIN
The algorithm checks internal consistency only. It does not issue an identifier, confirm a GS1 licence, identify an owner or establish that the number belongs to a particular product. Keep mathematical validation separate from registry and governance checks.
Sources and standards
Technical statements in this guide are grounded in current GS1 primary sources. The explanations are paraphrased for practical use.
- GS1: How to calculate a check digit manuallyOfficial worked example used and independently recomputed on this page.
- GS1 General Specifications, section 7.9Normative standard check-digit algorithm for fixed-length numeric GS1 data structures.