Barcodes Explained: EAN, UPC, Code 128 and Code 39
Web & SEO · Published October 17, 2026 · Updated October 24, 2026 · 3 min read
Written by Akinrinmade Michael
A barcode is a pattern of bars that a scanner turns back into a number or text. There are different types for different jobs, and the wrong one gives you a label that no scanner can read.
The main types
| Type | Holds | Used for |
|---|---|---|
| EAN-13 | 13 digits | Products in shops in most of the world |
| UPC-A | 12 digits | Products in the United States and Canada. An EAN-13 starting with 0 is the same as a UPC-A |
| EAN-8 | 8 digits | Packages too small for a full code |
| Code 128 | Any letters, numbers and symbols | Shipping, inventory and general labels |
| Code 39 | Capital letters, digits and a few symbols | Industry and ID badges |
Books carry an EAN-13 too. An ISBN is a 13-digit number beginning 978 or 979, printed as a barcode.
What the digits mean
In EAN-13 the first digits identify the company that registered the code, the next ones identify the product, and the last digit is a check digit. The check digit catches typing and scanning errors. To work it out, multiply the digits by 1 and 3 alternately, starting with 3 on the digit closest to the check digit, add them up, and take the amount needed to reach the next multiple of ten. For 400638133393 the sum is 89, so the check digit is 1, and the full number is 4006381333931.
How the bars carry the number
A barcode isn't a picture of the digits. Each digit is a pattern of bars and gaps of different widths, built from a basic unit called a module. A scanner measures the widths, not the colors, which is why contrast and scale matter so much. Guard bars at the start, middle and end tell the scanner where the code begins and which way up it is.
Making one
The Barcode Generator draws all five types, adds the check digit for you, and downloads a PNG or a sharp SVG for printing. Shops and marketplaces need numbers registered with GS1, the organization that manages product numbers, and a tool can't register a number for you, so use your own codes for internal labels. Don't put made-up numbers on products you sell, since a real product elsewhere may already use them.
Printing barcodes that scan
- Use dark bars on a light background, and keep a blank margin, called the quiet zone, on both sides.
- Don't stretch or squash the barcode, and don't make it very small. Retail codes are normally printed between about 80 and 200 percent of the standard size.
- Print at a high resolution, or use the SVG.
- Avoid red bars. Many scanners use red light and can't see them.
- Test with a real scanner or phone before printing a large batch.
Choosing a type for a job
| Job | Type |
|---|---|
| Selling a product in shops | EAN-13 or UPC-A with a registered number |
| Labeling boxes in a warehouse | Code 128 |
| Tagging equipment or books internally | Code 128 or Code 39 |
| A tiny package | EAN-8, with a registered number |
Barcode or QR code?
A barcode is read along one line and holds a short number. A QR code is read in two directions and can hold links, Wi-Fi details and contact cards. Choose a barcode when a till or warehouse scanner expects one, and a QR code for people scanning with their phone.
Common mistakes
- Making up a number for a product that will be sold in shops.
- Shrinking a barcode to fit a label until the bars blur together.
- Printing on glossy, curved or dark material that scanners struggle with.
- Choosing Code 39 for lowercase text, which it can't hold.
- Forgetting the quiet zone, so the barcode touches a border or a picture.