GS1 Prefix Check Calculator

Enter a GTIN-8, UPC, EAN-13 or GTIN-14 barcode to validate its GS1 check digit.

How it is calculated

The tool strips everything except digits, so spaces and hyphens are ignored, and needs exactly 8, 12, 13 or 14 digits (GTIN-8, GTIN-12/UPC-A, GTIN-13/EAN-13 and GTIN-14); 9, 10, 11 or more than 14 digits give no result. The last digit is the check digit; the rest is the payload. Working from the right end of the payload, the digits are multiplied by 3, 1, 3, 1 and so on, and the products are added up. computed check = (10 − sum mod 10) mod 10. If it equals the last digit you typed, the code is valid (shown as Yes), otherwise invalid (No). It also shows the code length, the typed check digit, the computed one and the first three digits as the prefix block. It only checks the digits are consistent: it does not look up the company or country of the prefix, and it does not confirm the product exists.

Worked example

Check the 13-digit code 4006381333931. Step 1: payload = 400638133393, check digit = 1. Step 2: weights from the right are 3, 1, 3, 1...; the sum is 4×1 + 0×3 + 0×1 + 6×3 + 3×1 + 8×3 + 1×1 + 3×3 + 3×1 + 3×3 + 9×1 + 3×3 = 89. Step 3: 89 mod 10 = 9, and 10 − 9 = 1. The computed digit 1 equals the typed digit 1, so the code is valid; the prefix block shown is 400. Changing the last digit to 2 would flag it invalid.

Try this example →

Common mistakes

  • Typing a digit wrong or swapping two neighbours; the check usually catches single mistakes but not every swap.
  • Leaving out the leading zero of a UPC-A or EAN-13 code that a spreadsheet turned into a shorter number.
  • Assuming a valid check digit means the barcode is registered to a real product or company; it only means the arithmetic is consistent.
  • Reading the three-digit prefix as the country where the product was made; it indicates the GS1 office that issued the number.
  • Entering a code that includes extra characters such as an add-on number or a price code after the main barcode.

Sources

About this calculator

GS1 barcode numbers — GTIN-8, UPC-A (GTIN-12), EAN-13 and GTIN-14 — end in a check digit computed with a weighted modulo-10 algorithm: starting from the rightmost digit, alternating positions are multiplied by 3 and 1, the products summed, and the check digit is whatever makes that sum a multiple of 10. The leading digits also encode a GS1 company prefix, a block assigned to the manufacturer by a national GS1 member organization, which is how a scanner can trace a product back to its brand owner.

This calculator takes a barcode number of 8, 12, 13 or 14 digits (the lengths GS1 defines a check digit for), recomputes its check digit to confirm it's valid, and shows the first three digits, the GS1 prefix block, separately (it does not look up the company or registrant behind the number). Retail and inventory staff verifying supplier data, e-commerce sellers listing products on marketplaces, and packaging designers laying out new barcodes use it to catch a mistyped digit or a malformed GTIN before it causes a scan failure at the register or a rejected marketplace listing.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    A UPC-A code and the same number written as a 13-digit EAN with a zero in front share one check digit, so both give the same Yes or No here. The prefix block shown is simply the first three digits as typed, so the two forms show different prefixes. If you are validating a supplier list, run a few codes in both forms. Which barcode type do you check most often?

Popular calculators

All Calculators