Code 39, also known as ANSI/AIM Code 39,
USS Code 39, Code 3 of 9, is a discrete, variable-length symbology.
Code 39 is an alphanumeric bar code. The symbol can be as long as
necessary to store the encoded data. It is designed to encode 26
uppercase letters, 10 digits and 7 special characters. It can be
extended to code all 128 ASCII characters by using a two character
coding scheme.
Encoding
Code 39 is called code 39 or three of nine because each
character encoded is made up of 5 bars and 4 spaces for a total of
9 elements and 3 out of 9 element are always wide.
Check Sum
In applications that require very high level of accuracy a modulo
43 check sum digit is appended to the last character.
Code 39 Character Set
Code 39 starts with '*' and stops with '*'. Code39 is designed to
encode 26 upper case letters, 10 digits and 7 special characters:
Char |
Pattern
b s b s b s b s b |
|
Char |
Pattern
b s b s b s b s b |
0 |
n n n w w n w n n |
|
M |
w n w n n n n w n |
1 |
w n n w n n n n w |
|
N |
n n n n w n n w w |
2 |
n n w w n n n n w |
|
O |
w n n n w n n w n |
3 |
w n w w n n n n n |
|
P |
n n w n w n n w n |
4 |
n n n w w n n n w |
|
Q |
n n n n n n w w w |
5 |
w n n w w n n n n |
|
R |
w n n n n n w w n |
6 |
n n w w w n n n n |
|
S |
n n w n n n w w n |
7 |
n n n w n n w n w |
|
T |
n n n n w n w w n |
8 |
w n n w n n w n n |
|
U |
w n n n n n n w w |
9 |
n n w w n n w n n |
|
V |
n w w n n n n n w |
A |
w n n n n w n n w |
|
W |
w w w n n n n n n |
B |
n n w n n w n n w |
|
X |
n w n n w n n n w |
C |
w n w n n w n n n |
|
Y |
w w n n w n n n n |
D |
n n n n w w n n w |
|
Z |
n w w n w n n n n |
E |
w n n n w w n n n |
|
- |
n w n n n n w n w |
F |
n n w n n w n n w |
|
. |
w w n n n n w n n |
G |
n n n n n w w n w |
|
SP |
n w w n n n w n n |
H |
w n n n n w w n n |
|
* |
n w n n w n w n n |
I |
n n w n n w w n n |
|
$ |
n w n w n w n n n |
J |
n n n n w w w n n |
|
/ |
n w n w n n n w n |
K |
w n n n n n n w w |
|
+ |
n w n n n w n w n |
L |
n n w n n n n w w |
|
% |
n n n w n w n w n |
Code 39 Extended: The code 39 symbology can be extended to
encode all 128 characters in the ASCII table. In the full ASCII
mode, the symbols $ / % and + are used as precedence codes with the
26 letters as shown below. Since the same symbol now can be
interpreted as one character in Extended Code 39 mode and two
characters in Code 39 mode, the readers must be set to extended
mode to read the data correctly.
Code 39 examples by using ezBarcodeComponent
[C#]
using ezBarcodeComponent.Winform;
//create barcode class
Barcode barcode1 = new Barcode();
//Specify the CodeData to encode
barcode1.CodeData = "0123456789";
//Set the Symbology to Code39
barcode1.Symbology = Symbologies.Code39;
barcode1.CheckCharacter= true;
barcode1.CheckCharacterInText = true;
//Save the image
barcode1.SaveImageAs("code39.gif", System.Drawing.Imaging.ImageFormat.Gif);
[Vb.net]
'create barcode class
Dim barcode1 As New Barcode
'Specify the CodeData to encode
barcode1.CodeData = "0123456789"
'Set the Symbology to Code39
barcode1.Symbology = Symbologies.Code39
barcode1.CheckCharacter= True
barcode1.CheckCharacterInText = True
'Save the image
barcode1.SaveImageAs("code39.gif", System.Drawing.Imaging.ImageFormat.Gif)
Example of Code 39 barcode images. The last digit 2 is
the check sum digit.