Code 128

Code 128

The Code 128 character set was introduced in 1981 to solve the problem of representing both alphabetic and numeric characters without sacrificing barcode density.

Although Code 39 - Full ASCII can represent any combination of the 128 ASCII characters, it can take up a fair amount of space to do so. On the other hand, although Interleaved 2-of-5 is a very dense symbology, it can only store numeric information. Code 128 not only gives you the ability to encode all 128 ASCII characters, when encoding numbers only, it can actually encode them more densely than Interleaved 2-of-5.

The most common use of Code 128 is for certain shipping labels, primarily as defined by the Uniform Code Council in their UCC-128 shipping container bar coding standard. When used for this purpose, Code 128 is sometimes called GS1-128 (UCC/EAN-128) (see the section below).

The Character Set

Although Code 128 can encode all 128 lower ASCII characters, the character set itself contains only 102 characters. This is possible because Code 128 actually contains three different sets of 102 characters. The default character set in use for any Code 128 barcode is determined by the start character. However, once a Code 128 barcode is started, it is possible to switch between the different character sets in the middle of the barcode. Because it is possible to use any combination of the three character sets in a single barcode, Code 128 gives you the greatest possible character density when encoding data into barcode.

The three character code sets can be summarized as follows:

  • Code A: The Full ASCII set, except for the 26 lower case letters.
  • Code B: The Full ASCII set, except for the 26 "control" characters.
  • Code C: Double-density numeric. This character set is numeric-only, but any one character actually represents two digits. Therefore, 100 of the 102 characters in code set C are used to represent the 100 two-character combinations from 00 through 99.

BarTender allows selection of any of these code sets or an auto mode that will determine the best mode for the data entered. It is also possible to select the manual mode where the character code (^A, ^B, ^C, or ^S) for the different modes must be entered by the user as the first character of the segment of barcode data using that code set. Multiple segments with different code sets can be used in a single barcode.

The Density

Code 128 is the densest Full ASCII symbology. Furthermore, through the use of its Code C character set, it can actually represent numbers more densely than Interleaved 2-of-5.

On a Dot-Matrix Printer

An alphanumeric message can be represented at a character density of 5.4 characters per inch. A numeric-only message can be represented at a character density of 10.8 characters per inch.

On a Laser Printer

An alphanumeric message can be represented at a character density of 10.0 characters per inch. A numeric-only message can be represented at a character density of 20.0 characters per inch.

The Symbology Structure

While most barcode symbologies only print bars and spaces in two widths, wide and narrow, Code 128 uses four different widths, more like the UPC family. However, whereas the UPC family uses four elements (two bars and two spaces) per character, each Code 128 character is represented by six elements (three bars and three spaces). Although this represents a 50% reduction in character density, Code 128 can represent all 128 ASCII characters. Unlike UPC, Code 128 is not limited to numbers only.

The Start and Stop Characters

Code 128 actually has three different start characters: the start character for Code A, the start character for Code B, and the start character for Code C. The one that will be used for a given barcode depends on what characters need to be encoded in that portion of the barcode.

Code 128 start characters have the same number of bars and spaces (3 each) as regular Code 128 characters.

When Code 128 is used as the one-dimensional component of a composite barcode the last character before the check character (see below) must also be a code set identifier. This serves as a linkage flag that alerts the scanner to the presence of the two-dimensional component. The code set identifier used depends on what was the last code set used in the barcode and which symbology is used for the two-dimensional part.

Last Code Set Used

Two-Dimensional Symbology is CC-A or CC-B

Two-Dimensional Symbology is CC-C

A

Code Set Identifier B

Code Set Identifier C

B

Code Set Identifier C

Code Set Identifier A

C

Code Set Identifier A

Code Set Identifier B

The Code 128 stop character has the same number of spaces as a regular Code 128 character, but it has one extra bar.

The Check Digits

The last character before the stop character in any Code 128 barcode is a check digit. Unlike some other barcode symbologies, Code 128 barcodes must always be printed and read using check digits; there is no option to turn off the check digits. In addition, there is no conventional "human" interpretation for the check digit.

Special Characters

When creating a Code 128 barcodes, there are special characters that may be entered by typing in a combination of the caret (^) symbol and another character anywhere in your data stream. These combinations are listed below.

All Modes:

  • ^1 will insert a function 1 (FNC1) character.
  • ^2 will insert a function 2 (FNC2) character.
  • ^3 will insert a function 3 (FNC3) character.
  • ^4 will insert a function 4 (FNC4) character.
  • ^% will insert a mod 10 check digit.

Manual Mode Only:

  • ^A will set the following data segment to Code A.
  • ^B will set the following data segment to Code B.
  • ^C will set the following data segment to Code C.
  • ^S will insert a Shift character.

GS1-128 (UCC/EAN-128)

GS1-128 (UCC/EAN-128) is the name given to Code 128 barcodes that conform to the UCC standards. Such barcodes include FNC1 characters, application identifiers, check digits, and extra spaces and parentheses in the human readable text. For more information, see GS1-128.

More barcode symbologies

More Information

Live Webinar Series:
Easy data integration with the BarTender Integration Builder 
Register now!


BarTender Overview

What's New in BarTender 2016

Compare Editions

Get Technical Specifications

Buy BarTender

Upgrade BarTender

Register BarTender

Get Technical Support

Get Printer Drivers

Barcode Software

Our Customers Say

"BarTender’s ability to integrate with any ERP and Safety Data Sheet authoring and management system, coupled with its easy-to-use and powerful Intelligent Templates™, has made it our go-to software product for integrating and solving the challenges associated with GHS compliance labeling in all of our chemical customers."

—Rick Schilling, President, Integrated Productivity Systems (IPSi)