Guide
2D barcodes explained
A 2D barcode stores data in two directions, across and down, as a grid of dark and light cells. A normal striped barcode stores data in one direction only, which is why it tops out at around 20 characters. A 2D code holds from a few hundred to several thousand, enough for a web address, a full ID card, or a product number with its expiry date and serial number attached.
Have a 2D code to read? The scanner handles QR, Data Matrix, PDF417 and Aztec from a camera or an image.
Open the QR code scannerThe four you will meet
| Code | Spot it by | Max text | Main uses |
|---|---|---|---|
| QR Code | Three corner squares | 4,296 characters | Links, payments, menus, tickets |
| Data Matrix | L-shaped solid border | 2,335 characters | Medicine, medical devices, parts |
| PDF417 | Wide block of stacked rows | About 1,800 characters | Driver’s licenses, boarding passes |
| Aztec | Bullseye in the center | 3,067 characters | Rail and airline mobile tickets |
QR Code
Denso Wave released the QR Code in Japan in 1994, to track car parts, and chose not to charge license fees. That decision is why it spread. The three corner squares let a camera find and orient the code in a fraction of a second, from any angle. A QR code ranges from 21 × 21 cells to 177 × 177.
QR codes most often carry a link, but they also hold Wi-Fi logins, contact cards and payment requests. The QR code scanner shows where a link really goes before you open it.
Data Matrix
Smaller than a QR code for the same data, and readable at 2 to 3 mm across. That is why it is the code on prescription medicine packs, surgical instruments and circuit boards. Under GS1 rules it carries a product number together with expiry date, batch and serial number. Phone camera apps often ignore it, so use the Data Matrix scanner.
PDF417
Strictly speaking this one is a stacked barcode: rows of bars piled up, which older laser scanners can read line by line. It came out in 1991 and became the standard for documents. Every US and Canadian driver’s license has one on the back, and printed boarding passes use it worldwide. The PDF417 scanner turns license and boarding pass data into labeled fields.
Aztec
Built outward from a central bullseye. It needs no blank margin, so it fits tight layouts and reads well from phone screens. Many European rail tickets and airline mobile boarding passes use it.
How a 2D code survives damage
All four formats use Reed-Solomon error correction, the same math that lets a scratched CD play. Extra cells are added so that the reader can rebuild missing data. QR lets whoever makes the code pick the level:
| QR level | Recoverable damage | Typical use |
|---|---|---|
| L | About 7% | Clean screens, maximum capacity |
| M | About 15% | The usual default |
| Q | About 25% | Printed labels that get handled |
| H | About 30% | Codes with a logo, outdoor signs |
Level H is what makes a logo in the middle of a QR code possible: the logo destroys part of the code, and the correction data fills the hole. More correction means more cells, so the code gets denser or larger. A striped barcode has none of this. It has a check digit, which can tell that something went wrong but cannot repair it.
1D or 2D: which fits the job
For retail checkout today, stay with 1D (UPC or EAN), because every checkout reads it. For a link aimed at a phone, use a QR Code. When the pack needs to carry an expiry date, lot or serial number, use Data Matrix, or a QR code in the newer GS1 Digital Link format. PDF417 suits a lot of text on a document, and Data Matrix is the one for tiny or curved surfaces.
The types of barcodes guide covers the striped formats, and the barcode generator makes QR, Data Matrix, PDF417 and Aztec codes.
Sources
- Denso Wave: history of the QR Code
- Denso Wave: QR Code versions and capacity
- Denso Wave: QR Code error correction
- GS1 US: Sunrise 2027
- ISO/IEC 18004 (QR Code), 16022 (Data Matrix), 15438 (PDF417), 24778 (Aztec). The symbology specifications, for capacities.
Spotted a mistake? Email [email protected].