Barcodes8 min read2026-08-11

Code 128 Barcodes Explained: Subsets, Checksums & When to Use Them

A practical Code 128 guide: what it is, the A/B/C subsets, the mod-103 checksum, Code 128 vs Code 39, GS1-128 for logistics, and when to use it instead of a UPC or EAN.

M

Written by Muhaymin Bin Mehmood

Software Developer & BatchSet Founder · Updated 2026-08-11

Share
Table of contents

What Code 128 Is (and Why It's Everywhere)

Code 128 is a high-density, variable-length linear barcode introduced in 1981. Unlike a UPC or EAN — which only encode a fixed string of digits for retail checkout — Code 128 can encode all 128 ASCII characters: digits, uppercase and lowercase letters, punctuation, and control characters.

That flexibility is why it became the workhorse of logistics, warehousing, and internal inventory. Shipping labels, carton codes, SKU tags, and healthcare labels are overwhelmingly Code 128. If a barcode isn't on a retail shelf and encodes letters as well as numbers, it's very often Code 128.

The Three Subsets: A, B, and C

Code 128 gets its density from three character sets — called subsets — that the symbol can switch between mid-barcode. Each is optimised for a different kind of data:

  • Code Set A — uppercase letters, digits, standard punctuation, and ASCII control characters
  • Code Set B — uppercase and lowercase letters, digits, and punctuation (the most common general-purpose set)
  • Code Set C — pairs of digits (00–99), encoding two numeric digits in a single symbol character for maximum density
ℹ️

Code Set C is why Code 128 is so compact for numeric data: encoding digits two-at-a-time roughly halves the width of a long number compared with formats that encode one character at a time. A good generator picks and switches subsets automatically.

How a Code 128 Symbol Is Built

Every Code 128 barcode follows the same anatomy, and understanding it explains why a few printing rules matter so much:

  1. 1A quiet zone — blank margin — on the left
  2. 2A start character that also declares the initial subset (Start A, B, or C)
  3. 3The encoded data characters
  4. 4A checksum character calculated modulo 103 over the symbol
  5. 5A stop character
  6. 6A quiet zone on the right
💡

The modulo-103 checksum is mandatory and is what makes Code 128 self-checking. You never calculate it by hand — the generator computes and embeds it. Your job is only to keep the quiet zones and print it sharp.

Code 128 vs Code 39: Which Should You Use?

Code 39 is the older alternative you'll still see on asset tags and industrial labels. It's simpler and extremely widely supported, but Code 128 wins on almost every practical measure for modern use:

  • Character set — Code 39 encodes 43 characters (uppercase, digits, a few symbols) with no lowercase; Code 128 covers the full ASCII set including lowercase
  • Density — Code 128 is significantly more compact, especially for numbers thanks to Code Set C; Code 39 barcodes get long quickly
  • Error checking — Code 128 always includes a checksum; Code 39's check character is optional and often omitted
  • Legacy support — Code 39 is trivially decoded by very old or cheap scanners, which is its one lingering advantage
ℹ️

For new internal labelling, Code 128 is almost always the better default. Choose Code 39 only if you must support legacy scanners or a system that specifically requires it.

GS1-128: Code 128 for the Supply Chain

GS1-128 (previously called UCC/EAN-128) isn't a different symbology — it's a standardised way of using Code 128. It uses a special FNC1 character followed by Application Identifiers (AIs): short numeric prefixes that tell a system what the data means.

For example, an AI can flag that the following digits are a GTIN, a batch/lot number, an expiry date, or a serial number. That's how a single logistics label on an outer carton can carry the product identity, the batch, and the expiry date in one machine-readable code. If you're printing carton or pallet labels for a distributor, GS1-128 with the correct AIs is usually what they ask for.

⚠️

GS1-128 is for logistics units — cartons, pallets, shipments — not the retail item scanned at a till. The consumer product still needs a UPC or EAN. Don't put a GS1-128 where a retail POS expects a GTIN barcode.

When to Use Code 128 — and When Not To

Code 128 is the right tool for a wide range of jobs, but not for retail checkout. Use this to decide:

  • Use it for internal SKUs, warehouse bins, and inventory labels — any code you control that never hits a retail register
  • Use it for shipping and carton labels (often as GS1-128 with Application Identifiers)
  • Use it whenever you need to encode letters as well as numbers, or want a compact numeric code
  • Do NOT use it as the retail product barcode — for shelf/marketplace scanning you need a UPC-A or EAN-13 GTIN
Generate a Code 128 barcode free

How to Generate a Code 128 Barcode

Because Code 128 uses your own numbers, a free generator does the whole job end to end — no GS1 licence needed for internal codes.

  1. 1Open the Barcode Generator and choose Code 128
  2. 2Type in your SKU or reference — letters and numbers are both fine, and the checksum is added for you
  3. 3Download a print-ready PNG, or upload an Excel/CSV column of SKUs to bulk-generate the whole set as a ZIP
💡

Bulk Code 128 from a spreadsheet is the fastest way to label a fresh batch of inventory — one column of SKUs in, a ZIP of named barcode images out.

Generate sharp, scannable Code 128 barcodes for your SKUs — free, no signup.

Free to start — no credit card required.

Generate Barcodes Free →

Tools mentioned in this guide

Image tools for e-commerce sellers

Bulk convert, resize and optimize your whole product catalog

Frequently Asked Questions

What is a Code 128 barcode used for?

Code 128 is used for internal SKUs, warehouse and inventory labels, and shipping/logistics labels. It encodes the full ASCII set — letters, numbers, and symbols — and is compact, which makes it ideal wherever you control the numbering and need more than plain retail digits.

What are the A, B, and C subsets in Code 128?

They're three character sets the barcode can switch between. Set A covers uppercase, digits, punctuation and control characters; Set B adds lowercase; Set C encodes pairs of digits for high-density numeric data. A generator selects and switches subsets automatically.

Code 128 vs Code 39 — which is better?

Code 128 is denser, supports lowercase and the full ASCII set, and always includes a checksum, so it's the better default for modern labelling. Code 39 is older and simpler, and its main advantage is being readable by very old or basic scanners.

Do I need to calculate the Code 128 check digit myself?

No. Code 128 uses a mandatory modulo-103 checksum that the generator computes and embeds automatically. You just enter your data and download the image.

What is GS1-128 and how is it different from Code 128?

GS1-128 is a standardised use of Code 128 for the supply chain. It adds an FNC1 character and Application Identifiers that label the data — for example a GTIN, batch number, or expiry date — so a logistics label can carry several structured fields in one barcode.

Can I use Code 128 as a product barcode for retail?

No. Retail checkout and marketplaces expect a UPC-A or EAN-13 GTIN. Code 128 is for internal and logistics use. If you're selling a product on a shelf or marketplace, generate a UPC or EAN for the item and reserve Code 128 for your own SKUs and shipping labels.