Developed in 1974 by Dr. David Allais and Raymond Stevens at Intermec, Code 39 (frequently referred to as "Code 3 of 9") was the world's first alphanumeric barcode symbology. For over half a century, it has served as the industrial workhorse of the United States Department of Defense, automotive manufacturing plants (under AIAG standards), and corporate asset tracking systems.
While modern retail environments rely on UPC/EAN and logistics supply chains utilize Code 128, Code 39 remains uniquely dominant in harsh industrial settings. Its simple two-width geometry (wide vs narrow elements) allows it to be decoded by low-cost optical scanners even when etched directly onto cast aluminum engine blocks, stamped on military munitions, or printed on low-resolution dot matrix ribbons.
In this definitive technical guide, we break down the 9-element optical mechanics, character encoding tables, Full ASCII escape sequences, and Modulo-43 check math governing Code 39.
1. What Is Code 39 (3 of 9)?
Code 39 (standardized globally as ISO/IEC 16388) is a discrete, variable-length barcode symbology capable of encoding 43 standard alphanumeric characters without requiring complex compression tables.
Its name stems directly from its structural mathematical rule: every character is constructed from exactly 9 optical elements (5 bars and 4 spaces), of which exactly 3 elements are wide and 6 elements are narrow.
2. The 9-Element Binary Anatomy: Why It Is Inherently Self-Checking
In optical engineering, Code 39 is celebrated as an inherently self-checking symbology.
Because every single valid character requires precisely 3 wide and 6 narrow elements, an optical scanning error (such as a spec of dust or laser jitter) cannot convert one character into another unless it simultaneously turns a wide bar into a narrow bar AND a narrow space into a wide space! The odds of this double-error occurring at the exact same millisecond threshold are less than 1 in 3 million scans.
3. Standard 43-Character Set vs Extended Full ASCII Mode
Code 39 operates in two distinct operational modes:
1. Standard Code 39 (43 Characters)
In standard mode, Code 39 natively encodes 43 characters:
- 10 Digits:
0through9 - 26 Uppercase Letters:
AthroughZ(lowercase does not exist in standard mode) - 7 Special Symbols: Space ( ), Minus (
-), Period (.), Dollar ($), Slash (/), Plus (+), and Percent (%)
2. Extended Code 39 (Full 128 ASCII Mode)
To encode lowercase letters (a–z) and control characters (such as Tab or Enter), the Full ASCII mode combines the four special symbols ($, /, +, %) as escape prefixes:
- Lowercase
ais encoded as+A - Lowercase
zis encoded as+Z - Null character is encoded as
%U
Note: Using Full ASCII mode doubles the physical length of lowercase letters, making Code 128 a far superior choice if full ASCII density is required.
4. The Mandatory Asterisk (*) Start and Stop Delimiters
Every Code 39 barcode must begin and end with an asterisk (*) character.
The asterisk has a unique binary pattern (0 1 0 0 1 0 1 0 0). When an optical scanner sweeps across the bars, this pattern tells the decoder:
- Where the valid data begins and ends.
- Which direction the laser is traveling (left-to-right vs right-to-left), allowing the software to automatically invert backwards scans!
While the asterisk pattern must be printed as barcode bars, it does not need to be printed in the human-readable text beneath the bars. Printing PART-100 is preferred over *PART-100* to prevent human data-entry operators from accidentally typing the asterisks into software forms.
5. How to Calculate the Optional Modulo-43 Check Character
While standard Code 39 is self-checking, mission-critical applications (such as military weapon tracking or automotive assembly lines) mandate an optional Modulo-43 Check Character appended immediately before the stop asterisk.
Modulo-43 Calculation Steps:
- Assign each character its numerical value (0–9 = 0–9, A–Z = 10–35,
-= 36,.= 37, Space = 38,$= 39,/= 40,+= 41,%= 42). - Sum the numerical values of all data characters.
- Divide the sum by 43 and determine the integer remainder ($R = \text{Sum} \pmod{43}$).
- The character corresponding to the remainder is the check digit!
6. Code 39 vs Code 128: Physical Width & Density Trade-Offs
As shown in Figure 28.3, Code 39 has a significantly lower data density than Code 128. For a 10-character string, Code 39 produces a barcode nearly twice as long horizontally!
However, Code 39 offers two distinct mechanical advantages:
- Forgiving Print Tolerances: Because it only uses wide and narrow elements (with wide bars usually 3 times wider than narrow bars), low-resolution printers (like 203 DPI thermal printers or dot matrix ribbons) will not fail even if ink bleeds significantly.
- Direct Part Marking (DPM): Code 39 is widely used for dot-peen metal stamping and chemical laser etching on automotive cast parts where subtle 4-level bar widths cannot be reliably manufactured.
7. Military (MIL-STD-129) & Automotive (AIAG) Implementations
Two major enterprise sectors still mandate Code 39:
- US Military Standard 129 (MIL-STD-129): Mandates Code 39 for National Stock Numbers (NSN), Military Shipment Labels (MSL), and Contract Numbers on outer crates shipped to defense bases worldwide.
- Automotive Industry Action Group (AIAG B-10): Mandates Code 39 on shipping and identification parts tags across Ford, General Motors, and Stellantis component supplier tiers.
8. 4 Common Pitfalls When Generating Code 39
- Forgetting the Asterisks: Omitting the start/stop asterisks in the encoded string will prevent 100% of handheld scanners from reading the barcode!
- Using Lowercase in Standard Mode: Typing lowercase letters without enabling Full ASCII mode will cause generator errors or drop characters entirely.
- Encroaching on Inter-Character Gaps: Software rendering engines must ensure the blank space separating each character is at least equal to the narrow element width ($X$).
- Ignoring Quiet Zones: Code 39 requires a minimum quiet zone margin of 10 times the narrow bar width (or at least 6.35 mm) on both ends.
9. Frequently Asked Questions
Why is it called Code 39 or 3 of 9?
Every character in Code 39 is composed of exactly 9 elements (5 bars and 4 spaces). Of those 9 elements, exactly 3 are wide and 6 are narrow. This 3-of-9 ratio provides intrinsic self-checking capability.
Why do Code 39 barcodes have asterisks (*) at the start and end?
The asterisk (*) character is the dedicated start and stop pattern for Code 39. It tells optical barcode scanners which direction the laser is sweeping and where the data begins and ends. The asterisks are mandatory in the barcode bars but do not need to be printed in human-readable text.
What is the difference between Code 39 and Code 128?
Code 128 is significantly more compact than Code 39, encoding data using 4 element widths per module and supporting the full 128 ASCII character set natively. Code 39 uses only two element widths (wide and narrow), making it wider physically but far easier to print on low-resolution industrial dot-matrix or laser etching equipment.
Does Code 39 require a check digit?
No. Code 39 is inherently self-checking because an optical read error would have to alter both a wide and narrow element simultaneously. However, high-security applications (such as military MIL-STD-129 and healthcare) enforce an optional Modulo-43 check character.