← Back to Blog

Barcode Types Explained: When to Use Code 128, QR Code, EAN, and More

By UtilDaily9 min read

On June 26, 1974, a pack of Wrigley's Juicy Fruit chewing gum became the first retail product ever scanned with a barcode at a supermarket checkout in Troy, Ohio. That ten-pack of gum is now on display at the Smithsonian. In the half-century since, barcodes have evolved from a single 1D line format into a rich family of symbologies — each optimized for a different industry, data density, and scanning environment.

If you need to create a barcode today, you face a choice: which type do you actually need? This guide explains the most important barcode formats, their strengths and limitations, and exactly when to use each one.

1D Barcodes vs 2D Barcodes: The Fundamental Divide

The first distinction to understand is between one-dimensional (1D) and two-dimensional (2D) barcodes.

1D barcodes encode data in the widths and spacings of parallel vertical bars. They can only be read horizontally, and their data capacity is limited — typically 20–80 characters. They are fast to scan, work with inexpensive laser scanners, and have been the backbone of retail and logistics for 50 years.

2D barcodes encode data in both horizontal and vertical patterns — as dots, squares, or hexagons arranged in a grid. They hold vastly more data (up to 7,000+ characters), can be scanned at any angle, include built-in error correction, and can be read by camera-based scanners and smartphones. They are more complex but far more versatile.

The Most Important 1D Barcode Types

UPC-A: The Retail Standard

UPC-A (Universal Product Code) is the barcode you find on virtually every product sold in North American retail stores. It encodes exactly 12 numeric digits: a company prefix, a product number, and a check digit. The digits are fixed — you cannot encode letters or special characters.

When to use it: Only if you are a retailer selling physical products in North American grocery stores, pharmacies, or mass-market retail. You must purchase a GS1 company prefix to obtain valid UPC numbers. You cannot just make up UPC numbers.

EAN-13: The International Retail Standard

EAN-13 (European Article Number) is the international equivalent of UPC-A, encoding 13 numeric digits. It is used everywhere outside North America and on most international products. UPC-A barcodes are actually a subset of EAN-13 (with a leading zero prepended), so all modern scanners can read both.

When to use it: For physical retail products sold internationally. Like UPC, valid EAN numbers must be obtained through GS1.

Code 39: The Industrial Workhorse

Code 39 was one of the first barcode symbologies to encode alphanumeric data — 43 characters including A–Z, 0–9, and a handful of special characters. It is self-checking (each character is independent), which made it very forgiving in early scanning environments.

Code 39 is widely used in automotive, defense, and government contexts, and it remains the standard for U.S. Department of Defense labeling. Its weakness is low data density — it takes a lot of physical space to encode even a short string.

When to use it: When you need alphanumeric encoding and are in an industry (defense, automotive, healthcare) where Code 39 is the established standard.

Code 128: High-Density Alphanumeric

Code 128 is the most versatile and widely used 1D barcode format in modern logistics, shipping, and inventory management. It encodes the full ASCII character set (128 characters, hence the name) with excellent data density — roughly twice as efficient as Code 39 for numeric data. It includes a mandatory check digit for error detection.

Code 128 is the format used by FedEx, UPS, and USPS for shipping labels. It is the backbone of GS1-128 (used in supply chains for encoding product, quantity, expiry date, and lot number in a single barcode).

When to use it: This is the best general-purpose 1D barcode for most applications. If you need to barcode inventory items, assets, library books, event tickets, employee badges, or internal documents — Code 128 is your default choice. Our free barcode generator uses Code 128, making it ideal for these exact use cases.

The Most Important 2D Barcode Types

QR Code: The Universal 2D Standard

QR Code (Quick Response Code) was invented by Denso Wave in Japan in 1994 to track automotive parts. It can encode up to 7,089 numeric characters, 4,296 alphanumeric characters, or 2,953 bytes of binary data. QR codes have built-in error correction at four levels (L, M, Q, H), allowing them to remain readable even when up to 30% of the code is damaged or obscured.

QR codes are omnidirectional — they can be scanned from any angle — and every smartphone manufactured since about 2017 can scan them natively without any app. This makes them the dominant format for consumer-facing applications.

When to use it: Linking physical objects to URLs (menus, product pages, contact info), sharing Wi-Fi credentials, storing contact cards (vCards), COVID certificates, event tickets, and any scenario where consumers will scan with a phone. Use our free QR code generator for these use cases.

Data Matrix: Industrial Micro-Barcodes

Data Matrix is a 2D format that can be printed or etched at extremely small sizes — sometimes less than 1mm square — while still encoding useful data. It is used extensively in electronics manufacturing (PCBs, chips), pharmaceutical packaging, and aerospace parts marking. The U.S. Electronic Industries Alliance mandates Data Matrix for marking individual electronic components.

When to use it: When you need to mark very small physical parts or need to laser-etch a barcode into metal or plastic. Not suitable for consumer-facing applications.

PDF417: Documents and IDs

PDF417 (Portable Data File 417) is a stacked 1D barcode — essentially multiple Code 128 rows stacked vertically — that can encode up to 1,800 ASCII characters. It is the format used on U.S. driver's licenses, boarding passes, and government-issued identification documents. It can encode large amounts of structured data and supports error correction.

When to use it: Government ID documents, boarding passes, and applications where you need to encode large amounts of text data in a scannable format.

Aztec Code: Transit Ticketing

Aztec Code is used on rail and transit tickets worldwide, including Amtrak tickets and European train passes. It is compact, has no quiet zone requirement (no white border needed around it), and can be scanned from a phone screen — making it ideal for mobile tickets. The London Underground and many European rail systems use Aztec codes on their tickets.

When to use it: Transit ticketing applications, mobile tickets, or when you need the most compact 2D format possible.

How Barcode Scanners Work

Traditional laser barcode scanners work by sweeping a laser beam across the barcode and measuring the reflectivity of each stripe — dark bars absorb light, white spaces reflect it. The pattern of reflected light is decoded into the original string.

Modern camera-based scanners (and smartphone cameras) capture an image of the entire barcode, then use image processing algorithms to find the barcode, correct for perspective distortion, and decode the pattern. This is why cameras can read 2D codes from any angle, while laser scanners require proper alignment.

Creating Barcodes for Your Business: Free vs Paid

For most internal use cases — labeling inventory, assets, files, or packages within your own organization — you do not need to pay for barcode software. Our free barcode generator creates Code 128 barcodes instantly in your browser, with no account required and no data sent to any server.

You need paid solutions (like GS1 membership) only if you are creating barcodes for retail products sold through external stores — because those require globally unique, registered numbers. For everything internal, free tools work perfectly.

How to Use Our Free Barcode Generator

Our barcode generator creates Code 128 barcodes directly in your browser:

  1. Enter any text or number you want to encode — product ID, serial number, asset tag, URL, or any string
  2. The barcode is generated instantly as you type
  3. Download as PNG or SVG for printing
  4. Print on label paper, stickers, or regular paper and laminate

For consumer-facing uses where people will scan with their phones, use our QR code generator instead — it creates scannable QR codes that work with any smartphone camera.

Frequently Asked Questions

What is the difference between a QR code and a barcode?

In everyday language, "barcode" usually refers to traditional 1D linear barcodes (like UPC on grocery products), while "QR code" refers to the 2D square format. Technically, QR codes are a type of barcode. 1D barcodes encode data in a single horizontal line and hold limited data. QR codes encode data in a 2D grid pattern and can hold thousands of characters, making them far more versatile for modern uses.

Can I use any barcode number I want for retail products?

No. Retail barcodes (UPC-A, EAN-13) require a globally unique number issued through GS1, the international standards organization. Using made-up UPC numbers on products you sell in retail stores is not permitted and will cause conflicts in retail inventory systems. For internal inventory, you can use any number system you choose.

Why do some barcodes have letters and some only have numbers?

Different barcode formats support different character sets. UPC and EAN only support digits 0–9. Code 39 supports letters A–Z, digits 0–9, and some special characters. Code 128 supports the full ASCII character set including lowercase letters, spaces, and symbols. QR codes can encode any Unicode text, URLs, binary data, and even images.

How small can a barcode be printed and still scan correctly?

It depends on the format and your scanner. A Code 128 barcode needs to be at least about 1.5cm tall and wide enough to encode the data at readable bar widths — typically printed at 300+ DPI for reliable scanning. QR codes can be as small as 2cm × 2cm for phone scanning at close range. Data Matrix codes can be etched at sub-millimeter sizes for industrial scanners.

Do I need special software to scan barcodes?

For 1D barcodes, any USB barcode scanner works as a keyboard input device — no software needed. For QR codes and other 2D formats, any modern iPhone (iOS 11+) or Android phone (Android 8+) can scan natively using the built-in camera app. For specialized formats like Data Matrix or Aztec, you may need a dedicated scanner app.

Related Tools