Walk into any store, warehouse, or hospital and you'll see them — stripes, squares, and grids printed on nearly every item. Barcodes are the silent backbone of modern commerce, enabling everything from lightning-fast checkouts to global package tracking.
But not all barcodes are the same. Some hold a dozen digits; others store an entire webpage. Some work with a laser scanner; others need a camera. Choosing the wrong format can mean lost efficiency, higher costs, or a failed campaign.
This guide covers every major barcode format — what it does, where it shines, and when to pick it.
What Is a Barcode?
A barcode is a machine-readable pattern of parallel lines, squares, or dots that encodes data. A scanner reads the pattern by shining a light (for linear barcodes) or capturing an image (for 2D barcodes), then decodes the pattern into usable information — a product number, a tracking ID, or a URL.
Barcodes fall into two main categories:
- Linear (1D) barcodes — Data is encoded in the widths and spacing of parallel lines. They hold 20-100 characters and typically encode numeric or alphanumeric identifiers. Examples: UPC-A, EAN-13, Code 128, Code 39.
- Matrix (2D) barcodes — Data is encoded in a grid of black-and-white modules. They hold hundreds to thousands of characters and can encode virtually any type of data (URLs, images, contact info). Examples: QR Code, Data Matrix, PDF417.
The format you choose depends entirely on your use case: what data you need to store, where the code will appear, who will scan it, and with what type of scanner.
QR Code
The QR Code (Quick Response) is the most widely recognized 2D barcode format in the world. Developed by Denso Wave in 1994, it was designed to be decoded at high speed while holding significantly more data than any linear barcode.
QR codes can store up to 7,089 numeric characters or 2,953 alphanumeric characters. They support four levels of error correction (L, M, Q, H), allowing them to be scanned even when partially damaged or covered by a logo. The three large position markers in the corners let scanners read the code from any angle.
What sets QR codes apart is versatility. They can encode URLs, plain text, email addresses, phone numbers, SMS messages, vCard contacts, Wi-Fi credentials, geographic coordinates, and more. Modern smartphones read them natively through the camera app — no special scanner required.
QR codes are ideal for consumer-facing use: restaurant menus, marketing materials, event tickets, product packaging that links to digital content, contactless payments, and loyalty programs. With dynamic QR codes, you can also track scan analytics (location, device, time) and update the destination URL after printing.
If your audience is the general public and you want them to interact with a digital experience using their phone, QR Code is almost always the right choice.
Code 128
Code 128 is a high-density linear (1D) barcode that encodes alphanumeric data. It supports the full ASCII character set (128 characters, hence the name) in a very compact space — making it one of the most space-efficient linear barcodes available.
Code 128 is widely used in shipping and logistics. The GS1-128 standard (formerly UCC/EAN-128) adds application identifiers (AIs) that encode structured data like shipment dates, batch numbers, weights, and expiration dates. This makes it the backbone of supply chain labeling worldwide.
Beyond logistics, Code 128 appears in healthcare (patient wristbands, medication labels, specimen tracking), inventory management (warehouse bins, asset tags), and retail (non-point-of-sale labeling). It requires a laser or CCD barcode scanner — typical smartphone cameras cannot read it without a specialized app.
Because Code 128 is variable-length and compact, it's the go-to when you need to encode moderate amounts of alphanumeric data in a small space for internal or industrial use.
Code 39
Code 39 (also called Code 3 of 9) is one of the oldest alphanumeric linear barcode standards, introduced in 1974. It encodes 43 characters: uppercase letters A-Z, digits 0-9, and six special symbols (-, ., $, /, +, %). Each character is represented by nine elements — five bars and four spaces — of which three are wide and six are narrow.
Code 39 is not as dense as Code 128 — it requires more space per character — but it is simpler and more widely supported by legacy scanning equipment. Because it has been around for decades, virtually every barcode scanner on earth can read it.
It is commonly found in non-retail environments: government asset tracking, automotive component labeling (the automotive industry adopted it early), military logistics, and library systems. It is also used for name badges and identification cards in some corporate settings.
Choose Code 39 when you need a simple, universally readable alphanumeric barcode for internal use and your data is limited to uppercase letters and digits. For anything more data-dense, use Code 128 instead.
EAN-13 & UPC-A
UPC-A (Universal Product Code, 12 digits) and EAN-13 (European Article Number, 13 digits) are the standard retail barcodes found on virtually every consumer product sold in stores. UPC-A is used primarily in the United States and Canada; EAN-13 is used everywhere else. Both are numeric-only, linear barcodes.
The digits encode a company prefix, a product number, and a check digit. GS1, the global standards organization, assigns company prefixes and maintains the registry. If you want to sell a physical product in a retail store, you almost certainly need a UPC or EAN barcode, and you must purchase a license from GS1 (or a reseller).
Scanners at point-of-sale (POS) terminals read UPC-A and EAN-13 instantly. They are designed for speed and accuracy at the checkout counter. The barcode itself contains only a product identifier — all other information (price, description, inventory count) is held in the retailer's database and looked up via that identifier.
If you manufacture or distribute physical products for retail sale, UPC-A (North America) or EAN-13 (international) is mandatory. These barcodes are not suitable for encoding URLs, descriptions, or any data beyond a simple numeric ID.
Data Matrix & PDF417
Two important 2D formats deserve attention beyond QR Code:
Data Matrix is a high-density 2D matrix barcode that stores up to 2,335 alphanumeric characters in a very small space. It consists of a square or rectangular grid of black-and-white cells with a finder pattern on two sides (an "L" shape). Its small footprint makes it ideal for direct part marking on electronics, circuit boards, medical devices, and small components. Data Matrix is widely used in aerospace, automotive manufacturing, and healthcare (for unique device identification / UDI). It is read by image-based scanners, not lasers.
PDF417 is a stacked linear 2D barcode that looks like multiple rows of linear barcodes stacked on top of each other. It stores up to 1,100 alphanumeric characters per symbol and is used extensively for identification documents — driver's licenses (in the US and Canada), ID cards, and travel documents. It is also used in logistics for shipping labels and by airlines for boarding passes. PDF417 requires an image-based scanner or a smartphone app.
Choose Data Matrix when you need a tiny, durable code that can be etched or printed directly onto a physical component. Choose PDF417 when you need to encode a moderate amount of data on an identification document or shipping label.
How to Choose the Right Barcode Format
With so many formats, picking the right one comes down to a few key questions:
- Retail products on store shelves → EAN-13 (international) or UPC-A (North America). These are non-negotiable for POS checkout.
- Consumer engagement and marketing → QR Code. Smartphones scan it natively; you can embed URLs, track scans, and update destinations.
- Shipping and logistics labels → Code 128 (GS1-128). Compact, high-density, supports structured data like batch numbers and weights.
- Internal inventory and asset tracking → Code 128 for dense data or Code 39 for simple alphanumeric IDs with legacy scanners.
- Direct part marking on small components → Data Matrix. Tiny footprint, high capacity, durable enough for industrial environments.
- Identification documents (driver's licenses, IDs) → PDF417. Standard format for government-issued IDs and airline boarding passes.
- Non-retail government or automotive labeling → Code 39. Simple, universal scanner compatibility, widely adopted in these industries.
When in doubt, consider who scans the code. If the general public scans it with a smartphone, use a QR Code. If it's scanned by a warehouse worker with a dedicated scanner, Code 128 or EAN/UPC are likely better. If it needs to survive on a metal part in a factory, Data Matrix is your best bet.
Conclusion
Barcodes are not one-size-fits-all. Each format was designed for a specific purpose — speed at checkout, density on a shipping label, durability on a circuit board, or versatility in a marketing campaign. Understanding the differences helps you choose the right tool for the job and avoid costly mistakes.
For modern, consumer-facing applications, the QR Code stands out as the most versatile format. It stores far more data than linear barcodes, works with every smartphone, supports dynamic editing and analytics, and can encode virtually any type of content. Whether you're running a marketing campaign, digitizing a menu, or creating a contactless experience, start with a QR Code.