Skip to main content

Code 128

General & Common CodesAlso known as: Code 128

Published by the QRinsec Editorial Team — practical documentation about QR codes, barcode standards, and QRinsec’s client-side tools. Content is reviewed against product testing and published technical documentation from sources such as GS1, Denso Wave, and ISO standards where applicable.

Have questions or corrections? Contact us.

Code 128 is a high-density linear (1D) barcode that can encode all 128 ASCII characters, making it one of the most versatile barcodes for alphanumeric data. It has no fixed length, so it adapts to short or long strings.

Important Notice

Code 128 is not the same as GS1-128. GS1-128 requires a leading FNC1 character and requires data to be structured using GS1 Application Identifiers.

Important Notice

Always include a human-readable interpretation line below the barcode for manual fallback.

Key Facts

Characters
All 128 ASCII
Length
Variable
Check
Modulo 103
Subsets
A, B, C
Common Use
Shipping / logistics

What is a Code 128 barcode?

Code 128 is a high-density linear barcode symbology capable of encoding all 128 ASCII characters. Introduced in 1981 by Computer Identics Corporation, it is widely used in logistics, shipping labels (FedEx, UPS, USPS), and GS1-128 supply chain barcodes. Unlike EAN/UPC barcodes, Code 128 has no fixed length — it can encode as many characters as needed, making it extremely versatile for variable-data applications.

Code subsets explained (A, B, C)

Code 128 uses three internal code sets:

  • Code A: ASCII 00–95 (control characters + uppercase).
  • Code B: ASCII 32–127 (full printable ASCII).
  • Code C: Pairs of digits (00–99) encoded at double density — ideal for long numeric strings like SSCC shipping container codes.

A single barcode can switch between subsets mid-symbol using special switch codewords, allowing optimal compression.

Check character algorithm

Code 128 uses a weighted modulo-103 check character (not Modulo 10):

  1. Start with the start-character value (A=103, B=104, C=105).
  2. For each subsequent data codeword, multiply its value by its position index (1, 2, 3…).
  3. Sum the start value + all weighted products.
  4. Check character = total mod 103.

This is calculated automatically by all barcode generators and verified by every Code 128 scanner.

Code 128 vs. Code 39 vs. QR Code

Code 128 is denser than Code 39 (encodes the same data in ~30% less space) and supports the full ASCII set, whereas Code 39 only covers 43 characters natively. For 2D applications, QR Code stores more data in less physical space but requires a camera-capable scanner. Code 128 is preferred when linear scanners are in use and data includes lowercase letters or special characters.

When to use Code 128

Code 128 is the right choice for: shipping and logistics labels, GS1-128 (formerly UCC/EAN-128) supply-chain data, healthcare barcodes (HBC), warehouse rack labels, and any application requiring full ASCII encoding in a linear barcode.

Printing requirements

Minimum X-dimension (narrowest bar): 0.19 mm (7.5 mil) for handheld scanners; 0.25 mm for fixed scanners. Quiet zones: 10× X-dimension each side. No mandatory height, but GS1-128 requires minimum 32 mm bar height. Always include human-readable text below for manual entry fallback.

Common scanning failures

Excessively narrow X-dimensions (below printer resolution), missing quiet zones, and incorrect start/stop characters are the top Code 128 failure modes. When printing GS1-128 FNC1 application identifiers, ensure your generator inserts the FNC1 character correctly — a missing FNC1 makes the barcode invalid for GS1 supply chain use.

Comparison

FeatureCode 128Code 39QR Code
Character SetFull ASCII (128)43 charactersAll Unicode
Dimensions1D linear1D linear2D matrix
DensityHighLow–MediumVery High
Scanner TypeLaser/CCDLaser/CCDCamera/imager

Frequently Asked Questions

What is the difference between Code 128 and GS1-128?

GS1-128 is a subset of Code 128 that mandates a leading FNC1 character and requires data to be structured using GS1 Application Identifiers (AIs) such as (01) for GTIN or (17) for expiry date.

Can Code 128 encode lowercase letters?

Yes. Code Set B covers the full printable ASCII range including lowercase a–z, making Code 128 suitable for encoding mixed-case text.

How long can a Code 128 barcode be?

There is no fixed maximum, but practical limits depend on scanner depth-of-field. GS1 recommends keeping the physical symbol width under 165 mm for reliable scanning.

Is Code 128 supported by all barcode scanners?

Virtually all modern handheld and fixed-mount laser or CCD barcode scanners read Code 128 out of the box.

What is Code 128 Subset C used for?

Subset C encodes pairs of digits at double density — ideal for long numeric strings like SSCC (Serial Shipping Container Code) and GTIN-14 in logistics.

Need to create a Code 128 barcode?

Generate high-quality, scannable Code 128 barcodes for free with our advanced barcode generator. Download in vector SVG or PNG format.

Create Code 128 Barcode Now