Code 3 of 9 (39) Specification
One of the most widely used symbologies, Code 39 can encode messages using
capitalized alpha characters, numbers 0 through 9 and seven special characters.
It has a flexible, variable-length format. Code 39 is used by the Department of
Defense and by the automotive industry, among others. Its main drawback is that
it takes up a lot of label space, sometimes causing problems when there is a lot
of data to be encoded.

Code 39 is an alphanumeric bar code that can encode decimal numbers, the
upper case alphabet, and the following special symbols:
- . * $ / % +
(NOTE: The asterisk is only valid as a start/stop character)
Code 39 characters are constructed using nine elements, five bars and four
spaces. Of these nine elements, two of the bars and one of the spaces are wider
than the rest. Wide elements represent binary ones (1), and narrow elements
represent binary zeros (0). The character set table shows each of the available
characters with their corresponding check character values.
To enable a decoder to distinguish between the wide and narrow elements a
minimum wide to narrow ratio is needed. Depending upon which resolution has been
used for the printing of the bar code, the width of the wide element should be
at least two times greater than the narrow element. A ratio of three to one is
better. All elements of the same type should be printed the same size. (The
width of a narrow bar should be the same as a narrow space.)
Code 39 is a discrete bar code, with a space between characters which
contains no information. The width of this intercharacter gap should be
approximately equal to the narrow element width. The structure of Code 39 makes
it self checking, but there is an optional message check character.
Character Set
ASCII Binary Check Character
Character Word Bars Spaces Value
0 000110100 00110 0100 0
1 100100001 10001 0100 1
2 001100001 01001 0100 2
3 101100000 11000 0100 3
4 000110001 00101 0100 4
5 100110000 10100 0100 5
6 001110000 01100 0100 6
7 000100101 00011 0100 7
8 100100100 10010 0100 8
9 001100100 01010 0100 9
A 100001001 10001 0010 10
B 001001001 01001 0010 11
C 101001000 11000 0010 12
D 000011001 00101 0010 13
E 100011000 10100 0010 14
F 001011000 01100 0010 15
G 000001101 00011 0010 16
H 100001100 10010 0010 17
I 001001100 01010 0010 18
J 000011100 00110 0010 19
K 100000011 10001 0001 20
L 001000011 01001 0001 21
M 101000010 11000 0001 22
N 000010011 00101 0001 23
O 100010010 10100 0001 24
P 001010010 01100 0001 25
Q 000000111 00011 0001 26
R 100000110 10010 0001 27
S 001000110 01010 0001 28
T 000010110 00110 0001 29
U 110000001 10001 1000 30
V 011000001 01001 1000 31
W 111000000 11000 1000 32
X 010010001 00101 1000 33
Y 110010000 10100 1000 34
Z 011010000 01100 1000 35
- 010000101 00011 1000 36
. 110000100 10010 1000 37
SPACE 011000100 01010 1000 38
* 010010100 00110 1000 -
$ 010101000 00000 1110 39
/ 010100010 00000 1101 40
+ 010001010 00000 1011 41
% 000101010 00000 0111 42
Check Character Calculation
The Code 39 check character is a modulus 43 sum of all of the message
character values and is printed as the last character in the message. The check
character values are given in the above table. The check chararacter is computed
by adding up all of the values, dividing by 43, and using the remainder as the
value of the check character.
Step 1: From the table below, find the values of each character.
C O D E 3 9 <--Message characters
12 24 13 14 38 3 9 <--Character values
Step 2: Sum the character values.
12 + 24 + 13 + 14 + 38 + 3 + 9 = 113
Step 3: Divide the result by 43.
113 / 43 = 11 with remainder of 27.
Step 4: From the table, find the character with this value
27 = R = Check Character
Code 39 Extended
Extended Code 39 encodes the full 128 character ASCII character set by
combining pairs of Code 39 characters. Enabling Extended Code 39 causes the
following characters to be output for each character pair.
EXTENDED CODE 39 CHARACTERS
To produce this Use these
ASCII Character Barcode Characters
NUL %U
SOH $A
STX $B
ETX $C
EOT $D
ENQ $E
ACK $F
BEL $G
BS $H
HT $I
LF $J
VT $K
FF $L
CR $M
SO $N
SI $O
DLE $P
DC1 $Q
DC2 $R
DC3 $S
DC4 $T
NAK $U
SYN $V
ETB $W
CAN $X
EM $Y
SUB $Z
ESC %A
FS %B
GS %C
RS %D
US %E
SPACE SPACE
! /A
" /B
# /C
$ /D possibly $
% /E possibly %
& /F
' /G
( /H
) /I
* /J
+ /K possibly +
, /L
- /M better to use -
. /N better to use .
/ /O possibly /
0 /P better to use 0
1 /Q better to use 1
2 /R better to use 2
3 /S better to use 3
4 /T better to use 4
5 /U better to use 5
6 /V better to use 6
7 /W better to use 7
8 /X better to use 8
9 /Y better to use 9
: /Z
; %F
< %G
= %H
> %I
? %J
@ %V
A A
B B
C C
D D
E E
F F
G G
H H
I I
J J
K K
L L
M M
N N
O O
P P
Q Q
R R
S S
T T
U U
V V
W W
X X
Y Y
Z Z
[ %K
\ %L
] %M
^ %N
_ %O
` %W
a +A
b +B
c +C
d +D
e +E
f +F
g +G
h +H
i +I
j +J
k +K
l +L
m +M
n +N
o +O
p +P
q +Q
r +R
s +S
t +T
u +U
v +V
w +W
x +X
y +Y
z +Z
{ %P
| %Q
} %R
~ %S
DEL %T |