GTIN Check Digit Calculator: UPC, EAN-13, GTIN-14 and SSCC Check Digits
By FindMySum · Last reviewed
A GTIN check digit calculator works out the last digit of a product barcode number, or checks that a full number is correct. Every GTIN (the number under a UPC or EAN barcode), every GLN location number and every SSCC pallet code ends with a check digit computed by one rule from the GS1 General Specifications: weight the digits 3, 1, 3, 1 from the right, add them up, and pick the digit that brings the total to a multiple of ten. This page shows the weighting digit by digit, tells you which kind of number you entered, and runs in your browser. The worked example uses the default, the EAN-13 body 400638133393.
Where the check digit comes from
GS1, the organisation behind retail barcodes, defines the check digit in section 7.9.1 of its General Specifications. The rule is the same for all fixed-length numeric keys:
- Write down the number without its check digit.
- Starting with the rightmost digit, multiply the digits by 3, 1, 3, 1, and so on, moving left.
- Add up all the products.
- The check digit is the amount needed to reach the next multiple of ten: (10 − sum mod 10) mod 10. If the sum is already a multiple of ten, the check digit is 0.
Lining the weights up from the right is what lets one rule serve numbers of 8, 12, 13, 14 and 18 digits.
Worked example: an EAN-13
Take the default body 400638133393 (12 digits). From the right, the digits 3, 9, 3, 3, 3, 1, 8, 3, 6, 0, 0, 4 get the weights 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1:
- 3 × 3 = 9, 9 × 1 = 9, 3 × 3 = 9, 3 × 1 = 3, 3 × 3 = 9, 1 × 1 = 1
- 8 × 3 = 24, 3 × 1 = 3, 6 × 3 = 18, 0 × 1 = 0, 0 × 3 = 0, 4 × 1 = 4
The products add up to 89. The next multiple of ten is 90, so the check digit is 1 and the full EAN-13 is 4006381333931, the number printed under the barcode on a well-known brand of highlighter. Change any one of those thirteen digits and the check fails, which is how a till or a warehouse system knows to reject a mistyped code.
The kinds of numbers it covers
| Number | Digits | Typical use |
|---|---|---|
| GTIN-8 (EAN-8) | 8 | Small packs where a full barcode won't fit |
| GTIN-12 (UPC-A) | 12 | Products sold in Canada and the United States |
| GTIN-13 (EAN-13) | 13 | Products elsewhere, and books (ISBN-13) |
| GTIN-14 | 14 | Cases and cartons (ITF-14 barcodes) |
| GLN | 13 | Companies, stores and warehouse locations |
| SSCC | 18 | Individual pallets and shipping units |
A UPC-A and an EAN-13 are the same family: put a 0 in front of a UPC-A and you have a valid EAN-13 with the same check digit. A UPC-E is a UPC-A with runs of zeros squeezed out for small packages; it is checked by expanding it back to the UPC-A first, which the calculator does when you pick UPC-E.
Using the calculator
Pick "Calculate the check digit" and paste the number without its last digit, or "Check a full number" and paste the whole thing. Spaces, dashes and a leading application identifier such as (01) or (00) are ignored, so you can copy a number straight from a label. Leave the type on Automatic unless the number is 13 digits and you mean a GLN rather than an EAN-13, or it is a UPC-E. The results also show the 14-digit form that product databases store, the UPC-E form of a UPC-A when one exists, and a note when the prefix means a book, a coupon or a restricted in-store number.
GS1 mod 10 versus Luhn
Card numbers, Canadian SINs and phone IMEIs use a different mod 10 scheme, the Luhn algorithm, which doubles every second digit and adds the digits of the results. The two are easy to confuse because both finish by rounding up to a multiple of ten, but they give different check digits for the same body. If a supplier's barcode keeps failing, check it isn't being run through a Luhn validator by mistake; the Luhn algorithm calculator handles card-style numbers.
Mistakes that get products rejected
Inventing numbers. A number with a correct check digit can still belong to someone else. Retailers and online marketplaces check the company prefix against GS1's registry, so get numbers from GS1 (in Canada, GS1 Canada) rather than from barcode resellers.
Dropping leading zeros. Spreadsheets love to turn 036000291452 into 36000291452. The check digit still passes when the zero comes back, but an 11-digit number isn't a valid key. Store GTINs as text.
Reusing a GTIN for a changed product. A new size, a new flavour or a bundle needs its own GTIN under GS1's allocation rules, even though the old number still passes the check.
Making a case code by changing the first digit. A GTIN-14 for a carton changes the indicator digit, which changes the sum, so the check digit must be recalculated rather than copied from the item's GTIN-13.
Once the number checks out, the barcode generator can draw it as an EAN-13, UPC-A or ITF-14 barcode. For working with remainders in general, see the modulo calculator.
More questions
Can I make up my own barcode numbers if the check digit is right?
You can make a number that passes the check, but it isn't yours to use on products you sell. Retailers, Amazon and Google Shopping match GTINs against the GS1 registry, and a number outside your licensed company prefix can be rejected or clash with someone else's product. Numbers starting with 2 (or 02 and 04 on a UPC) are reserved for in-store use, such as weighed deli items.
Why does the weighting start with 3 on the right instead of the left?
So that every GS1 key, from 8 to 18 digits, uses one rule. GS1 lines all keys up on the right, at the check digit, as if they were padded with leading zeros to 18 digits. Leading zeros add nothing to the sum, so an EAN-13 and the same number written as a 14-digit GTIN give the same check digit.
What errors does the GS1 check digit catch?
Every single wrong digit, because multiplying by 1 or 3 never maps two different digits to the same last digit of the product. It also catches most swaps of two neighbouring digits, except when the two digits differ by 5 (for example 1 and 6 swapped), because 3 × 5 = 15 ends in 5 just like 1 × 5. Scanners also read the bars twice, so real misreads are rare.
Is an ISBN the same thing as a GTIN?
A 13-digit ISBN is a GTIN-13 in the 978 or 979 prefix, so it has the same check digit rule and prints as an EAN-13 barcode. Older 10-digit ISBNs use a different, mod 11 check digit that can be X, so converting an ISBN-10 to an ISBN-13 means adding 978 at the front and recalculating the last digit.
Do I need a check digit for an SSCC on a pallet label?
Yes. The Serial Shipping Container Code is 18 digits: an extension digit, your GS1 company prefix, a serial reference and a check digit computed with the same 3-1 weighting. It is printed after the application identifier (00) in a GS1-128 barcode, and warehouse systems reject labels whose check digit is wrong.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.