Codificación de caracteres en códigos de barras: numérico, alfanumérico y binario
How barcodes translate characters into patterns of bars and spaces, covering numeric-only, alphanumeric, and full ASCII/binary encoding modes.
Character Encoding in Barcodes
Barcodes represent data by mapping characters to patterns of bars and spaces (1D) or dark and light cells (2D). The encoding method determines what characters a barcode can carry, how efficiently it stores them, and the resulting symbol size.
Numeric-Only Encoding
The simplest and most compact encoding handles digits 0-9 only. EAN-13 and UPC-A encode exactly 12 or 13 numeric digits. Code 128 Code Set C encodes digit pairs, achieving double density for numeric data: two digits per symbol character.
Interleaved 2 of 5 (ITF) also pairs digits, making it efficient for numeric data on outer shipping cases.
Alphanumeric Encoding
When you need letters as well as numbers, symbologies like Code 39 provide uppercase A-Z, digits 0-9, and a handful of special characters (-, ., $, /, +, %, space). Code 39 is Symbology property ensuring single print errors are detectable." data-category="Barcode Anatomy & Structure">self-checking, meaning it does not strictly require a check digit, though adding one improves reliability.
Code 128 Code Sets A and B cover the full ASCII character set (0-127), including lowercase letters, punctuation, and control characters. Code Set A focuses on control characters and uppercase, while Code Set B handles uppercase and lowercase.
Full ASCII and Binary
For data beyond basic ASCII, 2D symbologies shine. Data Matrix supports the full Extended ASCII set (0-255) and can encode raw binary data up to 1,556 bytes. PDF417 offers text, byte, and numeric compaction modes, switching automatically for optimal density.
Encoding Modes and Compaction
Many symbologies switch between encoding modes to minimize symbol size:
- Code 128 switches between Code Sets A, B, and C using shift and latch characters
- Data Matrix uses C40 (uppercase-optimized), Text (lowercase-optimized), Base 256 (binary), and EDIFACT modes
- PDF417 uses Text, Byte, and Numeric compaction modes
GS1 Application Identifier Encoding
In supply chain barcodes, data elements like batch numbers, expiry dates, and serial numbers are prefixed with Application Identifiers (AIs). The AI tells the receiving system how to interpret the following data. GS1-128 uses a special GS1-formatted data in barcodes." data-category="GS1 Standards & Identifiers">FNC1 character after the start code to signal GS1 format, and as a separator between variable-length fields.
Choosing the Right Encoding
Match your encoding to your data:
- Digits only (product numbers, GTINs): Use EAN-13, UPC-A, or ITF-14
- Alphanumeric (serial numbers, part codes): Use Code 128 or Code 39
- Structured data (batch + expiry + serial): Use GS1-128 or GS1 DataMatrix
- Binary/large data (images, certificates): Use Data Matrix or PDF417