EAN-13, UPC, Code 128 and More: Choosing the Right Barcode
What each common barcode type is for, why store products need GS1 numbers, how check digits work and how big to print a barcode so it scans.
Updated: 7 min read
Barcodes look alike at first glance: a row of black bars with some digits underneath. But they come in different “symbologies”, each with its own rules about which characters it can hold, how long it can be and where it is expected. Pick the wrong one and a supermarket scanner may ignore your product, or a warehouse system may reject your labels. This guide explains the common types, when you need officially issued numbers and how to print a barcode that actually scans.
Two families: retail codes and general-purpose codes
It helps to split barcodes into two groups. Retail codes such as EAN-13, EAN-8 and UPC-A carry a product number in a fixed format, and checkout systems all over the world expect them. General-purpose codes such as Code 128, Code 39 and Codabar can hold letters as well as digits and have flexible lengths. They are used inside companies, libraries, warehouses and workshops, where you decide what the code means.
vupdf's barcode generator supports seven formats: EAN-13, EAN-8, UPC (the 12-digit UPC-A), Code 128, Code 39, ITF-14 and Codabar. If you type a number that looks like a retail product code while another format is selected, it suggests switching, because shop scanners expect the retail format.
The retail formats
EAN-13
The barcode on most packaged goods worldwide. It encodes a 13-digit number, the GTIN-13, made up of a company prefix issued by GS1, an item reference you assign to each product variant, and a final check digit. In vupdf you enter the first 12 digits and the 13th is calculated for you.
EAN-8
A shorter version for packages too small to fit an EAN-13, such as a lipstick or a pack of chewing gum. EAN-8 numbers are allocated individually by GS1 organizations and are deliberately scarce, so they are meant only for products where an EAN-13 truly does not fit. You enter seven digits and the eighth is the check digit.
UPC-A
The 12-digit code traditionally used in the United States and Canada. Modern checkout systems in most countries can read both UPC-A and EAN-13, and a UPC-A number can be expressed as an EAN-13 by adding a leading zero. If you sell mainly in North America, your retailer may ask for UPC; elsewhere EAN-13 is the norm. In vupdf you enter 11 digits and the 12th is added.
ITF-14
Used on outer cartons and cases rather than individual items. It carries a 14-digit GTIN that identifies a specific packaging level, for example a box of 24 units. Because it is designed to survive printing on corrugated cardboard, it has relatively wide bars. In vupdf you enter 13 digits and the 14th is calculated.
Why retail barcodes need a GS1 number
Anyone can draw an EAN-13 barcode, but the number inside it is what matters. Retailers use it to look up your product in their systems, and those numbers are meant to be unique worldwide. That uniqueness is managed by GS1, a non-profit standards organization with member organizations in many countries. In Turkey that is GS1 Türkiye.
If you want to sell through supermarkets, chain stores or many online marketplaces, you generally need to register with the GS1 organization in your country, receive a company prefix and assign product numbers from it. A few points worth knowing:
- The first digits of a GTIN show which GS1 organization issued the prefix, not where the product was made.
- Inventing a number, or copying one from another product, can collide with an existing item and get your listing rejected.
- Numbers bought cheaply from resellers may be registered to another company, which some retailers check.
- Each variant usually needs its own number: a different size, color or pack quantity counts as a different product.
For internal use, such as asset tags, inventory bins, library cards or event tickets, you do not need GS1 at all. Use a general-purpose format and your own numbering.
General-purpose formats
Code 128
The most versatile choice when you are not bound by a retail standard. It can encode letters, digits and symbols, and it packs pairs of digits efficiently, so it stays compact. It is widely used for shipping labels, serial numbers and internal tracking. vupdf accepts up to 40 characters. If you are unsure which format to use for an in-house system, Code 128 is usually the safe default.
Code 39
An older format still common in industry, automotive and some government systems. It supports capital letters, digits and a few symbols (- . $ / + %), and every character is wide, so the barcode grows long quickly. vupdf allows up to 30 characters. Choose it mainly when an existing system or scanner setup specifically requires it.
Codabar
A simple format built for digits and a few symbols, with optional letters A to D as start and stop characters. It is known from libraries, some parcel services and older medical labeling. In vupdf, if you use those letters you need one at both the start and the end, or none at all.
Open Generate BarcodeTurn text or a number into a barcode.Check digits: the built-in error trap
The last digit of an EAN, UPC or ITF-14 code is not part of the product number. It is calculated from the others so a scanner can catch a misread. For EAN-13 the method is simple: starting from the left, multiply the digits alternately by 1 and 3, add the results, and pick the digit that brings the total up to the next multiple of ten.
Take 123456789012. The weighted sum is 1 + 6 + 3 + 12 + 5 + 18 + 7 + 24 + 9 + 0 + 1 + 6 = 92. The next multiple of ten is 100, so the check digit is 8 and the full code is 1234567890128.
You do not need to do this by hand. vupdf adds the check digit when you enter the shorter number, and if you paste a complete code whose last digit is wrong, it shows the correct digit and offers to fix it. That catches typos that would otherwise produce a valid-looking code for the wrong product.
Print size and quality
Barcodes are less forgiving than QR codes because they have no error correction. A few guidelines:
- Respect the nominal size. An EAN-13 at standard size is about 37 mm wide including its margins. Retail specifications allow it to be scaled between roughly 80 and 200 percent; going smaller is risky.
- Do not cut the height. Shortening the bars to save space makes the code harder to scan at an angle. Keep the original proportions.
- Keep the quiet zones. The blank space to the left and right of the bars is part of the code. Text, borders or the edge of a label must not intrude.
- Use dark bars on a light background. Black on white is ideal. Red bars are a classic mistake, because many scanners use red light and cannot see them.
- Prefer vector output. Download as SVG or PDF for print, or as a large PNG, so bar edges stay sharp. Scaling a small image blurs the bars.
vupdf shows the value under the bars by default, which lets a cashier type the number if scanning fails. It also warns when contrast is too low and refuses values that would make a barcode impractically wide. When the code is ready you can download it as PNG, JPG, WEBP, SVG or PDF, or place one or many copies on a blank PDF page for label printing, with optional cutting lines.
Quick decision guide
- Selling a consumer product in shops or marketplaces: EAN-13 (or UPC-A for North America) with a GS1-issued number.
- Very small retail package: EAN-8, if your GS1 organization assigns one.
- Outer carton for distributors: ITF-14 based on your product's GTIN.
- Internal labels, serial numbers, shipping references: Code 128.
- An existing system that specifies Code 39 or Codabar: follow the system.
Choose the format that the reading system expects, get the numbering right, and print at a sensible size with clean margins. Those three steps cover nearly every barcode problem before it happens.
