Utility Tools

Barcode Symbologies Explained: Code 128 vs UPC-A vs EAN-13 vs Data Matrix

Understand barcode standards: Compare 1D linear symbologies (Code 128, UPC-A, EAN-13) against 2D matrix barcodes, and learn how check digits work.

September 03, 2026 6 min read Toolio Editorial
Barcode Symbologies Explained: Code 128 vs UPC-A vs EAN-13 vs Data Matrix
Summarize with:
Share:

Barcodes automate inventory management, retail point-of-sale (POS) checkout, and logistics tracking. Selecting the correct barcode symbology — the specific set of rules for encoding data as bars, spaces, or matrix modules — depends on your industry, the data you need to store, and how the code will be scanned.

Direct Answer: 1D linear barcodes (Code 128, UPC-A, EAN-13, Code 39) represent data using the varying widths of parallel black bars and white spaces, read along a single horizontal scan line. 2D matrix barcodes (QR Code, Data Matrix) store data across both horizontal and vertical axes, packing far more information into a smaller area. Crucially, a retail barcode like UPC-A or EAN-13 contains only a numeric product lookup identifier (a GTIN) — never the product name or price — which a point-of-sale system retrieves separately from a database.

Major Barcode Symbologies Compared

Symbology Dimension Character Set Data Length Primary Use
Code 128 1D Linear Full ASCII (128 characters) Variable length Shipping labels, logistics, asset tags
UPC-A 1D Linear Numeric only (0–9) Fixed 12 digits North American retail point-of-sale
EAN-13 1D Linear Numeric only (0–9) Fixed 13 digits Global retail point-of-sale (GS1 standard)
Code 39 1D Linear Alphanumeric (A–Z, 0–9, limited symbols) Variable length Automotive, defense, and internal inventory
Interleaved 2 of 5 (ITF) 1D Linear Numeric only, even digit count Variable length Cartons and outer shipping packaging
Data Matrix 2D Matrix Binary, text, or numeric Up to ~2,335 characters Medical devices, small electronic parts
QR Code 2D Matrix Numeric, alphanumeric, byte, or Kanji Up to ~7,089 numeric characters Marketing, payments, Wi-Fi, general purpose

How 1D Retail Barcodes Actually Work

A retail checkout scanner reads a 13-digit EAN-13 number (for example 4006381333931). The barcode image itself never contains the price or the product's name:

Barcode Image ──► Scanner Reads GTIN String "4006381333931" ──► POS Database Lookup ──► Displays "$4.99 — Organic Milk, 1L"

This separation is deliberate: it lets a store change a product's price hundreds of times without ever reprinting the barcode on the package. For the exact arithmetic behind that 13th digit — the check digit that lets a scanner detect a misread — see our step-by-step guide to EAN-13 checksum calculation.

EAN-13 and UPC-A Structure

An EAN-13 barcode is built from four segments:

  1. GS1 prefix (2–3 digits) — identifies the country or region where the manufacturer's GS1 member organization is registered (this is not where the product was manufactured).
  2. Manufacturer code — a unique ID assigned to the company by their national GS1 organization.
  3. Product code — assigned by the manufacturer to identify the specific item.
  4. Check digit (1 digit) — a Modulo-10 checksum computed from the previous 12 digits.

UPC-A is functionally a 12-digit subset of this same GS1 numbering system used primarily in the US and Canada; prefixing a UPC-A code with a leading 0 produces a valid 13-digit EAN-13 equivalent, which is why most modern POS scanners can read both formats interchangeably.

Code 128: The Logistics Workhorse

Code 128 is the default choice whenever a barcode needs to hold more than just digits. It supports the full ASCII character set (letters, numbers, and punctuation) in a compact, variable-length format, and it includes three character subsets:

  • Subset A — uppercase letters, digits, and control characters.
  • Subset B — uppercase and lowercase letters, digits, and punctuation.
  • Subset C — pairs of digits packed two-per-symbol, roughly doubling density for numeric-heavy data like tracking numbers.

Shipping carriers and warehouse management systems favor Code 128 because a single symbology can encode order numbers, SKUs, and routing codes without switching formats.

1D vs. 2D: Why Use a Matrix Code Instead?

Factor 1D Linear Barcode 2D Matrix Barcode
Data density Low — limited by print width High — same footprint stores far more data
Damage tolerance Low — a single scratch across the bars can break a read High — built-in error correction (see our QR error correction guide) survives partial damage
Scan equipment Laser scanners or camera imagers Camera imagers only (lasers can't read a 2D grid)
Typical payload A lookup ID (GTIN, SKU) A full URL, contact card, or structured record
Print size needed for a given payload Larger, for anything beyond a short numeric ID Smaller, for the same or larger payload

Data Matrix codes are especially common in electronics and medical device marking because they can be laser-etched directly onto a part at sizes as small as a few millimeters square while remaining readable — something no 1D symbology can match.

Choosing the Right Symbology

  • Selling a physical retail product? Use EAN-13 (international) or UPC-A (US/Canada-only retail) — required by most retailers' POS systems and GS1 compliance rules.
  • Shipping or tracking inventory internally? Use Code 128 for its flexibility with alphanumeric data and variable length.
  • Marking very small parts or needing damage resistance? Use Data Matrix.
  • Need to encode a URL, Wi-Fi credential, or more than plain digits, and want smartphone-friendly scanning? Use a QR code.

Generate 1D retail and shipping barcodes with our barcode generator, scan any barcode from a camera or image file with the barcode scanner, create 2D QR codes with the QR code generator, and scan QR codes using the QR code scanner.

Frequently Asked Questions

What is the difference between UPC-A and EAN-13?

UPC-A is a 12-digit barcode used primarily in the United States and Canada. EAN-13 is a 13-digit international standard used worldwide. Prefixing a 12-digit UPC-A code with a leading 0 converts it into a mathematically valid 13-digit EAN-13 GTIN, which is why most modern scanners read both without configuration.

Can Code 128 encode lowercase letters?

Yes. Code 128 Subset B supports both uppercase and lowercase letters along with digits and standard punctuation, unlike Code 39, which is uppercase-only.

Why do some barcodes use letters (like Code 39) and others only digits (like EAN-13)?

Retail symbologies like UPC-A and EAN-13 are restricted to digits because they follow the fixed-length GS1 numbering standard used by global retail databases. Symbologies designed for internal logistics, like Code 39 and Code 128, allow letters because they don't need to conform to that global numeric registry.

Is a QR code a type of barcode?

Yes, in the broad sense — "barcode" refers to any machine-readable optical code, and QR codes are a 2D matrix barcode symbology. In casual usage, "barcode" often refers specifically to 1D linear codes to distinguish them from 2D codes like QR.

Do all barcode symbologies include a check digit?

No. EAN-13, UPC-A, and ITF include a mandatory Modulo-10 check digit. Code 128 uses a different, more robust checksum built into its encoding. Code 39 traditionally has no mandatory check character, though an optional Modulo-43 check digit exists for higher-reliability applications.


References: GS1 General Specifications for Barcode Identification.

Free Calculator

Put this guide into action

Stop guessing — use our QR Code Generator to run real numbers, compare scenarios, and get instant results you can trust.

Use Free QR Code Generator
Toolio Editorial

Toolio Editorial Senior Technical Editors & UX Content Engineers

Digital Utilities, Web Engineering & Tool Guides

The Toolio Editorial Board is dedicated to delivering clear, transparent, and accurate technical guides across digital utilities, developer tools, unit conversion standards, date-time algorithms, and decision science. The board maintains rigorous editorial standards, factual accuracy, and step-by-step clarity for every guide published.

Try Calculator QR Code Generator
Use QR Code Generator

Continue Reading