EAN, UPC, Code 128 or QR: choosing the right barcode
Compare common barcode types, learn which ones need official registration, and generate, print and test codes that scanners read first time.
Start with where the code will be scanned
Barcode formats are not interchangeable. A supermarket checkout expects one family of codes, a warehouse scanner another, and a phone camera reads almost anything 2D. The right format follows from three questions: who will scan it, what data it must carry, and whether it needs to be globally unique.
| Format | Data | Typical use |
|---|---|---|
| EAN-13 | 13 digits including a check digit | Retail products worldwide outside North America |
| UPC-A | 12 digits including a check digit | Retail products in the US and Canada |
| Code 128 | Letters, digits and symbols; compact | Shipping labels, warehouse locations, asset tags, internal stock codes |
| Code 39 | Upper-case letters, digits, a few symbols | Older industrial and government systems, simple ID badges |
| Data Matrix | Up to hundreds of characters in a tiny square | Small parts, electronics, healthcare packaging |
| QR code | URLs, text, contacts, Wi-Fi | Marketing, menus, tickets, anything scanned by phones |
Retail barcodes need registered numbers
If a product will be sold through shops or large online marketplaces, its EAN-13 or UPC-A number generally needs to come from GS1, the organisation that manages global product numbering. Retailers use these numbers to look up the product in their systems, so they must be unique worldwide. GS1 member organisations in each country issue company prefixes, from which you create a number for each product.
A barcode generator can draw a perfectly valid EAN-13 for any 13-digit number with a correct check digit, but drawing the barcode is not the same as owning the number. Inventing numbers, or buying cheap resold numbers, can lead to products being rejected or confused with someone else's. For products sold only in your own shop, or for internal stock, you do not need GS1 numbers; Code 128 with your own SKU codes is often a better fit.
How check digits work
EAN and UPC codes end with a check digit calculated from the others, which lets scanners detect a misread. For EAN-13, multiply the first twelve digits alternately by 1 and 3, add the results, and find the number that brings the total up to the next multiple of ten.
For the number 400638133393, the weighted sum is 89, so the check digit is 1, giving 4006381333931. MyFileNest Barcode Generator validates the length and check digit for retail formats and tells you when a number is invalid, which catches typing mistakes before anything is printed.
Step-by-step: creating and testing a barcode
- Choose the format based on who will scan it: EAN-13 or UPC-A for retail, Code 128 for logistics and internal use, Data Matrix for very small items, QR for phones.
- Enter the data. For retail formats, use the exact number from your GS1 allocation.
- Generate the code and check that the human-readable digits under the bars match your number.
- Export as SVG for print, which keeps bar edges perfectly sharp at any size, or PNG for documents and screens.
- Place it on your label with a clear margin, the quiet zone, on both sides of linear barcodes.
- Print a test label on the actual printer and stock you will use.
- Scan the test with the real scanner or app, and with Barcode Reader, before printing in quantity.
Printing rules that prevent scanning failures
- Do not stretch or squash barcodes to fit a space. Scale them proportionally.
- Keep the quiet zone clear. Linear barcodes need empty space to the left and right of the bars; text or borders in that space cause failures.
- Print dark bars on a light background. Red bars are invisible to many laser scanners, which use red light.
- Avoid printing below the minimum recommended size for the format; retail codes printed too small often fail at checkouts.
- Do not place barcodes over seams, folds or curves where the bars distort.
- With thermal label printers, check the print head is clean; a missing line of dots creates a white gap across every bar.
Worked example: a small warehouse
An online retailer stores 400 products on shelves and wants to speed up picking. The products already carry their manufacturers' EAN codes, but the shelves have no codes at all. The owner creates Code 128 labels for each shelf location using a simple scheme, such as A-03-2 for aisle A, bay 3, shelf 2, and prints them on a thermal label printer.
Pickers now scan the shelf label and then the product's own EAN, and the warehouse software confirms the right item is in the right place. The owner uses Code 128 rather than EAN for the shelves because the codes are internal, contain letters, and need no registration. Testing the first ten labels with the actual handheld scanners reveals that labels on the bottom shelves are hard to scan at an angle, so those labels are moved to the shelf front edge.
Linear barcode or QR code?
Choose a linear barcode when the scanners are existing laser or handheld devices built for retail and logistics, or when the system expects a specific format. Choose a 2D code, QR or Data Matrix, when space is tight, when you need to store more data, or when people will scan with phones. A QR code on packaging can link to instructions or a product page, while the EAN code beside it continues to serve the checkout.
Barcode sizes and print resolution
Every linear barcode is built from a narrowest bar width, called the X-dimension, and the scanner must be able to distinguish it. Larger X-dimensions scan more easily from further away and on lower-quality printers. Retail codes have a standard nominal size with permitted scaling; printing far below that is a common reason for problems at checkouts.
Print resolution matters because each bar must be drawn with a whole number of printer dots. Thermal label printers commonly run at 203 or 300 dots per inch. At 203 dpi, very small barcodes can end up with bars of slightly uneven width, which reduces reliability. Exporting as SVG and letting the label software place it at a sensible size, or choosing a size that is a clean multiple of the printer's dot pitch, gives crisper bars. Always verify with real scans rather than judging by eye.
Planning internal codes that last
Internal barcodes for stock, assets or locations live for years, so the numbering scheme deserves a few minutes of thought. Use a fixed structure that people can read, such as a prefix for the type of item followed by a sequence number: AS-000123 for an asset tag, LOC-A03-2 for a shelf. Avoid characters that are easily confused when read aloud or typed, such as O and 0 or I and 1, and avoid spaces.
Keep a master list, ideally in a spreadsheet or your inventory system, of every code issued and what it refers to. Never reuse a code for a different item, even after the original is retired; old labels, reports and photos may still refer to it. Print a human-readable version under every barcode so items can be identified if a scanner is not available.
Reading barcodes without a dedicated scanner
You do not need specialist hardware to read most barcodes. Barcode Reader decodes Code 128, EAN, UPC, Data Matrix and other common formats from a photo or from your device's camera, after you grant camera permission. This is useful for checking labels before a print run, reading an asset tag in the field, or confirming that a supplier's barcode matches the number on their invoice.
For reliable results, hold the camera parallel to the label, fill most of the frame with the barcode and avoid glare from glossy packaging. Very small or damaged codes may need a sharper photo taken in better light. When a code will not read at all, compare the printed digits under the bars with your records; a smudged or partly covered label often needs replacing rather than rescanning.
For daily high-volume scanning, such as at a till or in a busy warehouse, a dedicated handheld scanner is faster and more robust than a phone. Phone-based reading is ideal for occasional checks and testing.
Summary
Use EAN-13 or UPC-A with registered GS1 numbers for products sold through retailers, Code 128 for shipping, stock and location labels, Data Matrix for very small items, and QR codes for anything people will scan with a phone. Whatever the format, print it sharply with a clear quiet zone and test it on the real scanner before printing in quantity.
Frequently asked questions
Can I make my own UPC numbers? You can draw the barcode, but retail numbers should be licensed from GS1 if the product will be sold through retailers.
Which format holds letters? Code 128, Code 39, Data Matrix and QR. EAN and UPC hold digits only.
Why does my barcode scan in the app but not at the till? Retail systems look up the number in a database; an unregistered or mistyped number scans but returns no product.