Each individual character is comprised of 3 bars and 3 spaces where the length of the bars and spaces are varied to form 106 unique combinations or 106 unique VALUEs. This VALUE will identify a character in one of three different Code Sets (Set A, Set B, or Set C). Code Set A includes upper case letters, numbers, symbols, and control characters. Code Set B is very similar to Set A except that most of the ASCII control characters are replaced with lower case letters. Code Set C is a set of digit pairs ranging from 00 to 99 and enable doubling the density of numeric only data. All three Code Sets include a few special function characters. A complete listing of characters, Code Sets, and VALUEs can be found at the end of this document.
The START character identifies the beginning of the barcode and which Code Set is initially used. Its VALUE must be 103, 104, or 105; identifying Code Set A, B, or C respectively. Within the DATA, special characters enable changing the Code Set at any time and as often as necessary.
Code 128 specifications allow encoding any number of data characters in the barcode. Although there is no limitation in the specification, there will be practical limitations due to physical size of the barcode and scanning equipment. See the data table at the end of this document for Code Set information.
Beyond DATA characters that hold information, there are also special function characters that may be encoded within the DATA for various purposes. Within each Code Set there are characters for switching to the other two Code Sets. The A and B Code Sets also have a SHIFT character which will switch only the next character from Set A to Set B or vice versa. These may be used as frequently as necessary and may enable further compression of the barcode. There are also characters referred to as FNC1, FNC2, FNC3, and FNC4, which serve as instructions specifically for the barcode reader. Generally, FNC1 is reserved for use in EAN applications. FNC2 instructs the barcode reader to concatenate the current message with the next message. FNC3 is a reset instruction to the barcode reader. And FNC4 remains available for use in closed system applications.
The check character is used to verify integrity of the data as a whole and must be calculated as part of both the barcode printing and reading process. In general, it is a Modulus 103 Checksum calculated by summing the START code and the product of each data character with its position within the data.
In the example below we will encode “Code128” using Code Set B. Each DATA character’s value will be multiplied times its position within the data set for example “e” has a character VALUE of 69 and is the 4th character resulting in a product of 69 x 4 = 276. All of the products are added together and added to the VALUE of the START B character, 104, resulting in a total sum of 1138. 1138 is then divided by 103 with a remainder of 5. The “%” sign has a value of 5 and is therefore the CHECK character. The final code reads: [START B]Code128[%][STOP]
Message: [StartB] C o d e 1 2 8
Values: 104 35 79 68 69 17 18 24
Position: 1 2 3 4 5 6 7
Sum/Product: 104 + 35 + 158 + 204 + 276 + 85 + 108 + 168
Sum Total: 1138
Modulus: 1138 / 103 = 11 remainder 5
5 = %
Final Code: [START B]Code128%[STOP]
The STOP character ends the barcode and has a value of 106 for all three Code Sets. The STOP character uniquely does not follow the 3 bars and 3 spaces convention but has 4 bars and 3 spaces.
The Quiet Zones are blank spaces before and after the barcode. They help the barcode reader to distinguish the barcode from other markings. Each Quiet Zone must be at least 10 x-dimensions or 0.25 inches which ever is greater.
The most basic unit of measure within a barcode is the x-dimension and is equivalent to the width of the most narrow bar or space within the barcode. Each character is 11 x-dimensions wide (except for the STOP character which is 13 wide). The minimum size of the x-dimension is 7.5 mils or 0.0075 inches. The overall length of a barcode varies because the number of DATA characters may vary; however, it follows this formula:
L = (11 * C + 35) * X
L = Overall length (not including Quiet Space)
C = Number of DATA characters (not including START, CHECK, or STOP)
X = length of x-dimension
Example: Code128 -> C = 7, X = 0.010"
L = (11 * 7 + 35) * 0.010” = 1.120” without Quiet Zones
or 1.120” + 2 * Max(10 * 0.010”, 0.25”) = 1.370” with Quiet Zones
Example: Code128Barcode -> C = 14, X = 0.010"
L = (11 * 14 + 35) * 0.010” = 1.890” without Quiet Zones
or 1.890” + 2 * Max(10 * 0.010”, 0.25”) = 2.140” with Quiet Zones
The height of the barcode must be 15% of the length or 0.25” which ever is greater.
H = L * 0.15 or 0.25” whichever is greater
H = Overall height
L = Overall length (not including Quiet Space)
Example: Code128 -> L =1.370
H = 1.370" * 0.15 = 0.2055" -> Min Height = 0.25"
Example: Code128Barcode -> L =1.890
H = 1.890" * 0.15 = 0.2835" -> Min Height = 0.2835"
Other Sources of Information
A free demonstration utility of the Code 128 barcode may be found on the PrecisionID.com web site at evaluation/precisionid_c128_demo.zip . You may download the PrecisionID Code 128 Font Manual at tutorials/code128_barcode_user_manual.pdf . You will also find other barcode and symbology related articles and products at http://www.precisionid.com . PrecisionID.com offers Barcode, MICR, and OCR Font products, as well as other ID components.
You can purchase complete Code 128 specifications or find related information from the following organizations:
AIM, Inc. http://www.aimglobal.org
Automatic Identification Manufacturers Association
125 Warrendale-Bayne Road, Warrendale, PA 15086
American National Standards Institute
1831 L Street, NW, 6th floor Washington, DC 20036
25 West 43rd Street, 4th Floor, New York, NY 10036
European Article Numbering Association
Avenue Louise 326, Bte 10, 1050 Brussels - Belgium
Phone: 32 (0) 2-788 78 00
ISBT 128 http://www.isbt-web.org
International Society of Blood Transfusion
1075 HP Amsterdam, The Netherlands
Phone: 31 (0) 20 679 3411