Types of barcodes: 1D and 2D explained
The main barcode types and where they're used: EAN and UPC on products, Code 128 on parcels, Data Matrix on parts, PDF417 on IDs, and Aztec on tickets.
Barcodes come in two families. 1D (linear) barcodes are rows of bars and spaces that hold a short code, such as a product number. 2D barcodes store data in both directions, as a grid or a stack of rows, so they hold much more in a smaller space. The most common 1D types are EAN-13 and UPC-A on products and Code 128 on parcels and labels. The most common 2D types are QR codes, Data Matrix, PDF417, and Aztec.
1D (linear) barcodes
A linear barcode encodes characters in the widths of its bars and spaces. Height adds nothing, so to hold more, the barcode gets longer.
| Barcode | Holds | Where you’ll see it |
|---|---|---|
| EAN-13 | 13 digits | Products in shops worldwide; books (as the ISBN) |
| EAN-8 | 8 digits | Small products |
| UPC-A | 12 digits | Products in the US and Canada |
| UPC-E | 8 digits (a compressed UPC-A) | Small products in North America |
| Code 128 | Letters, digits, and symbols | Shipping labels, stock, and asset tags |
| Code 39 | Uppercase letters, digits, a few symbols | Industry, defense, and older systems |
| Code 93 | Like Code 39, more compact | Logistics, some postal uses |
| ITF (Interleaved 2 of 5) | Pairs of digits | Outer cartons (as ITF-14) |
| Codabar | Digits and a few symbols | Libraries, blood banks, older courier labels |
Product barcodes: EAN and UPC
EAN-13 and UPC-A are the barcodes on almost everything you buy. They hold a GTIN (Global Trade Item Number), allocated through GS1 so that no two products share a number. The barcode contains only the number; the shop’s system looks up the name and price. The first digits show which national GS1 office issued the number. GS1 India’s prefix is 890, but it shows where the number was issued, not where the product was made.
Code 128
Code 128 can encode all 128 ASCII characters (letters, digits, punctuation), and it’s compact. That makes it the usual choice for shipping labels, warehouse stock, and internal labels. Under the name GS1-128, it also carries structured data such as batch numbers and expiry dates on cartons.
2D barcodes
2D barcodes store data across both width and height. Most have error correction, so they survive some damage, and phones read them with the camera.
| Barcode | Shape | Holds up to | Where you’ll see it |
|---|---|---|---|
| QR code | Square, three corner squares | 7,089 digits or 2,953 bytes | Links, payments, menus, Wi-Fi, tickets |
| Data Matrix | Square or rectangle, L-shaped border | 3,116 digits or 1,556 bytes | Electronic parts, medicines, small labels |
| PDF417 | Stacked rows of bars | About 1,850 characters | Boarding passes, driving licenses, ID cards |
| Aztec | Square with a bullseye in the center | 3,832 digits or 1,914 bytes | Train and airline tickets, mobile boarding passes |
| MaxiCode | Hexagonal dots around a bullseye | 93 characters | UPS parcel labels |
QR codes
The best known 2D code, invented by Denso Wave in 1994. Phones scan them natively, which is why they’re used for links and payments. What is a QR code? covers them in detail.
Data Matrix
Data Matrix codes can be printed very small, down to a few millimeters, so they’re used to mark electronic parts and surgical tools. In many countries, medicine packs carry a GS1 DataMatrix with the product code, batch, expiry date, and serial number.
PDF417
PDF417 is a “stacked” barcode: many short rows of bars, read together. It’s used on many boarding passes and on ID cards and driving licenses in several countries. Despite the name, it has nothing to do with PDF files.
Aztec
Aztec codes have a bullseye in the center instead of corner squares, so they need no blank margin around them. That makes them practical on phone screens, and many rail and airline tickets use them.
How to tell barcode types apart
- Bars in a single row: a 1D barcode. Numbers printed underneath usually mean EAN or UPC.
- Three squares in the corners: a QR code.
- An L-shaped solid border on two sides: Data Matrix.
- A bullseye in the middle: Aztec (or MaxiCode, if the dots are hexagonal).
- A wide rectangle of many short rows: PDF417.
Which barcodes can a phone read?
Most phone scanners read all the common types above, both 1D and 2D. How to scan a barcode with your phone explains how, and QR code vs barcode compares the two families directly.
A note on EveryQR
EveryQR scans all of these common formats except MaxiCode, and its barcode maker creates EAN, UPC, Code 128, Code 39, Code 93, ITF, and Codabar barcodes, plus Data Matrix, PDF417, and Aztec for short text. How to make a barcode walks through choosing a format.
Related guides
- QR code vs barcode: what’s the difference?
- How to make a barcode
- How to scan a barcode with your phone
Browse all QR code guides.
About the author
I’m Shekhar Roy, a software engineer in New Delhi. I build EveryQR, a QR code scanner and creator for Android, and I write these guides from what I’ve learned making and testing it.