Complete technical reference for Code 39 barcode symbology, encoding structure, character set, and Full ASCII mode.
Code 39 (also known as Alpha39, Code 3 of 9, Code 3/9, Type 39, USS Code 39, or USD-3) is a variable-length, discrete barcode symbology that was the first specification allowing encoding of both alphabetic and numeric characters. Developed in 1974 by Dr. David Allais and Ray Stevens of Intermec Corporation, it revolutionized barcode technology by expanding beyond numeric-only limitations.
Code 39 was developed to address several key needs:
Today, Code 39 remains one of the most widely used barcode symbologies, particularly in:
Every Code 39 barcode follows a precise structure with defined quiet zones, start/stop characters, and data characters. Understanding this structure is essential for proper implementation and scanning.
The quiet zone (or clear area) is the blank space on either side of the barcode. For Code 39, the minimum quiet zone width is 10 times the narrow element width (10x). This space ensures reliable reading by providing a clear boundary for the scanner.
Code 39 uses the asterisk (*) character as both the start and stop delimiter. This same character pattern marks both the beginning and end of the barcode, which is why the asterisk cannot be used in the data portion of the barcode.
The data section contains the actual information being encoded. Each character is separated by a narrow inter-character gap (space), which is critical for proper decoding. Code 39 supports variable length data, typically ranging from 1 to 20-23 characters in practical applications.
Unlike Code 128, the check digit in Code 39 is optional. When used, it's calculated using the Modulo 43 algorithm and placed immediately before the stop character. This is often referred to as "Code 39 Mod 43."
| Parameter | Specification | Notes |
|---|---|---|
| Narrow Element (X) | Application-dependent minimum | Base unit for all measurements |
| Wide/Narrow Ratio | 2.0 to 3.0 (2.5 recommended) | Ratio between wide and narrow elements |
| Quiet Zone | Minimum 10x | Clear space on each side |
| Bar Height | Min 5.0mm or 15% of width | Whichever is greater |
| Inter-character Gap | 1x (narrow element width) | Space between characters |
Code 39 supports a set of 43 characters plus the start/stop asterisk. Each character is encoded using a unique pattern of 9 elements (5 bars and 4 spaces), where 3 elements are wide and 6 are narrow. This "3 of 9" pattern is the origin of the alternate name "Code 3 of 9."
Characters:
0 1 2 3 4 5 6 7 8 9
Values: 0-9
Best for: Serial numbers, quantities, dates
Characters:
A B C D E F G H I J K L M
N O P Q R S T U V W X Y Z
Values: 10-35
Best for: Part numbers, identifiers, names
Characters:
- . $ / + % [SPACE]
Values: 36-42
Best for: Separators, currency, formatting
| Character | Value | Character | Value | Character | Value |
|---|---|---|---|---|---|
0 | 0 | F | 15 | V | 31 |
1 | 1 | G | 16 | W | 32 |
2 | 2 | H | 17 | X | 33 |
3 | 3 | I | 18 | Y | 34 |
4 | 4 | J | 19 | Z | 35 |
5 | 5 | K | 20 | - | 36 |
6 | 6 | L | 21 | . | 37 |
7 | 7 | M | 22 | SPACE | 38 |
8 | 8 | N | 23 | $ | 39 |
9 | 9 | O | 24 | / | 40 |
A | 10 | P | 25 | + | 41 |
B | 11 | Q | 26 | % | 42 |
C | 12 | R | 27 | * | Start/Stop only |
D | 13 | S | 28 | ||
E | 14 | T | 29 | ||
U | 30 |
Each Code 39 character consists of exactly 9 elements: 5 bars and 4 spaces. Of these 9 elements, exactly 3 are wide (binary 1) and 6 are narrow (binary 0). This consistent "3 of 9" pattern enables self-checking capability.
Bar patterns are typically documented using the notation where:
Elements alternate between bars and spaces, always starting with a bar. So a pattern like
wnnwnnnnw means: wide bar, narrow space, narrow bar, wide space, narrow bar,
narrow space, narrow bar, narrow space, wide bar.
| Character | Pattern (nnnnnnnnn) | Description |
|---|---|---|
* (Start/Stop) |
nwnnwnwnn |
Wide at positions 2, 5, 7 |
0 |
nnnwwnwnn |
Wide at positions 4, 5, 7 |
1 |
wnnwnnnnw |
Wide at positions 1, 4, 9 |
A |
wnnnnwnnnw |
Wide at positions 1, 6, 9 |
- |
nwnnnnwnw |
Wide at positions 2, 7, 9 |
Between each character (including start/stop characters), there must be a narrow inter-character gap. This gap is typically the same width as a narrow element. Without these gaps, the barcode cannot be decoded properly.
To encode the text HELLO, the full barcode structure would be:
While Code 39's self-checking property provides basic error detection, an optional Modulo 43 check digit can be added for enhanced data integrity. When used, this creates "Code 39 Mod 43."
Calculate the check digit for CODE39:
When a scanner reads a Code 39 Mod 43 barcode:
Standard Code 39 is limited to 43 characters. Extended Code 39 (also called Full ASCII Code 39) expands this to all 128 ASCII characters by using two-character combinations from the base character set.
Extended Code 39 uses four special prefix characters ($, /,
+, %) followed by a letter to encode additional characters:
| Prefix | Combined With | Encodes | Example |
|---|---|---|---|
+ |
A-Z | Lowercase a-z | +A = "a", +Z = "z" |
$ |
A-Z | Control characters (ASCII 0-26) | $I = TAB, $M = CR |
/ |
A-O | Special punctuation | /A = "!", /E = "%" |
% |
A-Z, 0-9 | Additional special characters | %A = ESC, %F = ";" |
Code 39 has been adopted as the foundation for several important industry standards, each adapting the base symbology for specific requirements.
Logistics Applications of Automated Marking and Reading Symbols is the U.S. Department of Defense standard for barcode marking. It uses Code 39 as its symbology.
The Health Industry Bar Code standard uses Code 39 (and Code 128) for labeling healthcare products, medical devices, and pharmaceuticals.
The Automotive Industry Action Group uses Code 39 for parts labeling and supply chain tracking in the automotive industry.
| Standard | Title | Description |
|---|---|---|
| ISO/IEC 16388:2023 | Code 39 Symbology Specification | Current international standard for Code 39 |
| ANSI/AIM BC1/1995 | Uniform Symbology Specification - Code 39 | U.S. industry standard |
Choose Code 39 when you need:
Consider alternatives when:
Code 39 enjoys universal scanner support:
Code 39 and Code 128 are both popular linear barcodes. Understanding their differences helps you choose the right symbology for your application.
| Feature | Code 39 | Code 128 |
|---|---|---|
| Year Developed | 1974 | 1981 |
| Data Density | Lower (wider barcodes) | Higher (50% more compact) |
| Character Set | 43 characters (128 with Extended) | Full 128 ASCII |
| Check Digit | Optional (Mod 43) | Mandatory (Mod 103) |
| Self-Checking | Yes | No |
| Elements per Character | 9 (5 bars, 4 spaces) | 11 (3 bars, 3 spaces) |
| Implementation | Simpler | More complex |
| Best For | Industrial, military, healthcare | Shipping, retail, logistics |