Skip to content
StylQR home
Barcode Guides

What Is a UPC Barcode and How Does It Work?

What a UPC barcode is, what its 12 digits mean, how the check digit is calculated, the right print size, and how to get a genuine UPC from GS1 US.

By StylQR Editorial TeamPublished 5 min read

StylQR blog cover: What Is a UPC Barcode and How Does It Work?, illustrated with a retail barcode with a shopping cart, numbers and a flag on a sea green background
Table of contents

A UPC barcode is the 12-digit barcode printed on almost every retail product sold in the US and Canada. Its full name is UPC-A (Universal Product Code, version A), and the number it carries is a GTIN-12: a company prefix licensed from GS1, an item number the company assigns, and a check digit.

When a cashier scans it, the till looks up that number in the store's product file to find the name and price. This guide covers what each part means, how the check digit is worked out, how big to print it, and how to get a real one.

A short history

The grocery industry in the US picked the UPC design in 1973, based on a proposal from an IBM team that included engineer George Laurer. The first item scanned at a checkout with one was a pack of Wrigley's Juicy Fruit gum at a Marsh supermarket in Troy, Ohio, on 26 June 1974. The organization set up to manage the numbers, the Uniform Code Council, is now GS1 US.

What the 12 digits mean

Take the illustrative number 098765432105. It splits into three parts:

PartExampleWho sets it
U.P.C. company prefix0987654 (6 to 10 digits)GS1 US licenses it to your company
Item reference3210 (the remaining digits)You, one per product variant
Check digit5Calculated from the other 11

The longer your company prefix, the fewer item numbers it leaves you. A prefix sized for 10 products has room for 10 item references; one sized for 100,000 has many more.

The first digit has traditional meanings. Numbers starting with 2 are for variable-weight items packed in store, 3 for drugs under the US National Drug Code, 4 for in-store use such as loyalty cards, and 5 for coupons. Regular products use the other digits.

How the check digit is calculated

The last digit lets the scanner catch misreads. It uses the GS1 mod-10 method. Here it is for the first 11 digits of our example, 09876543210:

  1. Add the digits in odd positions (1st, 3rd, 5th and so on from the left): 0 + 8 + 6 + 4 + 2 + 0 = 20.
  2. Multiply that by 3: 20 × 3 = 60.
  3. Add the digits in even positions: 9 + 7 + 5 + 3 + 1 = 25.
  4. Add the two results: 60 + 25 = 85.
  5. Find what brings it to the next multiple of 10: 90 − 85 = 5.

So the full UPC is 098765432105. If the total already ends in 0, the check digit is 0. This catches every single-digit typo and most swaps of two neighbouring digits.

Tip: The UPC-A barcode generator validates this as you type. Enter 11 digits and it adds the check digit; enter 12 with a wrong last digit and it offers the corrected one.

How the bars encode the number

A UPC-A symbol is 95 modules wide, where a module is the width of the thinnest bar. Each digit takes 7 modules, drawn as two bars and two spaces of varying widths. Taller guard bars at the left, center and right frame two groups of six digits.

Digits on the left half and right half use mirror-image patterns. That lets the scanner work out which way it's reading, so a code passed upside down still scans correctly. A scanner never needs the digits printed underneath; those are for people when a code won't scan.

UPC-E for small packages

UPC-E squeezes certain UPC-A numbers into six digits by dropping zeros, for items like gum or cosmetics where a full UPC-A won't fit. It only works for numbers starting with 0 or 1 that have enough zeros in the right places, so not every UPC-A can become a UPC-E. The UPC-E generator draws the six-digit form for a number that qualifies.

GS1 sets the size in terms of the X-dimension (module width). At 100% magnification the X-dimension is 0.33 mm, which makes a UPC-A about 37.3 mm wide including its margins and about 26 mm tall. The allowed range is 80% to 200%, which works out to an X-dimension of roughly 0.26 mm to 0.66 mm.

A few rules worth following:

  • Keep the quiet zone. UPC-A needs clear space of at least 9 modules on each side, according to GS1 Sweden's size guide. Text or artwork in that margin is a common cause of failed scans.
  • Don't cut the height. Shortening the bars ("truncation") makes the code harder to scan from different angles. Retailers often reject it.
  • Use dark bars on a light background. Black on white is safest. Red bars disappear under a red scanner light.
  • Place it on a flat area away from seams and folds. On small bottles and tubes, rotate the code so the bars run horizontally, which keeps the edges of the code from curving out of view.

How to get a genuine UPC

You license UPC numbers from GS1 US (or GS1 Canada in Canada). GS1 US offers two routes on its how to get a UPC barcode page: a single GTIN for one product, or a company prefix that covers many products with an annual renewal. Pricing changes, so check the site.

Once you have your numbers:

  1. Assign one to each product variant and record it in your product list.
  2. Make the barcode at the size your packaging allows.
  3. Download it as SVG or an exact-size PDF for your printer.
  4. Print a proof and scan it before the full run.

StylQR doesn't issue UPC numbers. It draws the barcode for a number you already own. If you'd rather sell outside North America first, the EAN-13 guide explains the 13-digit version, and UPC vs EAN compares the two.

Where to go next

For the step-by-step from license to printed label, read how to create a barcode for your products. If you have a whole range to label, generating multiple barcodes at once saves typing each number, and the bulk barcode generator takes a spreadsheet of UPCs directly.

Frequently asked questions

What does UPC stand for?

UPC stands for Universal Product Code. It was adopted by the US grocery industry in 1973 and first scanned at a checkout in 1974.

Can two products share one UPC?

No. Every distinct product variant, including each size, color and pack count, needs its own number. Reusing a UPC causes the wrong item and price to appear at checkout.

Can I transfer a UPC from one product to another?

Treat a UPC as belonging to one product for good. GS1 sets strict rules on reusing GTINs, so check the GTIN management rules on the GS1 US site before reassigning any number.

Does the UPC contain the price?

No. The store looks up the price in its own system using the UPC. The exception is in-store labels for weighed items, which use numbers starting with 2 that can include a price or weight.

Share this guide

StylQR blog cover: 1D vs 2D Barcodes: Key Differences Explained, illustrated with a one-dimensional barcode beside a two-dimensional code with width arrows on a ocean background

Barcode Guides

1D vs 2D Barcodes: Key Differences Explained

1D vs 2D barcodes compared: how much data each holds, error correction, scanner needs, print size and cost, with clear advice on when to use each type.

· 4 min read

StylQR blog cover: How Do Supermarkets Scan Barcodes?, illustrated with a shopping cart with a barcode, a scanner frame and a receipt on a plum background

Barcode Guides

How Do Supermarkets Scan Barcodes?

How barcode scanners work at the supermarket checkout: laser and camera scanners, how the number becomes a price, weighed items, and why some codes won't scan.

· 5 min read