What a Barcode Actually Is
A barcode is a visual encoding of data. The narrow and wide bars, the gaps between them, the squares of a 2D barcode, they all translate to numbers or characters a computer understands. The first commercial barcode was scanned in 1974 in an Ohio supermarket on a pack of Wrigley's chewing gum, and since then the barcode has quietly become the connective tissue of retail, logistics, healthcare, and manufacturing.
A barcode generator is the tool that produces the symbol in a printable or exportable form. Feed it the data and the format you want, and the barcode generator outputs an image that any compliant barcode scanner can read in milliseconds. The difference between a hobby barcode generator and a professional one is not the drawing, it is the checks: correct check digit, correct X-dimension, correct quiet zone, correct symbol reference, correct GS1 formatting. A barcode without those is just black lines on paper.
This page explains each common barcode format, when to pick which one, and how the matching barcode scanner decodes it. The goal is for you to walk away picking the right barcode for your actual use case instead of defaulting to whatever your printer company suggested.
How a Barcode Scanner Works
A barcode scanner is a light source, a sensor, and some decoding software. The old red laser scanner that clicked across supermarket packaging sweeps a red line across the barcode and measures how much light reflects back. Black bars absorb, white spaces reflect. The timing of the bright and dark transitions encodes the data.
Modern 2D barcode scanners use a camera instead. The camera captures a frame and software finds the barcode pattern anywhere in the image. This is why a cashier can pass a package over a flatbed scanner in any orientation, and why a phone barcode scanner can read a label at an angle.
The Decoding Chain
- The scanner illuminates the barcode and captures the reflection.
- Software finds the start pattern, the first recognizable feature.
- It measures each bar and space as a multiple of the X-dimension.
- It translates bar patterns into digits or characters using the format specification.
- It verifies the check digit, the last digit calculated from the rest.
- If the check digit matches, the scanner emits a beep and sends the number upstream.
- If it fails, the scanner tries the next frame, often 30 times per second.
The whole sequence happens in a few milliseconds. Failed scans almost always trace back to one of three causes: damaged bars, shrunken quiet zone, or printing too close to the minimum X-dimension for that format.
Every Major Barcode Format, Explained
Different industries need different barcodes because the use cases are different. A coffee bean pouch needs a compact, human readable retail barcode. A warehouse box needs a high density barcode that stays readable when scuffed. A medical vial needs a tiny barcode that fits on a rubber cap. Below are the formats that cover 95 percent of real world barcode use.
UPC-A (Universal Product Code)
12 digits. The barcode you see on virtually every supermarket product in the United States and Canada. The first digit identifies the broad product category, the next five are the company prefix assigned by GS1, the next five are the item number the brand controls, and the last is a check digit. A UPC barcode fails to scan if the check digit is wrong, which is why a proper barcode generator calculates it automatically.
EAN-13 (International Article Number)
13 digits. The international cousin of UPC. Used in Europe, Asia, Australia, Latin America. The first three digits identify the country of the GS1 member, the middle digits are the company and item, and the last is a check digit. A modern barcode scanner reads UPC and EAN-13 interchangeably, which is why American products sell in European stores without label changes.
EAN-8
8 digits. A shorter EAN for very small products where a full 13 digit barcode does not fit. Think lip balm, confectionery, small cosmetics. A GS1 member applies to GS1 for an EAN-8 prefix because the short length means the pool of numbers is smaller.
Code 128
Variable length. The workhorse of logistics, healthcare, and inventory. Code 128 encodes the full ASCII character set by switching between three subsets called A, B, and C. Subset C packs two digits per symbol, which makes a pure numeric Code 128 extremely compact. Most warehouses, couriers, and pharmacy dispensaries rely on Code 128 daily.
Code 39
Variable length. Older, simpler than Code 128. Encodes digits, uppercase letters, and a small set of symbols. Slightly lower density, which means longer printed symbols. Still common in automotive, defense, and any legacy ERP system that was built in the 1990s and refuses to upgrade. Easy to print with basic tools.
ITF-14 (Interleaved 2 of 5)
14 digits. The GS1 barcode for shipping cartons and cases. Printed on the outside of a case of 24 soda cans, for example, where the case is the unit of trade between wholesaler and retailer. The last digit is a check digit derived from the other 13, which always start with an indicator digit encoding the packaging level.
GS1-128
A Code 128 with GS1 rules applied. Used on shipping labels, the famous "SSCC" serial shipping container code, and any global supply chain label. GS1-128 encodes multiple data fields in a single barcode using application identifiers, small numeric prefixes that say "this field is the batch number" or "this field is the expiry date". Essential for pharmaceutical and food traceability.
ISBN (Bookland)
A 13 digit EAN-13 variant that encodes the International Standard Book Number. Every published book has one. Libraries, bookstores, and wholesalers scan the ISBN barcode to manage inventory and look up title data. A 5 digit add on barcode on the right encodes the suggested retail price.
QR Code
2D barcode in the matrix family. Holds up to about 4,000 characters of text. Reads in any orientation. Survives damage thanks to built in error correction. Originally developed for automotive assembly lines, now on every takeout menu and product package. Technically a barcode, functionally a full data container.
Data Matrix
2D barcode made of small black and white modules in a square. Much smaller than a QR code of the same data capacity, which is why it dominates electronics assembly (on individual circuit boards), pharmaceuticals (on blister packs, vials), and aerospace (on tiny component labels). Defined by ISO/IEC 16022.
PDF417
A 2D stacked barcode. Each row looks like a 1D barcode, the rows stacked form the symbol. Used on U.S. driver licenses, U.S. social security cards, airline boarding passes, and FedEx labels. Excellent at encoding long structured data like an address or a full passenger itinerary.
Aztec Code
A 2D matrix barcode with a distinctive bullseye in the center. Small footprint, high data density, and does not need a quiet zone as wide as QR. Widely used on European train tickets and airline boarding passes where space is tight.
Codabar
Older 1D barcode, still common in blood banks, photo labs, and libraries. Encodes digits and six symbols. Not self checking, so many users add an external check digit. A barcode generator targeting libraries usually offers Codabar for compatibility with legacy systems.
Which Barcode Should You Use?
The single most common mistake is picking a barcode format because a template had it preselected. The right answer depends on the scanner, the print surface, and the standard your partner expects. Here is a short decision table.
| Use case | Recommended barcode | Why |
|---|---|---|
| Retail product, U.S. / Canada | UPC-A | Every major retailer scanner reads UPC, GS1 membership required |
| Retail product, rest of the world | EAN-13 | Global standard, same GS1 system |
| Very small retail product | EAN-8 | Shorter, fits on lip balm, confectionery |
| Shipping carton / case | ITF-14 | Bulky, reads from distance on corrugated surface |
| Warehouse / inventory label | Code 128 | High density, full ASCII, industry default |
| Legacy ERP asset tag | Code 39 | Simple, forgiving, widely supported |
| Pharmaceutical vial | Data Matrix | Fits in tiny space, survives scuffing |
| Driver license / airline boarding pass | PDF417 | Encodes long structured data, government standard |
| Train ticket / transit pass | Aztec Code | No wide quiet zone needed, dense |
| Book or periodical | ISBN (EAN-13 variant) | Publisher and library standard |
| Marketing / consumer facing | QR code | Camera readable, holds a full URL |
Standards, GS1, and Why It All Holds Together
Barcodes work across companies because a neutral organization publishes the rules. GS1 is that organization. A global not for profit founded in 1974, GS1 maintains the UPC, EAN, GTIN, SSCC, and GLN numbering systems. Every retailer worldwide agrees to scan GS1 barcodes, which is why a bottle bottled in France, labeled in Germany, sold in Canada, all works with no friction. A barcode generator can draw any symbol you like, but the barcode only has global meaning if the underlying number was assigned by GS1.
The ISO/IEC symbol specifications sit one layer deeper. ISO/IEC 15420 defines UPC and EAN. ISO/IEC 15417 defines Code 128. ISO/IEC 16022 defines Data Matrix. ISO/IEC 24778 defines Aztec. A reliable barcode generator references these specifications so the output actually matches what a scanner expects.
Why the Check Digit Matters
Almost every retail barcode ends in a check digit calculated from the preceding digits. Modulo 10 arithmetic for UPC and EAN, different schemes for ISBN-10 and ITF-14. The purpose is to catch a scanner misread: if the barcode scanner misreads one bar, the computed check digit will not match the encoded one, and the system knows to retry. This is why barcodes feel magically reliable in high volume supermarket scans.
Barcode Use Cases That Actually Work
Retail Storefronts
Every product on every shelf scanned at checkout. UPC or EAN on the package, Code 128 on the back-of-store tote, ITF-14 on the delivery carton, GS1-128 on the pallet shipping label. Four formats, four roles, one standard family.
Warehouses and Fulfillment
Bin labels use Code 128 or Code 39 for location identifiers. Pick lists print a barcode for each line item. Mobile scanners running a warehouse management system read the barcode as workers walk, cutting error rates by a factor of ten over manual entry.
Healthcare
Patient wristbands with a Code 128 encoding the patient ID. Medication packaging with a Data Matrix encoding batch and expiry. Blood bags with Codabar for legacy compatibility. The barcode scanner at bedside is the last line of defense against the wrong drug reaching the wrong patient.
Libraries
Every book, every magazine, every audiobook gets a Code 39 or Codabar library barcode. The barcode scanner at the checkout desk links the book to the patron record. Integrated library systems have used this workflow for forty years, which is why libraries run so quietly.
Event Ticketing
Concert tickets use PDF417 or QR code to carry the seat assignment, section, and anti fraud hash. The turnstile barcode scanner reads the ticket, verifies against the database, and opens the gate. One second per guest, no paper friction.
Transportation and Aviation
Airline boarding passes use PDF417. Rail tickets use Aztec. Freight waybills use Code 128 plus a 2D matrix for detailed routing. The moment check in screens replaced paper barcodes on boarding passes, passenger throughput at airports stepped up by double digit percentages.
Agriculture and Food Traceability
From farm to shelf, a GS1-128 barcode travels with the crate. Batch number, harvest date, farm ID, country of origin all encoded in application identifiers. A barcode scanner at the distribution center confirms the shipment matches the purchase order without any paperwork.
Designing a Barcode That Scans Every Time
Most barcode failures trace back to three design mistakes. Fix these and the barcode scanner reads on the first try, every time.
Respect the X-Dimension
Every barcode format has a minimum bar width, called the X-dimension. For a retail UPC barcode the standard X-dimension is 0.33 millimeters. You can scale up, never down below the specified minimum. Shrinking the X-dimension to save label space is the number one cause of field scan failures.
Leave the Quiet Zone
The clear space on each side of the barcode is a required part of the symbol, not a layout preference. A UPC barcode needs a quiet zone at least nine times the X-dimension on the left and seven on the right. A Code 128 needs ten times. Without the quiet zone, the scanner cannot find the start of the pattern.
Print Dark on Light
The barcode scanner relies on contrast. Black bars on white background is always safe. Dark navy, dark green, deep red on a bright background usually works. Avoid light bars on dark backgrounds, many scanners skip them because they expect the opposite. If the product branding requires it, test exhaustively.
Respect the Print Technology
Ink spread on thermal paper, ink pooling on glossy stock, abrasion on cardboard boxes, UV fade on outdoor signage, each changes how the barcode looks weeks after printing. A good barcode generator lets you pick the intended print method so the output compensates: slight negative bar width adjustment for ink spread, higher error correction for 2D formats on rough surfaces.
Test With the Real Scanner
Never approve a barcode based on a screen preview. Print a real proof, test it on the exact barcode scanner your partner uses, try different angles, try the scanner at its typical working distance. Ten minutes of testing prevents a week of returned shipments.
What a Serious Barcode Generator Offers
- All major formats. UPC, EAN, Code 128, Code 39, ITF-14, ISBN, QR, Data Matrix, PDF417, Aztec. A barcode generator that only supports a handful will fail you as your needs evolve.
- Automatic check digit calculation. You enter the 11 digit part, the barcode generator computes the 12th. One less source of human error.
- GS1 application identifier support. For GS1-128, the generator structures the data by AI code so warehouse scanners decode it correctly.
- Vector export (SVG, EPS, PDF). A barcode at the wrong resolution will not scan. Vector output prints at any size without blur.
- Bulk generation from CSV. Generate 10,000 barcodes from a spreadsheet in one run, with each row producing one labeled image.
- Custom label templates. A barcode is rarely the only thing on the label. Templates with product name, price, and serial number cut design work.
- API access. Integrate with your WMS, ERP, or custom inventory app so new SKUs auto-generate new barcodes.
- Standards compliance check. Warns when an ITF-14 input is the wrong length, when a UPC check digit is off, when a Data Matrix is too dense for the intended print size.
Barcode Questions, Answered Simply
What is a barcode?
A barcode is a pattern of parallel bars and spaces or a grid of squares and dots that encodes data in a form a machine can read. A barcode scanner reads the pattern and translates it back into digits or text.
What is the difference between a 1D barcode and a 2D barcode?
A 1D barcode stores data horizontally in thin and thick bars. Typical 1D formats are UPC, EAN, Code 128, and Code 39. A 2D barcode stores data in both dimensions and holds much more. Typical 2D formats are QR code, Data Matrix, and PDF417.
What is a UPC barcode?
A UPC barcode is the 12 digit retail barcode used on most products sold in the United States and Canada. It is managed by GS1 and assigned through a company prefix. Without a real GS1 registered UPC, most North American retailers will reject the product.
What is an EAN-13 barcode?
EAN-13 is the 13 digit retail barcode used in most of the world outside North America. It is backwards compatible with UPC, which is why modern retail barcode scanners read both formats transparently.
What barcode should I use for a warehouse?
Code 128 is the default. It encodes any ASCII character, packs densely, and every warehouse barcode scanner supports it. Code 39 is a simpler fallback. For cartons and pallets, ITF-14 and GS1-128 are the standards. Many modern warehouses add a Data Matrix for resilience.
Can a phone read a barcode?
Yes. Modern iOS and Android cameras read most 1D and 2D barcode formats without a separate app. For high volume scanning, a dedicated barcode scanner app or a physical scanner is more reliable and faster.
What is the quiet zone on a barcode?
The quiet zone is the clear white space on the left and right sides of a barcode. A barcode scanner needs this margin to recognize the start and end of the pattern. Without a sufficient quiet zone, even a perfectly drawn barcode fails to scan.
Is a barcode generator really free?
Generating the visual barcode image is free. The underlying barcode number is only free for internal use. For retail sale through major retailers, you need a GS1 registered company prefix, which is a paid membership that guarantees your barcode number is globally unique.
Can I make my own UPC codes?
You can use a barcode generator to draw the visual UPC for any 12 digit number. For actual retail sale, those 12 digits must come from GS1 so the number is globally unique. Cheap non GS1 UPC codes sold by resellers often cause problems when retailers verify.
What is a Code 128 barcode?
Code 128 is a high density 1D barcode that encodes any ASCII character. It is the workhorse of logistics, pharmacy, and inventory management. Three internal character subsets (A, B, C) let the barcode generator pick the densest packing automatically.
What is a Data Matrix barcode?
A Data Matrix is a 2D barcode made of small black and white square modules. It survives damage better than a 1D barcode and fits in a tiny space, which is why electronics boards, medical vials, and aerospace parts use it. Defined by ISO/IEC 16022.
What is PDF417?
PDF417 is a stacked 2D barcode. Each row looks like a 1D barcode, and many rows stacked together form the symbol. It appears on most U.S. driver licenses and airline boarding passes because it holds significant structured data like addresses and itineraries.
Do barcodes expire?
A printed barcode does not expire, the pattern is just encoded data. The GS1 registration of the number can lapse if a company drops its membership, and the prefix eventually returns to the pool for reuse. Any active retail use requires an active GS1 membership.
What is the difference between a barcode and a QR code?
A barcode is typically a 1D pattern of bars and spaces holding up to about 30 characters. A QR code is a 2D pattern of squares holding thousands of characters with error correction and rotation tolerance. Both are barcode family members, the QR code is just the most popular 2D variant.
How big should a printed barcode be?
Each barcode format has a minimum bar width. UPC ships at 0.33 mm per narrow bar, ITF-14 on a carton runs at 1.0 mm. Smaller than the standard minimum and the barcode scanner fails at normal reading distance. Larger is always safe as long as the aspect ratio stays correct.
Can I put a logo inside a barcode?
Not inside a 1D barcode, any overlay breaks the pattern. You can put a logo next to a 1D barcode on the label. For a QR code or Aztec code, a small centered logo is fine because the error correction compensates. Keep the logo under a quarter of the symbol area and test.
Pick the Right Barcode, Trust the Scanner
A barcode is a humble technology with a massive footprint. It carries trillions of product identifications every year, silently connecting factories, shipping lanes, storefronts, and stock rooms. The modern barcode generator makes the drawing trivial, which means the interesting choices happen earlier: which format, which standard, which check digit scheme, which X-dimension, which print surface. Get those right and the barcode scanner does its job invisibly, the way it has done since 1974.
If this guide helped you pick between UPC, Code 128, and Data Matrix, it did its job. There is no glory in picking a fancy 2D symbol when a boring Code 39 reads perfectly every time. There is no point in paying for GS1 membership when the barcode never leaves your own warehouse. Match the barcode to the real use, respect the standards, test in the field, and the barcode disappears into the background the way well designed infrastructure should.