The Complete Guide to Barcodes
What Is a Barcode?
A barcode is a visual, machine-readable representation of data. The data is encoded in the widths and spacings of parallel lines (one-dimensional or linear barcodes). When scanned by a laser or camera-based reader, the pattern of bars and spaces is decoded back into the original data — typically a number, text string, or product identifier.
The modern barcode was patented in 1952 by Norman Joseph Woodland and Bernard Silver, inspired by Morse code. However, it wasn't until 1974 that the first UPC barcode was scanned at a supermarket checkout in Troy, Ohio. Today, over 5 billion barcodes are scanned every day worldwide across retail, healthcare, transportation, and manufacturing industries.
Barcode Formats Explained
Different barcode formats (also called symbologies) are designed for different use cases. This tool supports four of the most widely used linear barcode formats:
| Format | Characters | Length | Primary Use |
|---|---|---|---|
| CODE128 | Full ASCII (128 chars) | Variable | Shipping labels, logistics, general purpose |
| CODE39 | 0-9, A-Z, - . $ / + % | Variable | Military, automotive, government IDs |
| EAN-13 | Digits only | 13 digits | International retail products |
| UPC-A | Digits only | 12 digits | North American retail products |
How Barcodes Work
A barcode scanner emits a beam of light (laser or LED) across the barcode. The dark bars absorb light while the white spaces reflect it. A photosensitive detector inside the scanner converts these light-and-dark patterns into electrical signals, which are then decoded into the original data. Key structural elements include:
📏 Quiet Zones
Blank margins on each side of the barcode that tell the scanner where the code begins and ends. Typically 10 times the narrowest bar width.
🔲 Start/Stop Characters
Special patterns at the beginning and end that identify the barcode symbology and reading direction.
📊 Data Characters
The actual encoded information — each character is represented by a specific pattern of bars and spaces of varying widths.
✅ Check Digit
A calculated digit appended to the data for error detection. EAN-13 and UPC barcodes always include a check digit to verify scan accuracy.
When to Use Each Format
CODE128 — The All-Rounder
CODE128 is the most versatile barcode format. It supports the full ASCII character set (letters, numbers, and symbols) and produces compact barcodes. Use it for shipping labels (GS1-128), inventory management, order tracking, and any application requiring alphanumeric data. It's the default choice when no specific standard is required.
CODE39 — Simple & Self-Checking
CODE39 is one of the oldest barcode formats, widely used by the U.S. Department of Defense (MIL-STD-1189) and the automotive industry (AIAG). It supports uppercase letters, digits, and a few special characters. Its self-checking design means it doesn't require a check digit, making it simple to implement but producing wider barcodes than CODE128.
EAN-13 — International Retail Standard
EAN-13 (European Article Number) is the global standard for product identification. It encodes a 13-digit number that includes a country code, manufacturer code, product code, and check digit. Required for selling products in most countries outside North America. You need a GS1 company prefix to generate valid retail EAN-13 codes.
UPC-A — North American Retail
UPC-A (Universal Product Code) is the standard barcode for retail products in the United States and Canada. It encodes a 12-digit number. UPC-A is actually a subset of EAN-13 — any UPC-A code can be represented as an EAN-13 by prepending a zero. Like EAN-13, valid retail UPC codes require a GS1 company prefix.
Barcode vs. QR Code
| Feature | Barcode (1D) | QR Code (2D) |
|---|---|---|
| Data Capacity | Up to ~25 characters | Up to 7,089 characters |
| Data Types | Numbers, text (limited) | URLs, text, vCards, Wi-Fi, etc. |
| Scan Direction | Horizontal only | Any angle (360°) |
| Error Correction | Check digit only | Reed-Solomon (7-30%) |
| Best For | Retail POS, inventory | Marketing, mobile apps |
Need to encode more data like URLs, vCards, or Wi-Fi credentials? Try our QR Code Generator for 2D codes with higher data capacity and built-in error correction.
Best Practices for Printing Barcodes
✅ Do
- • Use black bars on a white background for maximum contrast
- • Maintain adequate quiet zones on both sides
- • Print at 300 DPI or higher for best quality
- • Test with a barcode scanner before mass printing
- • Use SVG format for scalable, print-ready output
- • Place barcodes on flat, non-curved surfaces
❌ Don't
- • Use low-contrast or similar colored bars and background
- • Print barcodes smaller than the minimum size for the symbology
- • Truncate bar height too much (reduces scan reliability)
- • Place barcodes on reflective or textured surfaces
- • Stretch or compress the barcode unevenly
- • Print over seams, folds, or perforations