Skip to the content
UPC Generator

What is a 2D barcode?

A 2D barcode stores data across and down a grid rather than along one line. So a Data Matrix under 10 mm across can hold a serial number, a batch and a date. The largest holds 2,335 characters where a UPC holds 12 digits. Reading a Data Matrix or a QR Code takes a camera rather than a laser line. That is why GS1 wants checkouts upgraded by the end of 2027.

By the UPC Generator team. The capacities, sizes and dates come from the GS1 General Specifications, Release 26.0, and GS1 and GS1 US pages on 2D barcodes. The standards page for each format supplies the rest. The capacity figures match what the Data Matrix and PDF417 generators here can hold. Last updated 4 November 2026. How UPC Generator pages are made.

A Data Matrix, a QR Code and a PDF417 holding the same text at one module size
The same text in three formats. Data Matrix is the smallest and PDF417 the widest.

Along a line, or across a grid

A linear barcode such as a UPC or Code 128 is a row of bars of different widths. A scanner reads it in one sweep. Everything it learns comes from that single line, which is why a UPC holds 12 digits and nothing else. A 2D barcode arranges light and dark cells across and down a grid, so the same square millimeters hold far more. The reader has to see the whole grid at once, so it is a camera, called an imager, rather than a laser.

The extra room pays for itself in two ways. The code can carry the data itself, such as a batch number, an expiry date or a web address. It need not be a key that only means something in a database. And part of the grid is given over to error correction, so a scratched or smudged code still reads. A Data Matrix can still be read with up to 30 percent of its cells damaged, as long as the reader can find its edges.

The common kinds

The common 2D barcode kinds compared
Kind Looks like Holds up to Clear space Where you meet it
QR Code A square with three corner squares 7,089 digits, 4,296 letters and digits, or 2,953 bytes 4 modules all round Posters, menus, tickets, packaging links
Data Matrix A square or rectangle with a solid L on two edges 3,116 digits, 2,335 characters, or 1,556 bytes 1 module all round Tiny parts, medicine packs, surgical tools
PDF417 A wide stack of short rows About a paragraph of text; width grows with each row 2 modules all round Boarding passes, shipping documents, ID cards
Aztec A square with a bullseye in the middle 3,832 digits or 3,067 letters None required Rail tickets and boarding passes on phones

The QR code was invented in 1994 by Masahiro Hara at Denso Wave to label car parts. It comes in 40 sizes, from 21 to 177 modules a side. It has four error correction levels that recover 7, 15, 25 or 30 percent of the code. Data Matrix has been in the public domain since 1994, in GS1's words, and its ECC 200 version is the one every current standard uses. It comes in 24 square sizes from 10 by 10 to 144 by 144 modules, plus 6 rectangles. The rectangles are why it suits a label that is wider than it is tall. PDF417 was invented in 1991 by Ynjiun Wang at Symbol Technologies. It is really a stack of linear rows, between 3 and 90 of them, so some line scanners can read it. Wikipedia puts it at about four times the area of a Data Matrix or QR code holding the same data.

What GS1 allows on products

GS1 approves five 2D barcodes for its system. They are GS1 DataMatrix, GS1 QR Code, QR Code and Data Matrix carrying a GS1 Digital Link, and GS1 DotCode. Each has a job. GS1 DataMatrix carries a GTIN with dates, batch and serial numbers in GS1's own data format. It is the only 2D code allowed on regulated healthcare products. A QR code or a Data Matrix can carry a GS1 Digital Link, which is a web address with the GTIN inside it. One code can then be scanned at a checkout and opened by a phone. GS1 DotCode exists only to meet the EU tobacco tracking rule.

Sizes are set too. For a product at a retail checkout, GS1 gives a 2D module a minimum of 0.396 mm and a target of 0.495 mm. The maximum is 0.990 mm. That is 1.5 times the size allowed for a linear barcode, because a camera needs larger cells than a laser needs bars. A Data Matrix needs 1 module of clear space all round and a QR code needs 4.

The checkout in 2027

GS1 states an ambition rather than a deadline: that retail checkouts around the world can read 2D barcodes by the end of 2027. GS1 US runs the US side as Sunrise 2027 and says it is not necessary to implement every 2D capability by that date. The rule for packaging during the changeover is strict. A 2D code goes on in addition to the EAN or UPC, never instead of it. A store whose scanners cannot yet read 2D then still rings the product up. GS1 US says the UPC barcode is not going away. Shipping cartons and warehouses are outside the plan, so ITF-14 and GS1-128 stay as they are.

Which one to make

For a small part, a tool or a medicine pack, draw a Data Matrix, square or rectangular. Use its GS1 mode when the code needs a GTIN, an expiry date and a batch number laid out the way a hospital scanner expects. For a code that phones will read, draw a QR code in the generator that covers all 10 formats. That is because phone camera apps are built to read QR Code, as how to scan a barcode with your phone sets out. For a paragraph of text on a document or a label read by a line scanner, draw a PDF417. It holds more than a linear code at the cost of width.

Whatever you pick, keep the cells square, use dark cells on a light background, and leave the clear space in the file. A 2D code stretched to fit a layout no longer has square modules, and a reader may fail on it. How a scanner turns light and dark into digits, and why it needs the clear space, is in how barcodes work.

Where each of these sits in GS1's system is in what a GS1 barcode is. How to scan a barcode with your phone says which of them a phone camera reads without an app.

More about 2D barcodes

Is a QR code a barcode?

Yes. It is the best known 2D barcode, invented in 1994 at Denso Wave to label car parts. A QR code and a Data Matrix are both barcodes in the same sense a UPC is, just read as a picture.

Can a laser scanner read a 2D barcode?

Not a Data Matrix or a QR Code. A laser reads one line of light and dark, and those two only make sense as a whole grid. GS1 says scanners that are not 2D imagers cannot read GS1 DataMatrix. PDF417 is the exception: it is a stack of rows, so some sweeping laser scanners read it. An imager reads all three.

How much can a 2D barcode hold?

A QR code holds up to 7,089 digits or 4,296 letters and digits. A Data Matrix holds up to 3,116 digits or 2,335 characters. A PDF417 holds roughly a paragraph, and its width grows with every line.

Will 2D barcodes replace the UPC?

Not for a long time. GS1's plan adds a 2D code beside the UPC or EAN during the changeover, and GS1 US says the UPC barcode is not going away.

9 source documents

  1. GS1: General Specifications, Release 26.0, sections 1.2.2.2.1, 4.15.4, 5.6, 5.7, 5.8 to 5.10 and 5.12.3.1, fetched 2 November 2026
  2. GS1: 2D barcodes, fetched 2 November 2026
  3. GS1 US: The world of 2D barcodes, fetched 2 November 2026
  4. GS1 US: Sunrise 2027, fetched 2 November 2026
  5. Zebra: What is a 2D barcode?, fetched 2 November 2026
  6. Wikipedia: QR code, fetched 2 November 2026
  7. Wikipedia: Data Matrix, fetched 2 November 2026
  8. Wikipedia: PDF417, fetched 2 November 2026
  9. Wikipedia: Aztec Code, fetched 2 November 2026