Code 128 Barcode Specification

   Minimize

Introduction

Code 128 is a high-density alphanumeric symbology. Since it was introduced in early 1980s, it has been widely adopted by many industry applications. UCC/EAN derives its retail carton tracking standard UCC/EAN-128 based on Code 128 symbology.
Code 128 is a variable length, continuous symbology with multiple element widths. Every Code 128 symbol has a check character. Each character is encoded with three bars and spaces, in total 11 modules.
Code 128 is designed to encode 128 full ASCII characters.
Code 128 has 106 different printed character patterns. Each printed character can have one of three different meanings, depending on the context selector. Three different start characters tell the reader the character set used in the following encoding, and three shift codes permits changing character set inside the symbol. From the table below, we can see that character set A and B is used to encode alpha-numeric information while character set C offers double density when being used to encode numeric data. The special character Shift, changes the character set of the immediately followed character. The shift work only with Code A or Code B characters. Four FNC characters are listed, FNC2 is used to tell barcode reader to store the data and transmit with next symbol; FNC1, FNC3 and FNC4 are reserved for future applications.
In an open system, the minimum value of X dimension is 7.5 mils. the minimum bar height is 15 percent of the symbol length or 0.25 inches, whichever is greater. The starting and trailing quiet zones should be at least 0.25 inch wide.
Structure of a code 128 barcode
A typical code 128 barcode has the following structure:
§ A start character
§ Message encoded
§ Check character
§ Stop Character
§ Termination bar (bar+space+bar)
Check Digit Calculation
Every Code 128 symbol requires a check character being placed between encoded data and stop character. The check character is derived from a modulo 103 calculation of the weighted sum of all characters. Here is the procedure to calculate the check character:
1.     Take the value (0 through 102) of each character in the message. This includes the start character, shift character, but excluding the stop character.
2.     Start with the first character of the data, assign the weight for each character. The first character has a weight of 1, the second character has a weight of 2.. and increment by 1. Note that the start character also has a weight of 1. stop character is excluded in the calculation.
3.     Multiply the character value with weight. Sum all the results.
4.     Divide the result by 103 and get the remainder. Look up the remainder in the table to get the check character.
5.     The stop character, and termination bar is appended after the check character.