Code 128, or Code128, was introduced in 1981 as a much more efficient alternative to older barcodes like Code 11, Code 39, and Codabar. Unlike its predecessors, which are limited to a subset of alphanumeric and symbol characters, Code 128 can be used to represent the full ASCII character set (characters 0 through 127).
Code 128 is often referred to as GS1-128 (formerly UCC/EAN-128), which is a widely supported application standard in the shipping and packaging industries.
Code 128 is a linear, or one-dimensional (1D) barcode. This means the barcode is composed of a single set of varying width vertical lines and spaces. The data in the barcode is represented linearly by these black/white (bar/space) patterns. Below is a simple example.
Each symbol in a Code 128 barcode has 6 elements: 3 bars (black) and 3 spaces (white), with the exception of the stop symbol, which has 7 elements (4 bars and 3 spaces). It uses 108 different symbols: 103 data symbols, 3 start symbols, and 2 stop symbols. It defines three different character sets or character modes (128A, 128B, and 128C). Each data symbol represents a different character depending on which character set is active; the initial character mode is set by the start character (which is why there are 3 different ones). Special symbols are used within the data message to change to a different character set if needed. These switches are called shifts (switch to a different character set for the next symbol only) and latches (shift to a different character set for all subsequent symbols).
The symbology is further characterized as a continuous barcode, meaning that each character is adjacent to the next with no inter-character gap element. Here is our example again, diagramed for clarity:
In the example above, the symbol is started in character set B (128B), as this character set includes both upper and lower case letters (character sets 128A and 128C do not).
Code 128 also includes a mandatory checksum (appearing after the data message, before the stop symbol). A modulo 103 computation is used.
Code 128 is widely supported, with most commercial barcode scanners being capable of reading it. Its high-density and ASCII 127 support make it ideal for a wide variety uses. Its symbols are more complex to generate than less capable symbologies like Code 39 (since they support multiple character sets and require a checksum), so encoding software is often used in conjunction with specialized fonts.
Code 128 is used extensively in many industries:
The Cognex Mobile SDK supports Code 128 detection, enabling developers to gather relevant workflow and application data into their barcode scanning apps. You can download the SDK for free by registering on the Cognex Mobile Barcode Developer Network. In addition, the Barcode Scanner SDK supports a broad range of symbologies to meet your growing development needs.