Barcode Types Compared: EAN-13 vs UPC-A vs Code 128 vs QR Code
From grocery store shelves to warehouse logistics, different barcode formats serve different purposes. This guide compares the most common 1D and 2D barcode types so you can choose the right one.
1D vs 2D Barcodes: What's the Difference?
1D (linear) barcodes encode data in the widths and spacing of parallel lines. They typically hold 20–25 characters and require a laser or linear scanner. You see these on every retail product.
2D barcodes encode data in both horizontal and vertical patterns, allowing them to store thousands of characters, including binary data. They require a camera-based scanner (which every smartphone has).
Common 1D Barcode Types
EAN-13 (European Article Number)
The global standard for retail product identification. Every product you buy in a supermarket has an EAN-13 code.
- Length: 13 digits (12 data + 1 check digit)
- Data: Numeric only
- Used for: Retail products worldwide, books (ISBN-13 is EAN-13 with prefix 978/979)
- Example: 5901234123457
UPC-A (Universal Product Code)
The North American equivalent of EAN-13. Technically a subset — a UPC-A is an EAN-13 with a leading zero.
- Length: 12 digits (11 data + 1 check digit)
- Data: Numeric only
- Used for: Retail products in the US and Canada
- Example: 042100005264
Code 128
A high-density barcode that supports the full ASCII character set. The workhorse of logistics and supply chain.
- Length: Variable (no fixed limit)
- Data: Full ASCII (letters, numbers, symbols)
- Used for: Shipping labels (GS1-128), inventory, healthcare
- Advantage: Very compact for the amount of data encoded
Code 39
One of the earliest alphanumeric barcodes, still widely used in non-retail applications.
- Length: Variable
- Data: Uppercase letters, digits, and a few symbols
- Used for: Military (LOGMARS), automotive (AIAG), ID badges
- Disadvantage: Lower data density than Code 128
Common 2D Barcode Types
QR Code
The most recognizable 2D code, designed for fast scanning from any angle.
- Capacity: Up to 7,089 numeric or 4,296 alphanumeric characters
- Error correction: Four levels (7%, 15%, 25%, 30% recoverable)
- Used for: URLs, WiFi sharing, payments, tickets, marketing
- Advantage: Scannable from any angle, works with phone cameras
Data Matrix
A 2D code optimized for very small sizes, common in industrial and healthcare applications.
- Capacity: Up to 2,335 alphanumeric characters
- Used for: Electronic components, pharmaceutical packaging, surgical instruments
- Advantage: Can be printed as small as 2–3 mm, highly reliable
Comparison Table
| Format | Type | Data Capacity | Best For |
|---|---|---|---|
| EAN-13 | 1D | 13 digits | Retail products (global) |
| UPC-A | 1D | 12 digits | Retail products (US/Canada) |
| Code 128 | 1D | Variable (ASCII) | Shipping, logistics |
| Code 39 | 1D | Variable (limited) | Military, automotive |
| QR Code | 2D | 7,089 numeric | URLs, payments, marketing |
| Data Matrix | 2D | 2,335 alphanumeric | Healthcare, electronics |
Which Barcode Should You Use?
The choice depends on your use case:
- Selling a product in stores? You need an EAN-13 (or UPC-A in North America). These are assigned through GS1.
- Shipping packages? Code 128 (as GS1-128) is the logistics standard.
- Sharing a link, WiFi, or contact? QR codes are the natural choice — everyone's phone can scan them.
- Marking tiny components? Data Matrix codes are designed for micro-scale printing.
- Internal inventory? Code 128 or Code 39 depending on your existing system.
For consumer-facing applications, QR codes are almost always the best choice. They can hold more data, scan from any angle, include error correction, and every smartphone can read them without a special app.