Enter Barcode Data
Type your data and select a barcode format.
Preview
Enter data to generate a barcode
Customize Appearance
Adjust these settings — the preview updates instantly.
About Code 128
How to Generate a Barcode
Four simple steps to create your barcode.
Frequently Asked Questions
Common questions about barcodes and this generator.
What is the difference between Code 128 and Code 39?
How many digits does an EAN-13 barcode need?
Can I generate barcodes for free?
What barcode format should I use for my product?
What is the difference between UPC-A and EAN-13?
What is a Barcode?
A barcode is a machine-readable visual representation of data, consisting of parallel lines (bars) of varying widths and spacings. Invented by Norman Woodland and Bernard Silver in 1949 — inspired by Morse code extended into thin and thick bars — barcodes were first commercially used in 1974 when a pack of Wrigley's chewing gum was scanned at a supermarket in Troy, Ohio. Today, barcodes are scanned over 6 billion times per day worldwide across retail, logistics, healthcare, manufacturing, and library systems.
1D barcodes (linear barcodes) encode data in one dimension — horizontally along the width of the bars. A barcode scanner reads the pattern by sweeping a laser or LED across the bars and measuring the reflected light: dark bars absorb light, white spaces reflect it. The pattern is decoded into the original data. This is different from 2D barcodes (QR codes, Data Matrix) which encode data in both horizontal and vertical dimensions using squares or dots, capable of storing up to 7,089 numeric characters in a single symbol.
Supported Barcode Formats
| Format | Character Set | Length | Check Digit | Common Use |
|---|---|---|---|---|
| Code 128 | Full ASCII (0–127) | Variable | Auto-calculated (mod 103) | Logistics, shipping, inventory, healthcare |
| Code 128B | ASCII 32–127 | Variable | Auto-calculated (mod 103) | Text-heavy labels with symbols |
| Code 128C | Numeric pairs (00–99) | Even digits | Auto-calculated (mod 103) | Compact numeric data, shipping containers |
| Code 39 | A–Z, 0–9, -.$/+% and space | Variable | Optional (mod 43) | Defense (MIL-STD-1189), automotive, badges |
| EAN-13 | Numeric (0–9) | 12 digits | Auto-calculated (mod 10) | Retail products (global, GS1 standard) |
| EAN-8 | Numeric (0–9) | 7 digits | Auto-calculated (mod 10) | Small retail items with limited label space |
| UPC-A | Numeric (0–9) | 11 digits | Auto-calculated (mod 10) | Retail products (US/Canada, GS1 US) |
| ITF-14 | Numeric (0–9) | 13 digits | Auto-calculated (mod 10) | Carton/outer case labeling (GTIN-14) |
| Codabar | 0–9, -$:/.+ | Variable | No | Libraries, blood banks, photo labs |
1D Barcode vs 2D Barcode (QR Code)
1D barcodes (like those generated here) store data linearly — typically 20–25 characters in a horizontal row of bars. They require a laser scanner to read. 2D barcodes (QR codes, Data Matrix, PDF417) store data in a matrix of squares, encoding up to 4,296 alphanumeric characters or 7,089 digits in a small square, readable by any smartphone camera. While 2D codes are more data-dense, 1D barcodes remain the global standard for retail and logistics because they are faster to scan, work with decades of existing infrastructure, and are more tolerant of poor lighting and printing conditions. The choice depends on your use case: 1D for compatibility and speed, 2D for data capacity and smartphone readability.
How the EAN-13 Check Digit Works
The EAN-13 check digit (the 13th digit) is calculated using a modulo-10 weighted-sum algorithm. Starting from the rightmost digit (position 1), multiply every other digit by 3, and the remaining digits by 1. Sum all the products, find the remainder when divided by 10, and subtract from 10 (if the remainder is 0, the check digit is 0). For example, for the digits 5-9-0-1-2-3-4-1-2-3-4-5: (5×1) + (9×3) + (0×1) + (1×3) + (2×1) + (3×3) + (4×1) + (1×3) + (2×1) + (3×3) + (4×1) + (5×3) = 5+27+0+3+2+9+4+3+2+9+4+15 = 83. 83 mod 10 = 3. 10 − 3 = 7. So the check digit is 7, making the full EAN-13: 5-901234-123457. This algorithm catches all single-digit errors and most transposition errors (swapping two adjacent digits) — the two most common types of manual entry mistakes.
How to Use Barcodes Effectively
- Choose the right format: Use EAN-13 or UPC-A for products sold in stores. Use Code 128 for internal inventory, shipping labels, and asset tracking. Use ITF-14 for shipping cartons. Use Codabar for library books and blood bank labels where legacy system compatibility matters.
- Ensure adequate contrast: Black bars on a white background provide the best scan reliability. Avoid light-colored bars or dark backgrounds — scanners need at least 70% contrast difference between bars and spaces for reliable reading.
- Maintain quiet zones: Leave blank space (at least 10× the narrowest bar width) on both sides of the barcode. Scanners need these margins to detect where the barcode begins and ends. Insufficient quiet zones are one of the most common causes of scan failures.
- Test with real scanners: Always test printed barcodes with the actual scanner hardware that will be used in production before committing to a large print run. Different scanner models have different tolerances for bar width variation and contrast.
- Size appropriately: Too small, and scanners can't resolve individual bars. Too large, and it wastes label space. The recommended magnification factor for retail barcodes is 80–200% of the nominal size. Test at the intended scanning distance before finalizing.
The History of Barcode Technology
The concept of machine-readable product coding dates back to 1932, when Harvard business student Wallace Flint envisioned an automated grocery system using punched cards. The modern barcode was born in 1949 when Norman Woodland, a Drexel graduate student, drew Morse code dots and dashes in the sand and extended them vertically into lines. Working with Bernard Silver, Woodland filed US patent 2,612,994 in 1952 for "Classifying Apparatus and Method" — a bullseye-shaped barcode read by a 500-watt light bulb and photomultiplier tube. The linear barcode we know today emerged from the 1970s when IBM engineer George Laurer developed the Universal Product Code (UPC), scanning its first product — a 67-cent pack of Wrigley's Juicy Fruit gum — on June 26, 1974, at Marsh Supermarket in Troy, Ohio. That original pack of gum is now displayed at the Smithsonian National Museum of American History. By 2025, GS1 barcodes were scanned over 10 billion times daily across 150+ countries, making the barcode one of the most ubiquitous technologies ever invented.