Code 39 explicado: el código de barras alfanumérico autoverificable
Technical reference for Code 39 — wide/narrow encoding, the self-checking property, Full ASCII extension, and military/automotive applications.
Code 39: The Self-Checking Alphanumeric Barcode
Code 39, also known as "Code 3 of 9," is one of the oldest and most widely used alphanumeric barcode symbologies. Defined by ISO/IEC 16388, it remains standard in US Department of Defense (LOGMARS), automotive (AIAG), and healthcare applications.
Encoding Principle
Code 39 uses a simple binary encoding: each character consists of 9 elements (5 bars and 4 spaces), of which 3 are wide and 6 are narrow. The name "3 of 9" comes from this encoding: 3 wide elements out of 9 total.
The wide-to-narrow ratio is typically 2.5:1 to 3:1. The inter-character gap (space between characters) must be at least 1X wide and is not data-bearing.
Character Set
The base Code 39 symbology can encode: numeric, alpha, or ASCII." data-category="Barcode Anatomy & Structure">character set contains 43 characters:
- Digits: 0-9
- Letters: A-Z (uppercase only)
- Special: - . $ / + % (space)
- Start/stop: * (asterisk)
The Self-Checking Property
Code 39 is called "self-checking" because a single print defect cannot transform one valid character into another. Each character's wide/narrow pattern is sufficiently different from all others that a single bar width error creates an invalid character, which the decoder rejects.
This property means a check digit is technically optional, though MIL-STD-130 and many other specifications mandate Modulo 43 check digits for added safety.
Full ASCII Extension
Code 39 Extended (Full ASCII) encodes all 128 ASCII characters by combining pairs of base characters. For example, lowercase "a" is encoded as "+A". This doubles the symbol width for extended characters but provides full ASCII support without changing the symbology structure.
Applications
- US Military (LOGMARS/MIL-STD-130): Required for all government property marking
- Automotive (AIAG B-1): Part labeling throughout the supply chain
- Healthcare (GS1 in hospitals." data-category="Healthcare & Pharmaceutical">HIBC): The Health Industry Bar Code standard builds on Code 39
- Internal asset tracking: Libraries, equipment management, document routing
Code 39 vs Code 128
Code 39 is less dense than Code 128 because it uses wider bars and inter-character gaps. A 10-character Code 39 barcode is roughly 40% wider than the equivalent Code 128. For new implementations, Code 128 is generally preferred for its higher density and full ASCII support without paired encoding.
However, Code 39's self-checking property and long industry adoption keep it relevant where changing symbologies would require costly infrastructure upgrades.
Implementation Notes
- Always include the asterisk (*) start and stop characters
- Do not encode the asterisk in the human-readable text
- Use a minimum X dimension of 0.19mm (7.5 mil) for general use
- Quiet zones must be at least 10X on each side, ideally 6.4mm minimum