UPC Barcode Generator: How to Create a Scannable UPC-A or UPC-E Code

If you sell anything in the United States or Canada, the barcode on the package is almost certainly a UPC, and the moment you need one is usually the moment you have run out of patience for the software that came with your label printer. This page walks through what a UPC really contains, how to turn a number into a clean symbol with the browser tool on this site, and the handful of sizing rules that decide whether the code scans on the first sweep or fails at the register while a line grows behind the customer.

The tool itself is simple by design. You type a number, pick UPC-A or UPC-E from a menu, and the bars redraw as you type. Everything happens inside your own browser, so a code you generate for an internal prototype never leaves your machine.

What a UPC Actually Is

UPC stands for Universal Product Code, and the version you meet in the wild is UPC-A, a fixed twelve-digit number. The standard is old and stubborn: it was designed at IBM in 1973, and the first retail item ever scanned with one was a ten-pack of Wrigley's Juicy Fruit gum at a Marsh supermarket in Troy, Ohio, on 26 June 1974. Half a century later the same twelve digits still ring up groceries, and the scheme has outlasted every attempt to replace it.

The number the bars encode is called a GTIN-12, which is just the formal name for a UPC-A value. The bars themselves are only a way of writing that number so a laser can read it in a fraction of a second and in either direction. That distinction matters, because it is where most beginners get stuck: the image is free and easy to make, while the number inside it is licensed and has to be unique. You can draw a perfect symbol in ten seconds, but you cannot invent a legitimate product number to put inside it, and the rest of this page keeps coming back to that split.

The Twelve Digits of a UPC-A, Decoded

A UPC-A is not one long number, it is four fields stacked together, and each field is owned by a different party. Reading them left to right tells you who is responsible for what.

PartDigitsWhat it identifiesWho assigns it
Number system1 (first)Product category: 0, 1, 6, 7, 8 for regular goods, 2 for variable-weight items, 3 for drugs, 5 for couponsGS1
Manufacturer prefix5The brand owner the prefix is licensed toGS1, to your company
Item reference5The specific product, size, colour or flavourYou, the brand
Check digit1 (last)A modulo-10 checksum over the other elevenCalculated

The first digit is a category flag rather than a hard rule. A regular packaged good starts with 0 or 1 in practice, a supermarket scale label for loose produce opens with 2, a pharmacy item can open with 3, and the 5 prefix marks a coupon. For most sellers the number begins with 0, which is also why a UPC-A and its EAN-13 twin are so easy to confuse.

The middle ten digits carry the real identity. The first five are your GS1 prefix, shared by every product your company sells, and the next five are the item reference you assign yourself. That means one company controls the last five digits of its own codes, so two products from the same brand differ only in that block plus the check digit. Each size, colour and flavour counts as a separate product with its own number, which is the detail small sellers miss when they plan a product line.

UPC-A, UPC-E, and EAN-13 Compared

Three formats show up in retail conversations often enough that they are worth separating before you generate anything.

FormatDigitsWhere it is usedNotes
UPC-A12Products sold in the US and CanadaThe default North American retail code
UPC-E8 on the labelSmall packagesA compressed UPC-A, only for numbers with enough zeros
EAN-1313Products sold internationallyA UPC-A is an EAN-13 with a leading zero

UPC-A and EAN-13 are the same code wearing different hats. Add a zero to the front of a UPC-A and you have its EAN-13 form, which is why a North American product number shows up as a leading zero whenever an international system reads it. Modern scanners handle both, and since 1 January 2005 North American checkout systems have been required to read the European form as well.

UPC-E is different in kind. It is not a shorter number, it is the same UPC-A number with predictable zeros squeezed out, and only certain values can be shortened at all. The reason to care is space: a small tube of lip balm or a single pen often cannot fit a full UPC-A at a legal size, so a UPC-E symbol lets the same product carry a scannable code. GS1 US no longer licenses new prefixes built for UPC-E, so for a new product sold today the practical answer is usually to scale a UPC-A down to its 80 percent floor or to ask about an EAN-8 instead.

Making a UPC in the Browser

Generating the symbol is the easy half. Open the tool, choose UPC-A or UPC-E in the Type menu, and type your number into the Data field. The bars appear immediately and redraw on every keystroke, so there is no generate button and no wait. If you would rather see a finished example before entering real data, choosing a format drops in a valid sample value for it; the UPC-A sample is a valid twelve-digit code you can inspect.

Four sliders control how the symbol is drawn, and each maps to a real measurement. Bar width sets the width of the narrowest bar, which is the X-dimension of the whole symbol, and it runs from 1 to 5 pixels. Height stretches the bars from 50 to 200 pixels, and taller bars give a checkout scanner a larger target to hit. Margin is the quiet zone, the blank strip on each side that tells the scanner where the code starts and stops. Font size sets the digits printed underneath, the human-readable line a cashier can check by eye.

When the symbol looks right, Copy puts the image on your clipboard for pasting into a label template, and Download saves it as a PNG named from the filename field. Naming files after the product number rather than leaving every download as barcode.png turns a folder of identical images into a set you can still match to products a month later.

Working Out the Check Digit

The twelfth digit of a UPC-A is not chosen, it is calculated, and knowing the arithmetic is useful because it lets you verify a number before you print anything. Working along the eleven data digits from the left, the digits in the odd positions are multiplied by three, the digits in the even positions by one, the products are added, and the check digit is whatever brings that total up to the next multiple of ten.

Take the sample value 12345678901, the eleven data digits of the code the tool fills in with its UPC-A button.

Position1234567891011
Digit12345678901
Weight31313131313
Product32941562182703

The odd-position digits sum to 26, and 26 × 3 is 78; the even-position digits sum to 20, so the weighted total is 98. The next multiple of ten is 100, which leaves a check digit of 2, and that is exactly why the sample number ends in a 2. The complete code is 123456789012, and the same arithmetic covers UPC-A, EAN-13, EAN-8 and the fourteen-digit shipping code.

The scheme is worth trusting because of what it catches. A single wrong digit always changes the checksum, and a swipe of two adjacent digits is caught in roughly nine cases out of ten. When you type a value of the wrong length for the selected format, the tool shows an error rather than quietly drawing a symbol for something else, which is exactly the behaviour you want before a print run rather than after.

Where the Number Comes From

Here is the part nobody can skip. The barcode image is free, and this generator will draw one for any value you supply, but a product headed to a retailer needs a real number, and in the US that number comes from GS1 US. GS1 issues either a single GTIN or a company prefix, and a prefix is what lets you assign numbers to your own products without going back to GS1 each time.

The prices have shifted over the years, and a single GTIN has become the cheap entry point for very small sellers, while a company prefix is licensed in blocks and carries an annual renewal once you hold enough numbers. A reseller may offer codes more cheaply than GS1, but those numbers were licensed to another company years ago, and the registry still lists that company as the owner. Amazon and most large retailers check the GS1 database, so a resold number can scan beautifully at the register and still get a listing pulled during review.

The rule to hold on to is that each distinct product, size, colour and flavour needs its own number. Planning for that up front is cheaper than discovering it after a range of six variants arrives with one code between them.

Sizing a UPC for the Register

Once the number is correct, physical size decides whether it scans. At 100 percent magnification a UPC-A is 37.29 by 25.93 millimetres, and GS1 allows printing between 80 and 200 percent of that, which puts the narrowest bar between 0.264 and 0.660 millimetres. Below the 80 percent floor the symbol is out of specification for point of sale, and a retailer is allowed to reject it.

SettingTargetWhy it matters
X-dimension0.33 mm at 100 percent80 to 200 percent magnification is the legal range
Quiet zone9× the bar width each sideWithout it the scanner cannot find the symbol's edges
Bar height25.9 mm nominalTruncating the bars removes redundancy
Print resolution300 dpi minimumBelow that, bars round to the wrong width

The quiet zone trips people up more than any other number. A scanner uses the blank space at each end to work out where the symbol begins, so a UPC printed flush against a label edge or crowded by artwork may not read at all. At nominal size the retail minimum works out to roughly two and a half millimetres of clear space on each side, and the tool's margin slider is how you add it. A bar width of 2 pixels with a 10 pixel margin is a quiet zone of five modules, which sits under the nine-module target, so for a retail code raise the margin to at least 18 pixels.

Why a UPC Fails at the Checkout

When a code will not scan, the cause is almost always one of a few predictable problems, and they are worth checking in this order.

SymptomLikely causeFix
Nothing reads, bars look sharpQuiet zone cropped by artworkRaise the margin to at least nine times the bar width
Reads on a phone, fails on a laserBars too thin for the printerWiden the bar, or print at 300 dpi or higher
Fails after being resizedAuto-scaling blurs the bar edgesPrint at 100 percent and never fit-to-page
Retail scanner rejects a valid codeWrong check digit or numberRecheck the number against the GS1 registry
Intermittent reads across a rollBar width not a whole number of dotsPick an X-dimension that is a multiple of the printer dots

The most expensive failure is the number itself rather than the bars. A code bought cheaply from a reseller can look perfect and still fail because GS1 lists a different company as its owner, and a listing that gets pulled during review is far more disruptive than a barcode that simply refuses to scan. Printers come second: a printer can only lay down whole dots, so if the module width is not a multiple of the dot size some bars come out a dot wider than others and the symbol loses its precision without any visible sign.

Frequently Asked Questions

How many digits does a UPC-A barcode have?

Exactly twelve. The first eleven carry the number-system digit, the five-digit manufacturer prefix and the five-digit item reference, and the twelfth is a modulo-10 check digit the generator can help you verify.

What is the difference between UPC-A and UPC-E?

UPC-A is the standard twelve-digit code. UPC-E is a shorter eight-digit form made by squeezing out predictable zeros from certain UPC-A numbers; only values that contain those zeros can be shortened, so not every product qualifies.

How is the UPC check digit calculated?

Multiply the odd-position digits by three, add the even-position digits, then choose the digit that lifts the total to the next multiple of ten. For 12345678901 the total is 98 and the check digit is 2.

Where do I get a UPC number?

From GS1 US, or your country's GS1 office, which licenses a single GTIN or a company prefix to your brand. Retailers and marketplaces verify ownership against GS1 records, so a resold or invented number can be refused even when the barcode scans.

What size should a UPC barcode be?

A UPC-A is 37.29 by 25.93 millimetres at 100 percent and may be printed from 80 to 200 percent. Keep the blank margin on both sides, avoid cutting the bar height, and print at 300 dpi or more so the narrowest bar survives.

Can I use a resold UPC from a marketplace?

You can, but it is risky. Resold numbers were licensed to another company, and Amazon and many large retailers check the GS1 database and reject listings whose owner does not match. A single low-cost GTIN is the safer route for a few products.

Does the tool upload the number I type?

No. The symbol is drawn on a canvas inside your browser, so the value you enter is never sent to a server, stored, or logged. That makes it usable for asset numbers and other values you would rather not paste into an online form.

Final Word

A UPC barcode generator solves one half of a two-part problem, and it is the half you can finish in a browser in under a minute. The other half, the licensed number, is the part that takes a little planning, so sort out your GS1 prefix before you design packaging and let the generator handle the symbol from there.

Choose UPC-A for anything that will cross a retail checkout in the United States or Canada, size the bars for the register rather than for the artwork, and print at 100 percent. Test one printed label with the actual scanner before a full run, and the codes that reach the shelf will read on the first sweep.

shannoga
shannoga

Israel · SO reputation 19909 · Badges: 21🥇112🥈175🥉 · SO member since 2010