Guide

2D barcodes explained

By · Updated · 6 min read

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 scanner

The four you will meet

CodeSpot it byMax textMain uses
QR CodeThree corner squares4,296 charactersLinks, payments, menus, tickets
Data MatrixL-shaped solid border2,335 charactersMedicine, medical devices, parts
PDF417Wide block of stacked rowsAbout 1,800 charactersDriver’s licenses, boarding passes
AztecBullseye in the center3,067 charactersRail 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 levelRecoverable damageTypical use
LAbout 7%Clean screens, maximum capacity
MAbout 15%The usual default
QAbout 25%Printed labels that get handled
HAbout 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

Spotted a mistake? Email [email protected].

FAQ

Quick answers

Is a QR code a 2D barcode?

Yes. QR Code is the best-known 2D barcode. Data Matrix, PDF417 and Aztec are the other common ones.

Can my phone read 2D barcodes?

Phone camera apps read QR codes. Many do not read Data Matrix, PDF417 or Aztec. The online barcode scanner reads all of them in the browser, with no app.

Will 2D barcodes replace UPC barcodes?

Slowly. GS1 has set the end of 2027 as the date by which store checkouts should be able to scan 2D codes, an initiative called Sunrise 2027. Packs will carry both kinds for years after that, since older scanners read only the striped barcode.