Barcode BasicsCheck digitsData validation

UPC Check Digit: How to Calculate and Verify It

Calculate a UPC check digit by hand or with GS1's calculator, check a worked example, and learn what to do when the digits do not match.

Share
Table of contents

A UPC check digit is the final digit of a UPC-A’s 12-digit GTIN-12. It is calculated from the first 11 digits and helps detect errors in the number. To verify one, recalculate the check digit from those first 11 digits and compare it with the last digit. A match checks the number’s mathematical composition; it does not prove that the number belongs to a product or that the product is genuine. [1][2]

Find the check digit

Read the complete 12-digit number, including any small digits printed outside the main group of bars. Keep leading zeros. The final, rightmost digit is the check digit; the preceding 11 digits are the input to the calculation. If you are copying from a scanner or spreadsheet, compare the whole value with the label or the issuer’s original record before proceeding.

For this guide, the example is the GTIN-12 012345000058, published by GS1 as an example of data carried in UPC-A. Its first 11 digits are 01234500005, and its last digit is 8. [3]

Calculate a UPC-A check digit by hand

Use the 11 digits before the check digit. For UPC-A, count positions from the left, starting with position 1: [2]

  1. Add the digits in positions 1, 3, 5, 7, 9, and 11. Multiply that sum by 3.
  2. Add the digits in positions 2, 4, 6, 8, and 10.
  3. Add the two results. Find the smallest multiple of 10 that is equal to or greater than the total.
  4. Subtract the total from that multiple. The difference is the check digit. If the total is already a multiple of 10, the check digit is 0.

For 01234500005:

Calculation Result
Positions 1, 3, 5, 7, 9, 11: 0 + 2 + 4 + 0 + 0 + 5 11
Multiply by 3 33
Positions 2, 4, 6, 8, 10: 1 + 3 + 5 + 0 + 0 9
Total: 33 + 9 42
Next multiple of 10: 50; 50 − 42 8

The calculated digit matches the last digit in 012345000058. It is an illustration of the calculation, not a claim that this number is assigned to your product.

Use the GS1 calculator

  1. Open the GS1 check digit calculator.
  2. In GS1 key without check digit, enter the first 11 digits of your UPC-A, keeping any leading zeros. Do not include the existing final digit.
  3. Select Calculate. Compare the returned check digit with the final digit of your original 12-digit number. [1]

For the example above, entering 01234500005 returns 8. If the displayed result differs from the last digit on your source, review the whole number before changing anything. The calculator produces the digit for the input you give it; it cannot tell which digit was mistyped.

What if the check digit does not match?

  • Check the length and input. A UPC-A GTIN-12 has 12 digits in total. Enter the first 11, not all 12, into the calculator. Include small digits and leading zeros.
  • Compare each position with a trusted original. A mismatch means the digits are inconsistent with the calculation; it does not identify the wrong position or prove that only the final digit is wrong. Ask the brand owner or issuer if the source is unclear.
  • Check the destination’s requirements. For example, Google Merchant Center lists nonnumeric characters, incorrect length, and a failed check digit among causes of an invalid-format message. Use the manufacturer’s assigned GTIN and correct the submitted product data. [4]
  • If the check passes but the listing fails, keep investigating. Confirm that the number is assigned to the item and that the retailer’s product record and requirements match. A mathematically valid number can still be the wrong number for the item.

Do not replace the last digit just to make an existing product’s number pass. First determine the complete number assigned to that product from an authoritative source.

Does the same method work for other GTIN lengths?

GS1 uses the same alternating weights for GTIN-8, GTIN-12, GTIN-13, and GTIN-14: working from the rightmost data digit, multiply by 3, then 1, alternating as you move left. Add the products and take the difference to the next equal or higher multiple of 10. Use 7, 11, 12, or 13 data digits respectively, excluding the final check digit. Starting from the right avoids applying the UPC-A left-position pattern unchanged to a different length. [2]

This guide covers GS1 GTIN check digits. Other identifiers and barcode symbologies can use different rules; identify the number before applying a formula.

References

[1] GS1. Check digit calculator. https://www.gs1.org/services/check-digit-calculator

[2] GS1. How to calculate a check digit manually. https://www.gs1.org/services/how-calculate-check-digit-manually

[3] GS1. 2D Barcodes at Retail Point-of-Sale Implementation Guideline, release 1.1, section 4. https://ref.gs1.org/guidelines/2d-in-retail/1.1.0/

[4] Google Merchant Center Help. How to fix: Invalid GTIN in unsupported format. https://support.google.com/merchants/answer/12158484?hl=en