Code 128 barcode is a high-density linear barcode symbology, which encodes digits, text, control characters, and full ASCII 128 characters.
Code 128, also known as ANSI/AIM 128, ANSI/AIM Code 128, USS Code 128, Uniform Symbology Specification Code 128, is a very capable linear barcode of excellent density, high reliability.
Code 128 barcode specification is defined in ISO/IEC 15417 Second edition in 2007-06-01. The specification full name is "ISO/IEC 15417:2007
Information technology - Automatic identification and data capture techniques - Code 128 bar code symbology specification".
There are several standards based on Code 128 specification.
Code 128 barcode is a common linear barcode type used in:
The Code 128 specification does not specify the maximum number of characters in a single barcode image.
However some Code 128 standards will provide the limits. GS1-128 has limits the maximum length of Code 128 data to 48 characters.
Code 128 has 3 start chars and 1 stop char. Start characters A, B and C define the corresponding code set to be used initially in the symbol.
The Stop character has unique 13 bar modules. The all three start chars, Code 128 symbol chars and check digit have 11 bar modules.
Start and Stop characters will not be displayed in the Code 128 printed barcode text.
Symbol Char Value | Code Set A | ISO/IEC 646 Value for Set A | Code Set B | ISO/IEC 646 Value for Set B | Code Set C |
0 | space | 32 | space | 32 | 00 |
1 | ! | 33 | ! | 33 | 01 |
2 | " | 34 | " | 34 | 02 |
3 | # | 35 | # | 35 | 03 |
4 | $ | 36 | $ | 36 | 04 |
5 | % | 37 | % | 37 | 05 |
6 | & | 38 | & | 38 | 06 |
7 | apostrophe | 39 | apostrophe | 39 | 07 |
8 | ( | 40 | ( | 40 | 08 |
9 | ) | 41 | ) | 41 | 09 |
10 | * | 42 | * | 42 | 10 |
11 | + | 43 | + | 43 | 11 |
12 | comma | 44 | comma | 44 | 12 |
13 | - | 45 | - | 45 | 13 |
14 | full stop | 46 | full stop | 46 | 14 |
15 | / | 47 | / | 47 | 15 |
16 | 0 | 48 | 0 | 48 | 16 |
17 | 1 | 49 | 1 | 49 | 17 |
18 | 2 | 50 | 2 | 50 | 18 |
19 | 3 | 51 | 3 | 51 | 19 |
20 | 4 | 52 | 4 | 52 | 20 |
21 | 5 | 53 | 5 | 53 | 21 |
22 | 6 | 54 | 6 | 54 | 22 |
23 | 7 | 55 | 7 | 55 | 23 |
24 | 8 | 56 | 8 | 56 | 24 |
25 | 9 | 57 | 9 | 57 | 25 |
26 | colon | 58 | colon | 58 | 26 |
27 | semi-colon | 59 | semi-colon | 59 | 27 |
28 | < | 60 | < | 60 | 28 |
29 | = | 61 | = | 61 | 29 |
30 | > | 62 | > | 62 | 30 |
31 | ? | 63 | ? | 63 | 31 |
32 | @ | 64 | @ | 64 | 32 |
33 | A | 65 | A | 65 | 33 |
34 | B | 66 | B | 66 | 34 |
35 | C | 67 | C | 67 | 35 |
36 | D | 68 | D | 68 | 36 |
37 | E | 69 | E | 69 | 37 |
38 | F | 70 | F | 70 | 38 |
39 | G | 71 | G | 71 | 39 |
40 | H | 72 | H | 72 | 40 |
41 | I | 73 | I | 73 | 41 |
42 | J | 74 | J | 74 | 42 |
43 | K | 75 | K | 75 | 43 |
44 | L | 76 | L | 76 | 44 |
45 | M | 77 | M | 77 | 45 |
46 | N | 78 | N | 78 | 46 |
47 | O | 79 | O | 79 | 47 |
48 | P | 80 | P | 80 | 48 |
49 | Q | 81 | Q | 81 | 49 |
50 | R | 82 | R | 82 | 50 |
51 | S | 83 | S | 83 | 51 |
52 | T | 84 | T | 84 | 52 |
53 | U | 85 | U | 85 | 53 |
54 | V | 86 | V | 86 | 54 |
55 | W | 87 | W | 87 | 55 |
56 | X | 88 | X | 88 | 56 |
57 | Y | 89 | Y | 89 | 57 |
58 | Z | 90 | Z | 90 | 58 |
59 | [ | 91 | [ | 91 | 59 |
60 | \ | 92 | \ | 92 | 60 |
61 | ] | 93 | ] | 93 | 61 |
62 | ^ | 94 | ^ | 94 | 62 |
63 | _ | 95 | _ | 95 | 63 |
64 | NUL | 00 | grave accent | 96 | 64 |
65 | SOH | 01 | a | 97 | 65 |
66 | STX | 02 | b | 98 | 66 |
67 | ETX | 03 | c | 99 | 67 |
68 | EOT | 04 | d | 100 | 68 |
69 | ENQ | 05 | e | 101 | 69 |
70 | ACK | 06 | f | 102 | 70 |
71 | BEL | 07 | g | 103 | 71 |
72 | BS | 08 | h | 104 | 72 |
73 | HT | 09 | i | 105 | 73 |
74 | LF | 10 | j | 106 | 74 |
75 | VT | 11 | k | 107 | 75 |
76 | FF | 12 | l | 108 | 76 |
77 | CR | 13 | m | 109 | 77 |
78 | SO | 14 | n | 110 | 78 |
79 | SI | 15 | o | 111 | 79 |
80 | DLE | 16 | p | 112 | 80 |
81 | DC1 | 17 | q | 113 | 81 |
82 | DC2 | 18 | r | 114 | 82 |
83 | DC3 | 19 | s | 115 | 83 |
84 | DC4 | 20 | t | 116 | 84 |
85 | NAK | 21 | u | 117 | 85 |
86 | SYN | 22 | v | 118 | 86 |
87 | ETB | 23 | w | 119 | 87 |
88 | CAN | 24 | x | 120 | 88 |
89 | EM | 25 | y | 121 | 89 |
90 | SUB | 26 | z | 122 | 90 |
91 | ESC | 27 | { | 123 | 91 |
92 | FS | 28 | | | 124 | 92 |
93 | GS | 29 | } | 125 | 93 |
94 | RS | 30 | ~ | 126 | 94 |
95 | US | 31 | DEL | 127 | 95 |
96 | FNC3 | FNC3 | 96 | ||
97 | FNC2 | FNC2 | 97 | ||
98 | SHIFT | SHIFT | 98 | ||
99 | CODE C | CODE C | 99 | ||
100 | CODE B | FNC4 | CODE B | ||
101 | FNC4 | CODE A | CODE A | ||
102 | FNC1 | FNC1 | FNC1 | ||
103 | Start A | ||||
104 | Start B | ||||
105 | Start C |
Code 128 barcode contains a mandatory check digit (checksum), which is based on module 103 (mod 103). The Code 128 check digit will not be displayed in the human readable interpretation (barcode text), and it will not be returned by the barcode decoder also.
The Code 128 barcode check digit (checksum) character shall be calculated according to the following algorithm.
For example, calculate the check character for Code 128 data "AIM1234"
Characters | Start Code B | A | I | M | Code C | 12 | 34 |
Char Values | 104 | 33 | 41 | 45 | 99 | 12 | 34 |
Weights | 1 | 1 | 2 | 3 | 4 | 5 | 6 |
Products | 104 | 33 | 82 | 135 | 396 | 60 | 204 |
Sum of Products | 1014 | ||||||
Divide by 103 (mod 103) | 1014 / 103 = 9 | ||||||
Remainder | 87 (check digit character value) |
Code 128 text printed below barcode is also named Code 128 human-readable interpretation (HRI).
According to the Code 128 specification,