Code 39 Barcode: Complete Guide to the Original Alphanumeric Standard
Learn about Code 39 barcodes, the first alphanumeric symbology widely adopted in automotive, defense, and healthcare industries. Covers encoding, specifications, and implementation.
Before QR codes, before Data Matrix, before Code 128 — there was Code 39. Developed in 1974, it was the first barcode symbology capable of encoding both letters and numbers. That capability made it the foundation of industrial barcode systems worldwide, and it remains embedded in automotive manufacturing, military logistics, and healthcare operations today.
What is Code 39?
Code 39 (also called Code 3 of 9) is a linear barcode symbology that encodes uppercase letters, numbers, and a handful of special characters. The name "3 of 9" describes its structure: each character is represented by 9 elements (5 bars and 4 spaces), where exactly 3 of those elements are wide and the rest are narrow.
Developed by David Allais and Ray Stevens at Intermec, Code 39 solved a fundamental problem of its era. Existing barcodes like UPC could only encode numbers. Industries needed to track parts, shipments, and assets using alphanumeric identifiers. Code 39 delivered that capability with a straightforward encoding scheme that was easy to print and scan with the technology available in the 1970s.
The symbology quickly gained adoption across non-retail industries. The U.S. Department of Defense adopted it for military logistics. The Automotive Industry Action Group (AIAG) made it standard for parts tracking. Healthcare institutions used it for patient identification. These early adoptions created an installed base that persists across millions of scanning systems.
Character Set and Encoding
Code 39's standard character set includes 43 characters:
- Digits 0 through 9
- Uppercase letters A through Z
- Seven special characters: space, dash (-), period (.), dollar sign ($), forward slash (/), plus (+), and percent (%)
Each character is encoded as a pattern of 5 bars and 4 spaces. Three of these 9 elements are wide (approximately 2-3 times the width of narrow elements), and six are narrow. This wide/narrow encoding is what makes Code 39 straightforward to print and scan — there's no need for precise width ratios, just a clear distinction between wide and narrow.
A mandatory start and stop character (the asterisk *) frames each barcode. The asterisk is encoded using its own unique bar pattern and tells the scanner where the data begins and ends. The asterisk cannot appear within the data itself.
An inter-character gap separates each encoded character. This narrow space (typically one narrow element width) provides visual separation that helps scanners distinguish one character from the next.
Extended Code 39 (Full ASCII)
Standard Code 39 lacks lowercase letters, control characters, and many symbols. Extended Code 39 addresses this by encoding the full 128-character ASCII set using pairs of standard Code 39 characters.
For example, lowercase "a" is encoded as "+A", lowercase "b" as "+B", and so on. Control characters use dollar sign ($) pairs: Ctrl-A is "$A", Ctrl-B is "$B". This pairing doubles the barcode length for extended characters but maintains backward compatibility — any standard Code 39 scanner reads the paired characters, though the host system must interpret the pairs as their ASCII equivalents.
Extended Code 39 is useful when you need lowercase text or special characters but can't switch to Code 128, which encodes full ASCII natively.
Technical Specifications
Wide-to-Narrow Ratio: The ratio between wide and narrow elements must be consistent throughout the barcode. Ratios from 2.0:1 to 3.0:1 are acceptable, with 2.5:1 being common. Higher ratios improve reading reliability but increase barcode length.
X-Dimension (Narrow Element Width): The minimum recommended X-dimension is 0.19mm (7.5 mil) for general applications. High-density printing can go as low as 0.10mm (4 mil), but this requires high-quality printing and precision scanners. Industrial applications typically use 0.25mm to 0.50mm for robust scanning.
Barcode Length: Each character occupies 13 to 16 modules depending on the wide-to-narrow ratio, plus a 1-module inter-character gap. A Code 39 barcode is significantly wider than equivalent Code 128 encoding — roughly 60% wider for the same data. This density penalty is the primary reason newer symbologies replaced Code 39 in space-constrained applications.
Quiet Zones: A minimum of 10 narrow element widths (10X) is required before the start character and after the stop character. Insufficient quiet zones are the most common cause of scanning failures.
Height: The barcode height should be at least 5mm or 15% of the barcode length, whichever is greater. Taller barcodes scan more reliably because the scanner laser has more surface area to sweep across.
Self-Checking Property
Code 39 is a self-checking symbology. This means that a single printing defect — a bar too wide, a space too narrow — cannot cause one character to be misread as another valid character. The mathematical distance between character patterns is large enough that corruption of one element produces an invalid (undecodable) pattern rather than a wrong character.
This self-checking property means Code 39 can operate without a check digit for many applications. A damaged barcode will fail to scan rather than return incorrect data. This built-in safety was a significant advantage when Code 39 was designed, as check digit calculation added complexity to early barcode systems.
For higher security, an optional modulo 43 check digit can be appended. The check digit is calculated by summing the values of all data characters (each assigned a value from 0 to 42), dividing by 43, and using the remainder to select the check character. Some industries, including the U.S. Department of Defense, mandate this check digit.
Industry Applications
Automotive Manufacturing
The AIAG adopted Code 39 as the standard for parts identification in the North American automotive supply chain. Parts labels, shipping containers, and work-in-process tracking all use Code 39 barcodes containing part numbers, supplier codes, and serial numbers.
This standard persists because the automotive industry's scanning infrastructure was built around Code 39. Millions of installed scanners, label printers, and software systems expect Code 39 formatting. Migrating to newer symbologies would require coordinated changes across thousands of suppliers and assembly plants.
Defense and Government
The U.S. Department of Defense uses Code 39 under MIL-STD-129 and MIL-STD-130 for marking military shipments and equipment. NATO adopted similar standards, making Code 39 the common language for military logistics across allied nations.
Military applications encode identification numbers, national stock numbers (NSNs), contract numbers, and serial numbers. The barcode's tolerance for rough handling and harsh environments suits military supply chain conditions.
Healthcare
Hospital patient wristbands, specimen labels, and medication tracking systems frequently use Code 39. The Health Industry Business Communications Council (HIBCC) defined a labeling standard built on Code 39 that encodes product identifiers, lot numbers, and expiration dates.
While GS1 Data Matrix is replacing Code 39 for pharmaceutical unit-dose packaging, Code 39 remains common on patient identification bands and laboratory specimens where alphanumeric IDs must be human-readable alongside the barcode.
Library Systems
Many library barcode systems use Code 39 for patron cards and book labels. The simple alphanumeric encoding handles library card numbers and catalog identifiers effectively, and the barcodes are durable enough for items handled frequently.
Code 39 vs. Code 128
The most common question about Code 39 is whether to use it or Code 128. The answer depends on your constraints.
| Feature | Code 39 | Code 128 |
|---|---|---|
| Character set | A-Z, 0-9, 7 symbols | Full ASCII (128 characters) |
| Density | Lower (wider barcodes) | Higher (more compact) |
| Check digit | Optional (modulo 43) | Mandatory (modulo 103) |
| Self-checking | Yes | No (relies on check digit) |
| Numeric efficiency | Same as alphanumeric | Double density for numbers |
| Industry adoption | Automotive, defense, healthcare | Logistics, shipping, general |
Choose Code 39 when your industry standards require it, when you only need uppercase alphanumeric encoding, or when scanning infrastructure already supports it. Choose Code 128 when space is limited, you need lowercase or special characters, or you're building a new system without legacy constraints.
Implementation Best Practices
Use the Standard Character Set: Stick to uppercase letters, digits, and the seven special characters unless you specifically need Extended Code 39. The paired encoding of Full ASCII doubles barcode width for extended characters and requires host system decoding support.
Set Appropriate Density: Match the X-dimension to your printing technology and scanning distance. Industrial label printers produce reliable barcodes at 0.25mm X-dimension. Desktop printers may need 0.38mm or larger. Warehouse scanners reading at distance need larger X-dimensions than hand-held scanners used at close range.
Include the Check Digit When Required: If your industry standard mandates modulo 43 check digits, always include them. Even when optional, adding the check digit provides an extra layer of data integrity for critical applications.
Verify Print Quality: Use a barcode verifier compliant with ISO/IEC 15416 to grade your barcodes. A minimum grade of C (2.0) is recommended for most applications. Grade D (1.0) barcodes may scan but are unreliable in production environments.
Test Scanner Compatibility: Before deploying, test your Code 39 barcodes with every scanner model in your environment. While Code 39 enjoys near-universal support, scanner configuration settings (minimum length, check digit validation, Full ASCII interpretation) can cause unexpected behavior.
When you generate Code 39 barcodes, ensure the output meets your industry's specific requirements for X-dimension, height, and check digit inclusion.
Limitations and When to Choose Alternatives
Code 39's primary limitation is density. A 10-character Code 39 barcode is roughly 60% wider than the same data in Code 128. For labels with limited horizontal space, this difference matters.
The uppercase-only standard character set restricts applications needing mixed-case data. Extended Code 39 works around this but at a steep space penalty.
Code 39 also lacks built-in data structuring. Formats like GS1-128 encode structured data with Application Identifiers that systems can parse automatically. Code 39 carries raw alphanumeric strings that require the host system to know the data format in advance.
For new system designs without legacy constraints, Code 128 is the default choice for linear barcode applications. For 2D requirements, Data Matrix or QR codes offer dramatically higher capacity in less space.
But if your supply chain partners, industry standards, or existing infrastructure specify Code 39, it remains a solid, reliable, and universally supported symbology.