Code 128 A, B, C

Code 128 was developed by Computer Identics in 1981 and has become very popular over the years. It's widely used for warehouse management, in the transport industry (e.g. UPS) and in retail as Code 128 EAN / UCC. Originally called Code 128 EAN/UCC this variation is now known as 128 GS1. See Code 128 GS1 for a discussion of Code 128 GS1 but read this page first.

Code 128 Code Sets

Three different code sets are defined for Code 128 (dubbed A, B, and C) that determine how the code is interpreted by the barcode scanner. The code sets differ in compaction and encodable character set.

Code 128 A: Partial ASCII set, no lower case, but ASCII control chars (TAB, CR/LF etc.)
Code 128 B: Full ASCII set, no ASCII control chars
Code 128 C: Only digits 0-9, encoded in pairs, very compact code

The code set to use is indicated to the scanner by the start symbol. Also defined are various mode switching or shift characters to switch from one set to another within a barcode symbol. Usually the code set selection and switching within a symbol is handled by the barcode software that creates the code.

Accented, Diacritic Characters and Umlauts with Code 128

In principle non-ASCII characters like German umlauts (e.g. ÄÖÜ) can be encoded in a Code 128 symbol by using a special character (FNC4). However, this feature is not widely supported. Using a 2D barcode symbology like Aztec or Datamatrix with dedicated support for non-ASCII data might be a better choice.

Checksum for Code 128

Code 128 uses a Modulo 103 checksum algorithm. All characters of a symbol are added up and modulo divided by 103. The remainder is the checksum. For a sample calculation, see the Wikipedia article on Code 128. Usually the barcode software that generates the code will calculate the check digit automatically.

Sample Code 128

Purely numeric code, resulting in a Code 128 C symbol:

Code 128 C

Mixed data, resulting in a Code 128 B full ASCII symbol (note the difference in the first three lines that indicate the start symbol). Also note that this code is wider than the previous example although less data is encoded:

Code 128 B

Mixed data ("ABC<TAB>DEF>"), resulting in a symbol that starts as Code 128 B to encode "ABC", then shifts to Code 128 A to encode the <TAB>, then back to 128 B to encode "DEF":

Code 128 A

When scanning this code, the barcode scanner will put out "ABC", followed by the <TAB>, then "DEF". This can be very useful: Consider a data entry mask with two fields. The <TAB> can be used to move the focus from one field to the next. The fist part of the code ("ABC") would go into the first field, the second part ("DEF") would go into the second field.

Non printable characters (like the <TAB> above) are entered into Softmatic BarcodePlus using the tilde notation: You enter the tilde, followed by the three digit ASCII code of the symbol. E.g. to encode a <TAB> into the code you would enter "~009":

Code 128 A Generator

Note that non-printable characters are not put into the human readable text under the barcode.

Create Code 128 A, B, C

Softmatic BarcodePlus creates Code 128 A, B, C. The software analyzes the data to encode to determine what subtype to use. The Code 128 check digit is calculated automatically. The barcodes are exported as EPS (vector) and to common raster formats.

Windows PC - Softmatic® BarcodePlus (Win, V4, Windows XP or higher)

Download for Windows

Mac OS X - Softmatic® BarcodePlus (Mac, V4, 10.7 "Lion" or higher)

Download for Mac

Developers: Make sure to see our Code 128 .NET Barcode Generator.