Code 39 Symbology

Code 39 has been developed by Intermec in 1974. It is sometimes called Code 3/9 or Code 3 of 9.

Code39

Code 39 is a discrete alphanumeric code. The length of the code is arbitrary.

The character set consists of 10 digits, 26 uppercase letters and 8 special characters. The characters are composed of narrow and wide bars and spaces, where the wide elements are between 2 and 3 times the width of the narrow elements. Each character starts and ends with a bar, between the characters is a space for separation, which can be narrow or wide, up to 3 times the narrow width.

Each character consists of nine elements, five bars B1 to B5 and four spaces S1 to S4. Three elements out of the nine are wide (1), six elements are narrow (0). A character is between 12 (when wide/narrow = 2) and 15 (when wide/narrow = 3) modules wide.

Character Index B1 S1 B2 S2 B3 S3 B4 S4 B5
0 0 0 0 0 1 1 0 1 0 0
1 1 1 0 0 1 0 0 0 0 1
2 2 0 0 1 1 0 0 0 0 1
3 3 1 0 1 1 0 0 0 0 0
4 4 0 0 0 1 1 0 0 0 1
5 5 1 0 0 1 1 0 0 0 0
6 6 0 0 1 1 1 0 0 0 0
7 7 0 0 0 1 0 0 1 0 1
8 8 1 0 0 1 0 0 1 0 0
9 9 0 0 1 1 0 0 1 0 0
A 10 1 0 0 0 0 1 0 0 1
B 11 0 0 1 0 0 1 0 0 1
C 12 1 0 1 0 0 1 0 0 0
D 13 0 0 0 0 1 1 0 0 1
E 14 1 0 0 0 1 1 0 0 0
F 15 0 0 1 0 1 1 0 0 0
G 16 0 0 0 0 0 1 1 0 1
H 17 1 0 0 0 0 1 1 0 0
I 18 0 0 1 0 0 1 1 0 0
J 19 0 0 0 0 1 1 1 0 0
K 20 1 0 0 0 0 0 0 1 1
L 21 0 0 1 0 0 0 0 1 1
M 22 1 0 1 0 0 0 0 1 0
N 23 0 0 0 0 1 0 0 1 1
O 24 1 0 0 0 1 0 0 1 0
P 25 0 0 1 0 1 0 0 1 0
Q 26 0 0 0 0 0 0 1 1 1
R 27 1 0 0 0 0 0 1 1 0
S 28 0 0 1 0 0 0 1 1 0
T 29 0 0 0 0 1 0 1 1 0
U 30 1 1 0 0 0 0 0 0 1
V 31 0 1 1 0 0 0 0 0 1
W 32 1 1 1 0 0 0 0 0 0
X 33 0 1 0 0 1 0 0 0 1
Y 34 1 1 0 0 1 0 0 0 0
Z 35 0 1 1 0 1 0 0 0 0
- 36 0 1 0 0 0 0 1 0 1
. 37 1 1 0 0 0 0 1 0 0
38 0 1 1 0 0 0 1 0 0
$ 39 0 1 0 1 0 1 0 0 0
/ 40 0 1 0 1 0 0 0 1 0
+ 41 0 1 0 0 0 1 0 1 0
% 42 0 0 0 1 0 1 0 1 0
* - 0 1 0 0 1 0 1 0 0

The length w of Code 39 code expressed in modules is w=(n+2)(3r+6)+(n+1)g, where n is the number of characters encoded including any check digits but not the start and stop characters, r is the wide-to-narrow ratio, and g is the inter-character gap width.

The Code 39 occurs without or with one check digit.

The check digit is implemented according a modulo 43 algorithm. Every character has an index (I in the table above) which is added up, the final sum is then divided by 43 and the remainder is the index of the check digit.

Here is an example of the check digit calculation using the sample code above:

Character Index
* -
C 12
O 24
D 13
E 14
38
3 3
9 9
R Sum: 113, 113 : 43 = 2 remainder 27 -> R
* -