Click for a Business Review of IDAutomation.com, Inc., a Barcode Hardware, Software & Services in Tampa FL Contact IDAutomationView your cart in the IDAutomation Store
Loading
Home > Barcode FAQ > Code 39 Barcode FAQ and Tutorial:

Code 39 Barcode FAQ & Tutorial

Code 39 Barcode Symbology Overview

Code 39 is a common barcode type used for various labels such as name badges, inventory and industrial applications. The symbology of the Code 39 character set consists of barcode symbols representing numbers 0-9, upper-case letters A-Z, the space character and the following symbols: - . $ / + %. Lower-case characters may also be easily encoded with the extended fonts provided in the IDAutomation Code-39 Font Package.

The Code 39 barcode is the easiest of the alpha-numeric barcodes to use and is designed for character self-checking, thus eliminating the need for check character calculations. Code 39 is also known as the 3 of 9 Barcode, Code 3 of 9 and Barcode39. Several standards exist that dictate how Code 39 barcodes should be printed for certain implementations. Although a checksum character is optional, many standards require it. The checksum character is a type of MOD43 calculation provided in many of the IDAutomation font encoders for the Code 39 Barcode Fonts. Enabling the check digit is also an option within IDAutomation Barcode Components and Applications that allow the component to automatically generate and include the MOD43 checksum without fonts.

The following standards based on the 3 of 9 barcode require MOD43 check digits:

  • LOGMARS (Logistics Applications of Automated Marking and Reading Symbols) is a standard based on Code 39 used by the United States Department of Defense. LOGMARS is defined by Military Standard MIL-STD-1189B and others such as MIL-STD-129, MIL-STD-2073-1C and MIL-STD-129N.
  • HIBC (Health Industry Barcode) is a barcode label used in the health care product industry. Several implementations of HIBC also use Code 128.

The complete Code 39 barcode consists of a start character, data digits, an optional check character and a stop character.

Start Character Data Digits Optional Check Character Stop Character
* CODE-39 P *
code 39 barcode

The Code 39 asterisk character is usually used as a start/stop character, and should not be part of the data in the barcode. The asterisk may be used as the start/stop character with fonts; however, this may cause problems in some applications such as MS Word, because they may treat text surrounded with asterisks as bold text. In IDAutomation Code 39 barcode fonts, the exclamation and parentheses characters are also used as start/stop characters to avoid these problems and provide additional functionality.

Printing & Generating Code 39 Barcodes

Printing of the Code 39 barcode as a font is an easy process if checksum characters are not required for the implementation. If the checksum is needed, IDAutomation provides several Font Encoders, Components and Applications for this purpose.

IDAutomation Code 39 Barcode Fonts may be created directly from the keyboard or used in a calculated field to dynamically produce multiple symbols in many applications, including Microsoft Word, Excel, FileMaker, QuickBooks and OpenOffice.

To create a 3 of 9 barcode manually that encodes the data "BAR CODE-39", the following may be performed:

  1.  Type the start character of "*".
  2. Enter the data to be encoded, which is "BAR CODE-39".
  3. To create the space in the barcode using the standard Code 39 Fonts, an underscore must replace the space in the data to encode: "BAR_CODE-39".
  4. Type the stop character of "*" .
  5. Select only *BAR_CODE-39* and change the font to the Code 39 Barcode Font.

When the IDAutomation Code 39 Barcode Font is used, the parenthesis may be used as the start and stop characters to keep the asterisks from appearing in the text interpretation. For example, (BAR_CODE-39).

2014 Update: IDAutomation now provides Symbol Encoded Fonts that encode the space character without a substitution character; available in the latest version of the IDAutomation Code 39 Fonts. After installation, these fonts are identified by the "Y" character in the font name, for example IDAutomationYHC39S.

Calculated Field Use

Code 39 Barcodes may be dynamically created from a calculated field in a text box by using a formula that appends the start and stop characters. This is possible in several applications including the following:

  • Active Reports: Field1.Text ="*"&Field&"*" example...
  • Clarion: loc:barcode='*'&left(clip(DataField))&'*'
  • Crystal Reports: Enter "*" & Field & "*" in a calculated field.
  • FileMaker Pro: Enter "*" & Field & "*" in a calculated field so that the asterisk is appended to the beginning and ending of the data from the source field.
  • Lotus Notes: A formula that places a return function (in extended39) between fields: "*" + DataField1 + "$M" + DataField2 + "*"
  • Lotus Approach: Combine('*', DataField, '*') - Here is an approach formula that also replaces spaces with the "=" character as required: Combine('*', Translate(DataField,' ','='), '*')
  • Lotus 123 for Windows: ("*"&C3&"*")
     - this formula converts a number in cell C9 to text for barcoding: ("*"&@STRING(C9,0)&"*")
  • Microsoft® Access: =("("&[Table.Field1]&")")
  • Microsoft® Excel: =("("&C3&")")
  • Oracle Reports and Forms - Place an asterisk before and after the data and apply IDAutomation's barcode font to the field.
  • QuickBooks: Refer to IDAutomation's QuickBooks Barcode Tutorial.

Integration Guides

Several Barcode Integration Guides are also available that suggest one or more barcode 39 printing options. These integration options should be examined to determine whether to use barcode components, applications or fonts for the printing of barcodes. A few of the Barcode Integration Guides offered include the following:

Reading Code 39 Barcodes

The most common method of reading barcodes is with a barcode scanner. Most barcode scanners recommended by IDAutomation perform keyboard emulation and receive power from the USB port, so that no external power supply is required. When a barcode is scanned using keyboard emulation, the data scanned appears at the cursor as if it had been typed in from the keyboard.

Most barcode scanners have the ability to read Code 39 barcodes by default, such as the IDAutomation USB Barcode Scanner. This scanner dependably reads the IDAutomation Code 39 Barcode Font and Universal Barcode Font when printed as small as 6 points, which is an X dimension of 4 mils.

MOD43 Check Character Calculation Examples

The manual calculations described below are rarely necessary. IDAutomation provides several barcode font tools, plug-ins and source code samples that are free to use with IDAutomation fonts, which automatically format the start, stop and check characters to the barcode fonts. Additionally, the check digit option in all Components and Applications calculates and includes the checksum automatically.

Perform the following to calculate the optional modulus 43 check character manually:

  1. Using the table below, obtain the number value of each data character.
  2. Add all of these values together.
  3. Divide the total by 43 and obtain the remainder.
  4. The check character is the value of the remainder.

For example, perform the following calculations to determine the check character using the data characters "CODE39":

  1. The values are 12, 24, 13, 14, 3 and 9.
  2. When added together, these total 75.
  3. Now divide 75 by 43 and the remainder is 32.
  4. The check character is W

Code 39 Character Values:

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

Encoding ASCII Character Set in Extended Code 39:

Within the IDAutomation Code-39 Font Package, extended fonts are provided to easily encode lower-case characters in addition to upper-case letters and numbers. When these fonts are not being used, or when it is necessary to encode additional characters, shift functions may be used to extend the character set according to ISO 646. In order for Extended Code 39 to be decoded properly, the scanner must first be programmed to read it. Otherwise, the scanner will simply scan the existing data, for example "+C" instead of "c."

When extended Code 39 is enabled, functions may be directly encoded by using the format $? to specify the function where ? equals the character that represents the appropriate function in the chart below. For example, Code$I3of9$M will encode Code[TAB]3of9[RETURN].

The Extended Code 39 ASCII Character Table

The Extended Code 39 ASCII Character Table

ASCII Code39 ASCII Code39 ASCII Code39 ASCII Code39 ASCII (Functions) Code39
A A a +A 0 0 ESC (Escape) %A SH (Start of Heading) $A
B B b +B 1 1 FS (File Separator) %B SX (Start of Text) $B
C C c +C 2 2 GS (Group Separator) %C EX (End of Text) $C
D D d +D 3 3 RS (Record Separator) %D ET (End of Transmission) $D
E E e +E 4 4 US (Unit Separator) %E EQ (Enquiry) $E
F F f +F 5 5 ; %F AK (Acknowledge) $F
G G g +G 6 6 < %G BL (Bell-Audible of Attention Signal) $G
H H h +H 7 7 = %H BS (Backspace) $H
I I i +I 8 8 > %I HT (Horizontal Tabulation) $I
J J j +J 9 9 ? %J LF (Line Feed) $J
K K k +K ! /A [ %K VT (Vertical Tabulation) $K
L L l +L " /B \ %L FF (Form Feed) $L
M M m +M # /C ] %M CR (Carriage Return) $M
N N n +N $ /D ^ %N SO (Shift Out) $N
O O o +O % /E _ %O SI (Shift In) $O
P P p +P & /F { %P DL (Data Link Escape) $P
Q Q q +Q ' /G | %Q D1 (Device Control 1-XON) $Q
R R r +R ( /H } %R D2 (Device Control 2) $R
S S s +S ) /I ~ %S D3 (Device Control 3-XOFF) $S
T T t +T * /J DEL %T D4 (Device Control 4) $T
U U u +U + /K NU (Null) %U NK (Negative Acknowledge) $U
V V v +V , /L @ %V SY (Synchronous Idle) $V
W W w +W - /M ` %W EB (End of Transmission Block) $W
X X x +X . /N SP
(= or ~ in the fonts)
SP CN (Cancel) $X
Y Y y +Y / /O EM (End of Medium) $Y
Z Z z +Z : /Z     SB (Substitute) $Z

Note: A space symbol cannot usually be represented from a font with an actual space (ASCII 32). To overcome this issue with Code 39 Fonts:

Back to Top

 ©Copyright 2015 IDAutomation.com, All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us
Training Videos on YouTube Join us on Google Plus Join us on LinkedIn Follow us on Twitter Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.