Code 39 Format Specification

Complete technical reference for Code 39 barcode symbology, encoding structure, character set, and Full ASCII mode.

πŸ“š Introduction & History

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.

Origin of the Name: The original design included two wide bars and one wide space in each character, creating 40 possible character patterns. Setting aside one pattern as a start/stop delimiter left exactly 39 characters available for encoding data, hence the name "Code 39."

Why Code 39 Matters

Code 39 was developed to address several key needs:

  • Alphanumeric encoding - First barcode to support letters, not just numbers
  • Self-checking capability - Single character errors are naturally detectable
  • Variable length - No fixed data length requirements
  • Easy implementation - Simple encoding without mandatory checksum calculation
  • Wide scanner compatibility - Readable by virtually all barcode scanners

Key Milestones

  • 1974 - Developed by Intermec Corporation
  • 1983 - Standardized as ANSI MH 10.8 M-1983
  • 1984 - Adopted by U.S. Department of Defense as MIL-STD-1189
  • 1995 - Updated to ANSI/AIM BC1/1995
  • Current - Defined in ISO/IEC 16388:2023

Modern Usage

Today, Code 39 remains one of the most widely used barcode symbologies, particularly in:

πŸŽ–οΈ Military (LOGMARS)
πŸš— Automotive (AIAG)
πŸ₯ Healthcare (HIBC)
🏭 Manufacturing
πŸ“Š Inventory Management
🏷️ Asset Tracking

πŸ—οΈ Barcode Structure

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.

Complete Code 39 Symbol Structure

QUIET ZONE
Minimum 10x
(narrow bar width)
β†’
START *
Asterisk character
(fixed pattern)
β†’
DATA
Encoded Content
(Variable Length)
β†’
CHECK
Mod 43
(Optional)
β†’
STOP *
Asterisk character
(fixed pattern)
β†’
QUIET ZONE
Minimum 10x
(narrow bar width)

Component Details

1. Quiet Zones

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.

2. Start and Stop Characters

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.

3. Data Characters

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.

4. Check Character (Optional)

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."

Dimension Specifications

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

πŸ”€ Character Set & Encoding

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."

NUMERALS

Digits 0-9

Characters:

0 1 2 3 4 5 6 7 8 9

Values: 0-9

Best for: Serial numbers, quantities, dates

LETTERS

Uppercase A-Z

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

SPECIAL

Special Characters

Characters:

- . $ / + % [SPACE]

Values: 36-42

Best for: Separators, currency, formatting

Complete Character Value Table

Character Value Character Value Character Value
00 F15 V31
11 G16 W32
22 H17 X33
33 I18 Y34
44 J19 Z35
55 K20 -36
66 L21 .37
77 M22 SPACE38
88 N23 $39
99 O24 /40
A10 P25 +41
B11 Q26 %42
C12 R27 *Start/Stop only
D13 S28
E14 T29
U30

βš™οΈ Encoding Pattern

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.

Pattern Notation

Bar patterns are typically documented using the notation where:

  • n = narrow element (bar or space)
  • w = wide element (bar or space)

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.

Example Character Patterns

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

Inter-Character Gap

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.

Self-Checking Property: Code 39's "3 of 9" pattern provides inherent error detection. If any single element is misread (wide interpreted as narrow or vice versa), the resulting pattern cannot match any valid character because the total number of wide elements would be wrong.

Encoding Example

To encode the text HELLO, the full barcode structure would be:

# Complete barcode structure for "HELLO": [Quiet Zone] [*] [gap] [H] [gap] [E] [gap] [L] [gap] [L] [gap] [O] [gap] [*] [Quiet Zone] # Breakdown: * = Start character (nwnnwnwnn) H = Value 17 (nnwnnwnwn) E = Value 14 (wnnnnwnnw) L = Value 21 (nwnnnwnnw) L = Value 21 (nwnnnwnnw) O = Value 24 (nnnwwnnnw) * = Stop character (nwnnwnwnn) # Each character is 9 elements wide # Plus 1 narrow gap between each = 7 total gaps # Total: (7 Γ— 9) + (6 Γ— 1) = 69 narrow units + quiet zones

βœ“ Checksum Calculation (Mod 43)

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."

Calculation Algorithm

  1. Look up the numeric value for each character in the data (see table above)
  2. Sum all the character values together
  3. Divide the sum by 43
  4. The remainder is the check digit value
  5. Convert the remainder back to its corresponding character
  6. Append this character before the stop code
Formula: Check Character = Sum of all character values MOD 43

Worked Example

Calculate the check digit for CODE39:

# Step 1: Look up character values C = 12 O = 24 D = 13 E = 14 3 = 3 9 = 9 # Step 2: Sum all values Sum = 12 + 24 + 13 + 14 + 3 + 9 Sum = 75 # Step 3: Divide by 43 75 Γ· 43 = 1 remainder 32 # Step 4: Find character for value 32 Value 32 = "W" # Final barcode data: *CODE39W*

Validation Process

When a scanner reads a Code 39 Mod 43 barcode:

  1. Decode all characters including the check character
  2. Recalculate the expected check character from the data
  3. Compare calculated value with the encoded check character
  4. Accept only if they match
Scanner Configuration Required: For Code 39 Mod 43 validation to work, the barcode scanner must be configured to expect and verify the check digit. Otherwise, it will simply return the check character as part of the data.

πŸ”‘ Full ASCII Mode (Extended Code 39)

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.

How It Works

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 = ";"

Examples

# Encoding lowercase "hello" in Extended Code 39: h = +H e = +E l = +L l = +L o = +O # Full barcode data: *+H+E+L+L+O* # Encoding with control characters: "Tab→Value" would be encoded as: *T$IA$IB$IV$IA$IL$IU$IE* # Where $I represents the TAB character
Scanner Configuration: For Extended Code 39 to be decoded properly, the scanner must be programmed to interpret it. Otherwise, the scanner will return the raw two-character sequences (e.g., "+H" instead of "h").

Considerations

  • Increased Length: Each extended character requires two barcode characters, doubling the barcode length for lowercase text
  • Compatibility: Not all scanners support Extended Code 39 mode
  • Alternative: Code 128 natively supports full ASCII with better density

πŸ“‹ Industry Standards

Code 39 has been adopted as the foundation for several important industry standards, each adapting the base symbology for specific requirements.

LOGMARS (U.S. Military)

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.

  • Standard: MIL-STD-1189B (now ANSI/AIM BC1/1995)
  • Related: MIL-STD-129, MIL-STD-2073-1C
  • Use: Military supply chain, shipping containers, equipment tracking

HIBC (Healthcare)

The Health Industry Bar Code standard uses Code 39 (and Code 128) for labeling healthcare products, medical devices, and pharmaceuticals.

  • Organization: Health Industry Business Communications Council
  • Features: Includes special data identifiers for product/manufacturer info
  • Use: Medical devices, pharmaceuticals, patient identification

AIAG (Automotive)

The Automotive Industry Action Group uses Code 39 for parts labeling and supply chain tracking in the automotive industry.

  • Standard: AIAG B-1 through B-10 label standards
  • Use: Parts containers, shipping labels, inventory management

ISO/IEC Standards

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

πŸš€ Applications & Use Cases

Common Applications

🏭 Manufacturing Floor Tracking
πŸ“¦ Warehouse Inventory
πŸŽ–οΈ Military Logistics (LOGMARS)
πŸ₯ Healthcare Labels (HIBC)
πŸš— Automotive Parts (AIAG)
🏷️ Employee ID Badges
πŸ“‹ Work Order Tracking
πŸ“Š Asset Management

When to Use Code 39

Choose Code 39 when you need:

  • Alphanumeric encoding (letters and numbers)
  • Wide scanner compatibility
  • Simple implementation without checksum requirements
  • Compliance with LOGMARS, HIBC, or AIAG standards
  • Variable length data encoding
  • Interoperability with legacy systems

Consider alternatives when:

  • Space is limited - Code 128 offers 50% better density
  • Full ASCII required - Code 128 supports it natively
  • High data capacity needed - Use QR Code or Data Matrix
  • GS1 compliance required - Use GS1-128

Scanner Compatibility

Code 39 enjoys universal scanner support:

  • βœ… Laser scanners (all types)
  • βœ… CCD scanners
  • βœ… Linear imagers
  • βœ… 2D imagers
  • βœ… Mobile phone cameras
  • βœ… Fixed industrial scanners

βš–οΈ Code 39 vs Code 128

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

βœ… Code 39 Advantages

  • Simpler implementation
  • No mandatory checksum
  • Self-checking property
  • Universal scanner support
  • Industry standard (LOGMARS, HIBC)

❌ Code 39 Limitations

  • Lower data density
  • Larger barcode size
  • Limited native character set
  • Extended ASCII requires 2x space
  • Not suitable for small items

πŸ“– Related Documentation

πŸ“‹ See Also:

External Resources

Tools