| Tip: Bookmark this page with Ctrl-D (Win) or Apple-D (Mac) | Main • Products • Know How / FAQ • Store • Contact |
Code 128, Code 128 GS1
Code 128 was developed by Computer Identics in 1981. Compared to other popular barcode symbologies at the time, like EAN or 2-of-5, Code 128 could encode the full ASCII set of characters (letters, small caps, digits, special characters). The code has gained widespread acceptance and popularity over the years. It's widely used for warehouse management, in the transport industry (e.g. UPS and FedEx) and in retail as Code 128 GS1 (formerly 128 EAN / UCC, see below for details).This sample barcode gives an idea of the encodable data:
Sample barcode created with our barcode plugin for Adobe Illustrator.
Code 128 comes in three code sets (dubbed A, B, and C) that differ in compaction and encodable character set.
Code 128 character set
Code 128 A: Partial ASCII set, no lower case, but ASCII control chars
Code 128 B: Full ASCII set, no ASCII control chars
Code 128 C: Only numbers 0-9, encoded in pairs, very compact code
Also defined are various mode switching or shift characters to switch from one set to another within a code symbol. Usually the respective barcode software will take care of any mode switching, thus ensuring that the smallest possible barcode size is created.
Code 128 GS1
EAN organizations wanted to extent the use of Code EAN / UPC beyond just encoding the article number or GTIN. Many applications would benefit from further information about a product, e.g. a "best before" date or a package size. The EAN organization compiled a specification, mainly consisting of data field specifiers (for example to specify a "best before" date). As Code EAN was not able to encode more than just the article number, the specification settled on Code 128 as the preferred barcode type to be used. The created codes were called Code 128 EAN (in the EAN region), and Code 128 UCC (in the UPC region).
When the EAN standards body was reorganized to form the new GS1 (Global Standard One) the codes were renamed to Code 128 GS1, although the specs didn't change.
Further information regarding Code 128 GS1 barcodes
As stated, a Code 128 GS1 barcode can not only contain an article number but also further information of interest. Tagging of that information within a code is achieved by so called field specifiers, groups of two to four digits that prepend the actual data. For example, the specifier "01" indicates that the 13-digit EAN number is to follow, the specifier "15" on the other hand indicates that a "best before" date of the format "YYMMDD" follows next (List of 128GS1 Specifiers).
Sample data: 01 4012345678901 15 090929
In this example an article with the EAN no. "4012345678901" and a "best before" date of "29th September 2009" is encoded.
For better readability the specifiers are enclosed by parentheses in the human readable portion of the code. The sample above would then read "(01)4012345678901(15)090929". Note that the parentheses are not encoded into the code.
Sample Code 128 GS1 Barcode
Screenshots taken from our Barcode Generator.
Seelcting the codetype and entering the data to encode (all data has to be entered including the field specifiers and parentheses):
The generated barcode:
The code only encodes the just the raw content of the data, the parentheses are not part of the barcode as scanning the code with a barcode scanner will reveal (the created code higher resolution, suitable for printing and scanning). The software that will eventually process the datastream will have to parse the data and extract the field specifiers and data content from the stream.
More facts about this barcode
Application: Warehouse management, logistics, transport industry
Characters: Full ASCII set
Checksum: Almost always
Checksum calculation: Modulo 103. Each character of the code can be a check character, even non printable characters which is why the check digit is usually not printed with the human readable text of the code.
More about the Code 128 check digit
While using a check digit with Code 128 is not mandatory, most barcode scanners available today require a check digit to be present. If a self made Code 128 symbol won't scan, it's usually because the check digit has been omitted (provided the print quality and symbol encoding were sound). All our barcode applications calculate the check digit automatically; for DIY calculation, the algorithm is described here.
Software to generate Code 128
- Barcode AddIn for Microsoft Word
- Barcode AddIn for Microsoft Excel
- Barcode Plugin for Illustrator
- Barcode Plugin for Indesign
- Barcode Command Line Tool
- .NET Barcode Library & Control
- C / C++ Barcode DLL


