Walk into any supermarket, pharmacy, or warehouse and you will see them everywhere: small strips of black and white lines on every product. That humble barcode is one of the inventions that most profoundly transformed modern commerce. Without it, logistics, inventory management, and retail as we know it simply would not function.
But what is actually behind those lines? And more importantly, can you create your own barcodes? The answer is yes, and it is far simpler than you might think.
What Is a Barcode?
A barcode is an optical representation of data. It converts information — a product number, an identifier, a text string — into a series of vertical lines of varying width and spacing that a machine can read.
The principle is straightforward: dark bars absorb light and light bars reflect it. A barcode scanner — whether laser, CCD, or image-based — detects these reflectance patterns and translates them back into data.
Barcodes come in two broad families:
- Linear (one-dimensional): The classic ones you see on products. Data is encoded in a single horizontal dimension.
- Two-dimensional (2D): Such as QR codes or Data Matrix. They store data both horizontally and vertically, allowing much more information to be held.
Types of Barcodes
There are dozens of formats, each designed for a specific purpose:
| Format | Data type | Primary use case |
|---|---|---|
| Code 39 | Alphanumeric (43 characters) | Logistics, healthcare, military |
| Code 128 | Full alphanumeric (128 characters) | Shipping, industrial labeling |
| EAN-13 | Numeric (13 digits) | Retail products (international) |
| UPC-A | Numeric (12 digits) | Products in the US and Canada |
| QR Code | Binary (up to 4,296 characters) | URLs, payments, detailed information |
Each format has its own encoding rules, data lengths, and error correction levels. Choosing the right one depends on where it will be used and what information it needs to contain.
Code 39 in Detail
Code 39 deserves special attention because it is one of the most versatile and widely adopted formats. Its key characteristics:
- 43 encodable characters: The full uppercase alphabet (A-Z), ten digits (0-9), and seven symbols: hyphen (-), period (.), space, dollar sign ($), slash (/), plus (+), and percent (%).
- Self-checking: Each character has a unique pattern that the scanner can validate without requiring an additional check digit (though one can be optionally added).
- Start and stop characters: Every Code 39 barcode begins and ends with an asterisk (*), which acts as a delimiter but is not part of the data.
- Widespread industrial use: It is the standard in logistics, healthcare (patient and medication labels), military (MIL-STD-1189), and corporate asset identification.
Code 39 is so flexible it can encode any combination of letters and numbers you need, with no length restrictions beyond the physical capacity of the printed code.
How Is a Barcode Read?
A barcode scanner works by projecting a beam of light — either a laser or a CCD source — onto the surface of the code. Dark bars absorb the light and light bars reflect it. A photodetector captures the reflection patterns and converts them into an electrical signal.
This signal is interpreted according to the rules of the specific format (Code 39, Code 128, etc.) and translated back into the original data. The entire process takes milliseconds, making it possible to scan products at high speed on cash registers and in distribution centers.
Modern readers, including those on smartphones, use image cameras and processing algorithms to decode barcodes without specialized hardware.
Generating Your Own Barcode
Creating a custom barcode is a quick process:
- Enter the text you want to encode. For Code 39, use uppercase letters, numbers, and basic symbols.
- Generate the code with the tool, which will automatically add the start and stop characters.
- Download the image in high-quality PNG format.
- Print at 300 DPI or higher with sufficient white margins so scanners can read it correctly.
Professional tip: Always test the printed barcode by scanning it with at least two different devices before distributing it widely.
Conclusion
Barcodes are the backbone of modern commerce and logistics. Understanding how they work and being able to generate your own gives you the independence to label products, organize inventory, or create your own identification systems. The Code 39 format is an excellent starting point due to its versatility and universal compatibility.