Home / Guides / How a GTIN Check Digit Is Calculated, and Why Google Rejects Wrong Ones

How a GTIN Check Digit Is Calculated, and Why Google Rejects Wrong Ones

Every GTIN ends in a check digit calculated from the other digits. Merchant Center checks it, and so should you before you upload. This guide shows the calculation by hand, the conversions Google asks for and the prefixes it refuses.

By Arkadiusz Van Born. Updated 2026-12-03 (America/Phoenix).

What the check digit is for

A GTIN (Global Trade Item Number) is the number under a barcode. UPC in North America, EAN in Europe, JAN in Japan and ISBN for books are all GTINs. The last digit is not part of the product number: it is a check digit calculated from the other digits, so a scanner or a system like Merchant Center can tell at once when a number has been mistyped. Google's GTIN attribute page requires that the check digit is present and correct, and points to the GS1 check digit calculator.

The four lengths

Google accepts 8, 12, 13 or 14 digits and ignores spaces and dashes.

The calculation, step by step

The GS1 method is the same for every length:

  1. Take all digits except the last one.
  2. Starting from the right, multiply the digits alternately by 3 and 1. The digit next to the check digit is always multiplied by 3.
  3. Add up the results.
  4. The check digit is what you must add to reach the next multiple of 10. If the sum is already a multiple of 10, the check digit is 0.

Example: a UPC-A

Take 036000291452. The first 11 digits are 0 3 6 0 0 0 2 9 1 4 5. From the right, the weights are 3, 1, 3, 1 and so on:

The sum is 58. The next multiple of 10 is 60, so the check digit is 2, which matches the last digit. The number is valid.

Example: an EAN-13

Take 4006381333931. The first 12 digits, from the right, with weights 3 and 1: 3×3 + 9×1 + 3×3 + 3×1 + 3×3 + 1×1 + 8×3 + 3×1 + 6×3 + 0×1 + 0×3 + 4×1 = 9 + 9 + 9 + 3 + 9 + 1 + 24 + 3 + 18 + 0 + 0 + 4 = 89. The next multiple of 10 is 90, so the check digit is 1. Valid. If someone typed 4006381333932, the last digit would not fit and Merchant Center would report an invalid GTIN.

The GTIN checker does this for thousands of values at once and shows the expected digit when one is wrong.

Why this catches typos

Changing any single digit changes the weighted sum by a number that is not a multiple of 10, so the old check digit no longer fits. Swapping two neighbouring digits is caught too, unless the two digits differ by exactly 5 (for example 1 and 6), because one moves from weight 3 to weight 1 and the other the opposite way. That is why the check is good at catching keyboard mistakes and bad at catching anything else: a completely different but real GTIN, or an invented number that someone ran through a calculator, passes.

Leading zeros

Because the weights start from the right, leading zeros never change the check digit. 036000291452 (12 digits), 0036000291452 (13) and 00036000291452 (14) are the same GTIN. That is useful, and it is also why spreadsheets are dangerous: a spreadsheet that treats the column as numbers removes the leading zero and leaves 11 digits, which is not a valid length. Long numbers can also be turned into scientific notation, such as 8.85E+12, which destroys the last digits completely. Format barcode columns as text, always, before you paste or import.

Converting UPC-E to UPC-A

UPC-E is a compressed 8-digit form of some UPC-A numbers, printed on small packages. It starts with the number system digit (0 or 1), has six data digits and ends with the check digit. The expansion depends on the last of the six data digits:

The UPC-A is the number system digit, the five manufacturer digits, the five product digits and the same check digit. For example, UPC-E 01234505 expands to UPC-A 012000003455. The GTIN checker shows this expansion for 8-digit codes that start with 0 or 1, because an 8-digit number can also be a genuine EAN-8, and only the package tells you which one you have.

Converting ISBN-10 to ISBN-13

Older books carry a 10-character ISBN whose last character can be X. To convert, drop the old check character, put 978 in front of the first nine digits and calculate a new GS1 check digit. 0306406152 becomes 978030640615 plus check digit 7: 9780306406157. Google says to submit only the 13-digit number if you have both, and to use the ISBN-13 as the GTIN for books.

Prefixes Google rejects

A correct check digit is not enough. Google also lists number ranges it does not accept:

The prefixes are read in the 13-digit form. A 12-digit UPC starting with 2 becomes 02 in that form, and one starting with 4 becomes 04, so both are restricted. A GTIN-13 starting with 978 or 979 is an ISBN (the "Bookland" range), which is correct for books.

What the check digit cannot prove

The check digit protects against typos, not against using the wrong number. Many errors that matter to Google pass it: the GTIN of a different variant, a GTIN copied from a similar product, or an invented number with the right last digit. Google compares GTINs with other data and may report an incorrect identifier even when the number is valid. Google is explicit: if you are unsure of a GTIN, do not submit one. For products that genuinely have none, read products without a GTIN, and for the Merchant Center errors themselves, how to fix a missing or invalid GTIN.

Questions

What is a check digit?

The last digit of a GTIN. It is calculated from all the other digits with the GS1 modulo 10 method, so most typing errors produce a number whose last digit no longer fits.

Does the calculation differ between UPC and EAN?

No. The same method works for GTIN-8, GTIN-12, GTIN-13 and GTIN-14. Weights of 3 and 1 alternate, starting with 3 on the digit just left of the check digit.

Can a number with a correct check digit still be wrong?

Yes. Every real GTIN passes the check, so the GTIN of another product passes too. The check digit catches all single-digit typos and most swaps of neighbouring digits, not every error.

Should I add leading zeros to make every GTIN 14 digits?

You can submit 8, 12, 13 or 14 digits. Leading zeros do not change the check digit, so a 12-digit UPC and the same number padded to 13 or 14 digits are the same GTIN. Never remove zeros that belong to the number.

Why does Google reject numbers starting with 2?

GTIN-13 numbers starting with 2, and UPC numbers starting with 2 or 4 (02 and 04 in 13-digit form), are restricted circulation numbers used for in-store items such as weighed products. They are not unique worldwide.

Google, Merchant Center, YouTube, LinkedIn, Indeed, Glassdoor and Shopify are trademarks of their owners. Van Born Labs is independent and not affiliated with them. Google's own help pages are the final word on its rules.