Home › Guides › GTIN check digit
Verify a GTIN / EAN / UPC check digit
Short answer: Take the digits except the last one, multiply them alternately by 3 and 1 starting from the rightmost digit, add the results, and the check digit is the number that brings the sum up to the next multiple of 10. Example: 400638133393 → check digit 1, so the EAN-13 is 4006381333931.
The method (all lengths)
- Write the code without its last digit.
- Starting from the right, multiply digits by 3, 1, 3, 1 …
- Add the products.
- Check digit = (10 − (sum mod 10)) mod 10.
Worked example: 400638133393?
| Digit (from right) | 3 | 9 | 3 | 3 | 3 | 1 | 8 | 3 | 6 | 0 | 0 | 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 |
Sum of products = 89; next multiple of 10 minus the sum = 1. The full code is 4006381333931.
Valid lengths
8 (GTIN-8 / EAN-8), 12 (UPC-A), 13 (EAN-13 / GTIN-13), 14 (GTIN-14 / ITF-14). Anything else is not a GTIN.
What a valid check digit does not prove
It proves the digits are consistent, not that the code belongs to your product or was issued by GS1. Confirm ownership with the supplier or the packaging. The free checker validates length and check digit for the first 25 rows of a Shopify export and flags reused barcodes.
Questions
My barcode has 13 digits but fails the check — what now?
One digit was mistyped or the code is not a real GTIN. Re-copy it from the packaging or the supplier sheet; never adjust the last digit to make it pass.
Can I use a 12-digit UPC in an EAN-13 field?
Yes: a UPC-A is the same code with a leading zero as EAN-13. Customs systems accept GTINs of 8, 12, 13 or 14 digits.