Code 128, also known as ANSI/AIM 128, USS
Code 128 is a continuous, multilevel, full ASCII code.
Encoding
Code 128 There are three types of code 128 encoding. Type A
provides the character set of all upper case alphanumeric
characters plus all of the ASCII control characters. Type B
provides the character set of all upper and lower case alphanumeric
characters. Type C provides increased density for numeric encoding
with double density numeric characters for all number pairs from 00
to 99.
Check Sum
Code 128 symbology must include a checksum digit. The steps for
calculating the check digit are as follows: Add the start character
value(103, 104, or 105) to the running checksum. Take each
character in the message, take its value, and multiply it by its
character position, and add the total to the running checksum. The
checksum digit is the result of running checksum modulo 103.
Use Caret (^)
The UseCaret propeties is set to true by default which is only
apply to Code128, UccEan128, Sscc18, Scc14, PDF417, MacroPDF417, QR
Code, and DataMatrix etc. where full ASCII is accepted as encoding.
The 3 digits data following the caret will be treated as ASCII
code, e.g. ^010 is \\n.
For Code 128, UccEan128, if the FNC1 (ASCII 202) is used, human
readable parentheses can be added to the CodeData manually by using
the following ASCII code
^222 = (XX)
^223 = (XXX)
^224 = (XXXX)
^225 = (XXXXX)
^226 = (XXXXXX)
^227 = (XXXXXXX)
The ^222, ^223, ^224, ^225, ^226, ^227 will be transfer to FNC1
(ASCII 202) in the barcode, however, the parantheses will be added
to human readable text by the digits. For example, to encode
(01)2345678, the data of ^222012345678 would be used.
Code 128 Character Set
Code A
|
Code B
|
Code C
|
ASCII
|
Char
|
Value
|
|
Code A
|
Code B
|
Code C
|
ASCII
|
Char
|
Value
|
Space
|
Space
|
00
|
0032
|
|
00
|
|
V
|
V
|
54
|
0086
|
V
|
54
|
!
|
!
|
01
|
0033
|
!
|
01
|
|
W
|
W
|
55
|
0087
|
W
|
55
|
"
|
"
|
02
|
0034
|
"
|
02
|
|
X
|
X
|
56
|
0088
|
X
|
56
|
#
|
#
|
03
|
0035
|
#
|
03
|
|
Y
|
Y
|
57
|
0089
|
Y
|
57
|
$
|
$
|
04
|
0036
|
$
|
04
|
|
Z
|
Z
|
58
|
0090
|
Z
|
58
|
%
|
%
|
05
|
0037
|
%
|
05
|
|
[
|
[
|
59
|
0091
|
[
|
59
|
&
|
&
|
06
|
0038
|
&
|
06
|
|
\
|
\
|
60
|
0092
|
\
|
60
|
'
|
'
|
07
|
0039
|
'
|
07
|
|
]
|
]
|
61
|
0093
|
]
|
61
|
(
|
(
|
08
|
0040
|
(
|
08
|
|
^
|
^
|
62
|
0094
|
^
|
62
|
)
|
)
|
09
|
0041
|
)
|
09
|
|
_
|
_
|
63
|
0095
|
_
|
63
|
*
|
*
|
10
|
0042
|
*
|
10
|
|
nul
|
`
|
64
|
0096
|
`
|
64
|
+
|
+
|
11
|
0043
|
+
|
11
|
|
soh
|
a
|
65
|
0097
|
a
|
65
|
,
|
,
|
12
|
0044
|
,
|
12
|
|
stx
|
b
|
66
|
0098
|
b
|
66
|
-
|
-
|
13
|
0045
|
-
|
13
|
|
etx
|
c
|
67
|
0099
|
c
|
67
|
.
|
.
|
14
|
0046
|
.
|
14
|
|
eot
|
d
|
68
|
0100
|
d
|
68
|
/
|
/
|
15
|
0047
|
/
|
15
|
|
eno
|
e
|
69
|
0101
|
e
|
69
|
0
|
0
|
16
|
0048
|
0
|
16
|
|
ack
|
f
|
70
|
0102
|
f
|
70
|
1
|
1
|
17
|
0049
|
1
|
17
|
|
bel
|
g
|
71
|
0103
|
g
|
71
|
2
|
2
|
18
|
0050
|
2
|
18
|
|
bs
|
h
|
72
|
0104
|
h
|
72
|
3
|
3
|
19
|
0051
|
3
|
19
|
|
ht
|
i
|
73
|
0105
|
i
|
73
|
4
|
4
|
20
|
0052
|
4
|
20
|
|
lf
|
j
|
74
|
0106
|
j
|
74
|
5
|
5
|
21
|
0053
|
5
|
21
|
|
vt
|
k
|
75
|
0107
|
k
|
75
|
6
|
6
|
22
|
0054
|
6
|
22
|
|
ff
|
l
|
76
|
0108
|
l
|
76
|
7
|
7
|
23
|
0055
|
7
|
23
|
|
cr
|
m
|
77
|
0109
|
m
|
77
|
8
|
8
|
24
|
0056
|
8
|
24
|
|
s0
|
n
|
78
|
0110
|
n
|
78
|
9
|
9
|
25
|
0057
|
9
|
25
|
|
s1
|
o
|
79
|
0111
|
o
|
79
|
:
|
:
|
26
|
0058
|
:
|
26
|
|
dle
|
p
|
80
|
0112
|
p
|
80
|
;
|
;
|
27
|
0059
|
;
|
27
|
|
dc1
|
q
|
81
|
0113
|
q
|
81
|
<
|
<
|
28
|
0060
|
<
|
28
|
|
dc2
|
r
|
82
|
0114
|
r
|
82
|
=
|
=
|
29
|
0061
|
=
|
29
|
|
dc3
|
s
|
83
|
0115
|
s
|
83
|
>
|
>
|
30
|
0062
|
>
|
30
|
|
dc4
|
t
|
84
|
0116
|
t
|
84
|
?
|
?
|
31
|
0063
|
?
|
31
|
|
nak
|
u
|
85
|
0117
|
u
|
85
|
@
|
@
|
32
|
0064
|
@
|
32
|
|
syn
|
v
|
86
|
0118
|
v
|
86
|
A
|
A
|
33
|
0065
|
A
|
33
|
|
etb
|
w
|
87
|
0119
|
w
|
87
|
B
|
B
|
34
|
0066
|
B
|
34
|
|
can
|
x
|
88
|
0120
|
x
|
88
|
C
|
C
|
35
|
0067
|
C
|
35
|
|
em
|
y
|
89
|
0121
|
y
|
89
|
D
|
D
|
36
|
0068
|
D
|
36
|
|
sub
|
z
|
90
|
0122
|
z
|
90
|
E
|
E
|
37
|
0069
|
E
|
37
|
|
esc
|
{
|
91
|
0123
|
{
|
91
|
F
|
F
|
38
|
0070
|
F
|
38
|
|
fs
|
|
|
92
|
0124
|
|
|
92
|
G
|
G
|
39
|
0071
|
G
|
39
|
|
gs
|
}
|
93
|
0125
|
}
|
93
|
H
|
H
|
40
|
0072
|
H
|
40
|
|
rs
|
~
|
94
|
0126
|
~
|
94
|
I
|
I
|
41
|
0073
|
I
|
41
|
|
us
|
del
|
95
|
0195
|
Ã
|
95
|
J
|
J
|
42
|
0074
|
J
|
42
|
|
fnc 3
|
fnc 3
|
96
|
0196
|
Ä
|
96
|
K
|
K
|
43
|
0075
|
K
|
43
|
|
fnc 2
|
fnc2
|
97
|
0197
|
Å
|
97
|
L
|
L
|
44
|
0076
|
L
|
44
|
|
Shift
|
Shift
|
98
|
0198
|
Æ
|
98
|
M
|
M
|
45
|
0077
|
M
|
45
|
|
code C
|
code C
|
99
|
0199
|
Ç
|
99
|
N
|
N
|
46
|
0078
|
N
|
46
|
|
code B
|
fnc 4
|
code B
|
0200
|
È
|
100
|
O
|
O
|
47
|
0079
|
O
|
47
|
|
fnc 4
|
code A
|
code A
|
0201
|
É
|
101
|
P
|
P
|
48
|
0080
|
P
|
48
|
|
fnc 1
|
fnc 1
|
fnc 1
|
0202
|
Ê
|
102
|
Q
|
Q
|
49
|
0081
|
Q
|
49
|
|
Start A
|
Start A
|
Start A
|
0203
|
Ë
|
103
|
R
|
R
|
50
|
0082
|
R
|
50
|
|
Start B
|
Start B
|
Start B
|
0204
|
Ì
|
104
|
S
|
S
|
51
|
0083
|
S
|
51
|
|
Start C
|
Start C
|
Start C
|
0205
|
Í
|
105
|
T
|
T
|
52
|
0084
|
T
|
52
|
|
Stop
|
Stop
|
Stop
|
0206
|
Î |
|
U
|
U
|
53
|
0085
|
U
|
53
|
|
|
|
|
|
|
|
ezBarcodeComponent will automatically swich between encoding code
set if the AUTO is set for the encoding method.
Code 128 examples by using ezBarcodeComponent
[C#]
using ezBarcodeComponent.Winform;
//create barcode class
Barcode barcode1 = new Barcode();
//Specify the CodeData to encode
barcode1.CodeData = "^2220123456789";
//Set the Symbology to Code128
barcode1.Symbology = Symbologies.Code128;
barcode1.Code128Set = Code128.Auto;
barcode1.UseCaret= true;
//Save the image
barcode1.SaveImageAs("code128.gif", System.Drawing.Imaging.ImageFormat.Gif);
[Vb.net]
'create barcode class
Dim barcode1 As New Barcode
'Specify the CodeData to encode
barcode1.CodeData = "^2220123456789"
'Set the Symbology to Code128
barcode1.Symbology = Symbologies.Code128
barcode1.Code128Set = Code128.Auto
barcode1.UseCaret= True
'Save the image
barcode1.SaveImageAs("code128.gif", System.Drawing.Imaging.ImageFormat.Gif)
Example of Code 128 barcode images. ^2220123456789 is
translated to (01)23456789 for human readable text and Ê01234567 in
the CodeData.