Code 128
Code 128 is a high-density, variable-length alphanumeric symbology introduced in the early 1980s, widely adopted across industry and the basis for UCC/EAN 128.
Code 128 is a high-density alphanumeric symbology. Since its introduction in the early 1980s, it has been widely adopted across many industry applications. UCC/EAN derives its retail carton-tracking standard, UCC/EAN 128, from the 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, totalling 11 modules.
Code 128 is designed to encode all 128 ASCII characters.
Code 128 has 106 different printed character patterns. Each printed character can carry one of three different meanings, depending on the context selector. Three different start characters tell the reader which character set is used in the following encoding, and three shift codes allow the character set to be changed inside the symbol. From the table below, we can see that character sets A and B are used to encode alphanumeric information, while character set C offers double density when used to encode numeric data. The special Shift character changes the character set of the immediately following character, and works only with Code A or Code B characters. Four FNC characters are defined: FNC2 tells the bar code reader to store the data and transmit it with the next symbol; FNC1, FNC3, and FNC4 are reserved for other applications.
In an open system, the minimum value of the 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 leading and trailing quiet zones should be at least 0.25 inch wide.
A typical Code 128 bar code has the following structure:
- A start character
- The encoded message
- Check character
- Stop character
- Termination bar (bar+space+bar)
Every Code 128 symbol requires a check character placed between the encoded data and the stop character. The check character is derived from a modulo-103 calculation on the weighted sum of all characters. Here is the procedure for calculating the check character:
- Take the value (0 through 102) of each character in the message. This includes the start character and any shift character, but excludes the stop character.
- Starting with the first character of the data, assign a weight to each character. The first character has a weight of 1, the second a weight of 2, and so on, incrementing by 1. Note that the start character also has a weight of 1; the stop character is excluded from the calculation.
- Multiply each character's value by its weight, and sum all the results.
- Divide the result by 103 and take the remainder. Look up the remainder in the table to obtain the check character.
- The stop character and termination bar are appended after the check character.