How Generador de Código de Barras Works
Barcodes are optical, machine-readable representations of data, used globally to automate tracking and identification. This tool leverages the JsBarcode library to generate vector (SVG) and raster (PNG) barcodes directly in your browser.
Technical Specification & Encoding (Implementation)
Each barcode format follows a strict set of rules, often governed by ISO/IEC standards. For example, ISO/IEC 15417:2007 defines the specifications for Code 128.
The generation process involves three key steps:
- Data Encoding: The input string is converted into a series of binary sequences (bars and spaces) based on the selected symbology (e.g., EAN-13 uses a specific parity pattern for the first digit).
- Checksum Calculation: For formats like EAN and UPC, a modulo-10 check digit is calculated and appended to ensure scan reliability.
- Rendering: The binary pattern is drawn onto an HTML5 Canvas or SVG element, which is then serialized for download.
How It's Tested
We continuously validate the generator against industry-standard scanners and software to ensure reliable readability.
- The "Format Compliance" Check:
- Action: Generate an
EAN-13barcode with 12 digits. - Expected: The tool must automatically calculate and append the correct 13th check digit.
- Action: Generate an
- The "Symbology Switching" Test:
- Action: Switch from
Code 128(alphanumeric) toITF-14(numeric only) with invalid characters. - Expected: The tool must flag the invalid characters immediately.
- Action: Switch from
- The "Scan" Verification:
- Action: Generate a barcode and scan it with a physical laser scanner or mobile app (like scandit).
- Expected: The scanner must instantly decode the correct value.
- The "Download" Integrity:
- Action: Download the SVG and PNG versions.
- Expected: Both files must be valid, legible, and match the on-screen preview.
The History of Barcodes
The barcode was invented by Joseph Woodland and Bernard Silver in 1948. Their original design was inspired by Morse code extended vertically into thin and thick bars. According to the NIST Guide to Automatic Identification and Data Capture, although they received a patent in 1952, it wasn't until the development of the laser and affordable scanners in the 1970s that barcodes became a commercial reality. The first commercial barcode scan took place on June 26, 1974, at a Marsh Supermarket in Troy, Ohio, when a pack of Wrigley's Juicy Fruit chewing gum was scanned.
Common Barcode Formats
Understanding which format to use depends on your industry and the type of data you need to encode. Standardized formats are governed by the GS1 Global Barcode Standards.
| Format | Type | Capacity | Primary Use |
|---|---|---|---|
| Code 128 | 1D Alphanumeric | Variable | Modern shipping and logistics |
| EAN-13 | 1D Numeric | 13 digits | International retail products |
| UPC-A | 1D Numeric | 12 digits | North American retail |
| Code 39 | 1D Alphanumeric | Variable | Defense and automotive tracking |
| EAN-8 | 1D Numeric | 8 digits | Small retail items |
| ITF-14 | 1D Numeric | 14 digits | Wholesale and outer carton tracking |
Technical specifications and guides are available at the GS1 General Specifications and MDN Canvas API.