CODE 128

CODE 128 is the barcode developed by Computer Identics Corporation (U.S.A.) in 1981. CODE 128 can represent all 128 ASCII code characters (numbers, upper case/lower case letters, symbols and control codes). Since it can represent all characters (except Japanese kanji, hiragana and katakana) that can be used with a computer keyboard, it is a computer friendly barcode.

CODE 128 组成

The basic composition is as follows: image

  • There are 4 types of bar size.
  • One character is represented by 3 bars and 3 spaces (total six elements).
  • A start character has three types; "CODE-A", "CODE-B" and "CODE-C". The type of start character determines the character composition of subsequent characters. (See the table of character composition on page 41. For example, when CODE A is used as a start character, the characters in the CODE-A column can be represented.) image
  • When CODE-C is used, 2-digits numbers can be represented by one type of bar pattern. This allows the very high data density.
  • When code set characters (CODE-A, CODE-B and CODE-C) are used, the barcode started with the start character of CODE-A can be changed to use the characters in the CODE-B or CODE-C column in the middle of barcode processing.
  • When "SHIFT" is used, only one character next to the SHIFT can be changed to the character in the next column (A to B, B to C, C to A). (Similar to the SHIFT key operation of on the computer keyboard) ・"Modulus 103" is used as a check digit.

CODE 128 字符

image image image image

CODE 128 特点

  • CODE 128 barcode can include all 128 ASCII code characters (including control codes such as [ESC], [STX], [ETX], [CR] and [LF]).
  • When CODE-C is used as the start character, one bar pattern can represent 2-digits numbers. This allows very efficient barcode composition. If the barcode data has 12 or more digits, CODE 128 provides smaller size than ITF.
  • Since CODE 128 uses 4 types of bar size, printers with high print quality are required. CODE 128 is not suitable for printing with dot matrix printers and FA ink-jet printers and for flexographic printing on corrugated cardboards.

CODE 128 应用

Use of CODE-C as the start code allows CODE 128 to provide the barcode with very high data density, if only numbers are handled. GS1-128 makes use of the characteristics of CODE 128 and is currently used in many industrial applications. With GS1-128, various data are included in the barcode, such as manufacturing date of the product, open date, weight, size, lot number, destination, customer's account, etc.. CODE 128 is used in the following industries:

  • U.S.A. apparel industry
  • U.S.A. food process industry
  • U.S.A. drugs and medical equipment industry
  • Food industries in Australia and New Zealand
  • European drugs and medical instruments industry


What Is GS1-128?

GS1-128 is the barcode that provides various data including distribution and business transaction data in addition to the data provided by the JAN code and the standard distribution code (ITF) currently available.

Following data can be included in GS1-128 barcode:

  • Package number
  • Quantity in package
  • Weight, capacity and cubic capacity
  • Manufacturing date and validity of quality・Lot number
  • Location number (destination)
  • Customer's account code
  • Customer's order number Necessary data is used to form the barcode label for the various applications.

For example, On-line purchasing/ordering using EDI (the system for exchanging electronic data between companies), management of open date for foods, management of drugs validity, simplifying the work for checking incoming products, sorting packages for every destination, etc.. (The following label is a sample from a food manufacturer.) image

Background of GS1-128 Establishment

JAN code and the standard distribution code (ITF) are the barcodes for indicating the product itself and its quantity and not for the data such as manufacturing date, package number, validity of quality and order number. While CODE 39 allows such data to be included in the barcode, the exchange of such data between companies is not allowed because the definition and the number of digits of the data are different. GS1-128 is established as the world universal barcode for common use, with the items and the number of digits of the data and the type of the barcode being standardized.

GS1-128 Composition

The basic composition of GS1-128 is as follows:

  • Code 128 is used as the barcode.
  • In order to separate the required data such as weight and open data, the "application identifier (AI)" is added which is followed by the data. If more than one data is represented, each data shall be linked. image

In the sample above, following the application identifier "01", 14-digits code is assigned to identify the delivery container (minimum package unit for corrugated cardboard boxes). Following the application identifier "15", the data representing the validity of quality (consumption validity or drug validity) is given to show August 27, '95. Following the last application identifier "30", the data representing the delivery quantity is given to show 3 pieces. There are about 100 application identifiers except the above. The required data is selected and included in the barcodes by users.

GS1-128 is not intended to represent fixed data, but the data is selectable by the user. Therefore, for consistent use of GS1-128 among companies, the standards for the barcode system with the data available shall be prepared by the respective industry and the groups of companies involved.

  • In order to distinguish GS1-128 from CODE 128, it is required to give [FNC 1](function 1) following the start code (CODE-A to C).

  • Even if the number of digits for the data following the application identifier is a variable-length, [FNC 1] is given to separate the data. image

  • With GS1-128 being added to EAN code and the standard distribution code (ITF), it can be used as the code to add more data. GS1-128 is designed to represent the application identifiers and the products relative data or the transaction data of the companies using CODE 128. In other words, GS1-128 is the standard for the applications to represent the various data. CODE 128 is the standard just for the barcode itself. The difference between GS1-128 and CODE 128 is whether it represents the application or not. Since GS1-128 uses the barcode composition of CODE 128, any barcode reader that can read CODE 128 can be used to read the GS1-128 data.

Application Identifier

refer to the gs1 specification.


Every GS1-128 barcode begins with the (FNC1) “Function Code One” character and an Application Identifier (AI) number. The AI defines a specific purpose for the data field after it. The combination of the AI and its data field is referred to as the element string. The AI is represented with parentheses around it in the Human Readable representation below the barcode. Multiple element strings may also be encoded according to GS-1 specifications. Variable element strings should be encoded last in the symbol and FNC1 characters must be encoded between two or more variable length element strings.








第一个FNC1,如果转换的话,很多扫码工具都会输出为"]C1",也有不输出的。 zxing转换的话,需要打开ASSUME_GS1

 Map<DecodeHintType, DecodeHintType> hints = new HashMap();