What Is a Barcode and How Does It Actually Work?
A barcode is a pattern of parallel black bars and white spaces that encodes a string of numbers or letters. A scanner reads the pattern by measuring how much light bounces back from the dark bars versus the light spaces, converts that pattern into a string of characters, and hands that string off to whatever system is looking it up — a point-of-sale terminal, an inventory database, a shipping manifest. The barcode itself doesn't hold product information. It holds a lookup key, and everything else lives in a database somewhere.
That distinction trips a lot of new business owners up. People assume the price, product name, and description are all baked into the barcode. They're not. A barcode is closer to a phone number than a phone book — it's just a short, unique reference that points somewhere else.
A brief history, because it explains why barcodes look the way they do
The first retail product ever scanned at checkout was a pack of Wrigley's chewing gum, in an Ohio supermarket in 1974. Before that, every price had to be manually keyed in or looked up on a shelf tag, which was slow and left plenty of room for cashier error. Retailers needed a format that a simple optical scanner could read reliably, in any orientation, even printed slightly imperfectly at a grocery-store scale — and the striped linear barcode was the answer that stuck. Everything about its design, the quiet zones, the start and stop patterns, the check digit, exists to solve a real problem from that era: making a fast, cheap, error-tolerant read possible with 1970s scanning technology. Modern 2D codes came decades later, once cameras and processing power caught up enough to read something denser than a line of stripes.
The parts of a barcode
Every standard 1D barcode (the classic black-and-white striped kind) has a few required elements:
- Quiet zones — the blank margin on either side of the bars. Scanners use this space to know where the barcode starts and ends. Crop it too tight and the scan fails.
- Start and stop characters — a specific bar pattern that tells the scanner which direction to read the code, since barcodes can be scanned upside down.
- Data characters — the actual encoded number or text, represented as varying bar widths.
- Check digit — a single digit at the end, calculated mathematically from the rest of the code. If a scanner reads a smudged or damaged barcode and the check digit doesn't match, it rejects the read instead of passing along bad data.
How the check digit is actually calculated
This is the part most explainers skip, but it's straightforward once you see it worked out. UPC-A uses what's called a modulo-10 algorithm. Here's the process, using an illustrative set of digits (not a real product) to walk through it:
Take the first 11 digits: 1 2 3 4 5 6 7 8 9 0 1
- Add the digits in the odd positions (1st, 3rd, 5th, 7th, 9th, 11th): 1 + 3 + 5 + 7 + 9 + 1 = 26. Multiply that by 3: 78.
- Add the digits in the even positions (2nd, 4th, 6th, 8th, 10th): 2 + 4 + 6 + 8 + 0 = 20.
- Add both totals together: 78 + 20 = 98.
- The check digit is whatever number makes that total a multiple of 10: 98 needs 2 more to reach 100, so the check digit is 2.
The full 12-digit code becomes 123456789012. Every UPC-A scanner performs this exact calculation on every single scan, in a fraction of a second, and rejects the read if the result doesn't match the final digit printed in the code. That's the mechanism behind a scanner refusing to beep on a damaged label instead of quietly recording garbage data.
How a scanner actually reads it
A laser or camera-based scanner shines light across the barcode and measures the reflection. Black bars absorb light; white spaces reflect it. The scanner's sensor converts that light-and-dark pattern into a series of electrical pulses, and firmware inside the scanner translates those pulses into the encoded characters using the rules of whatever barcode symbology it's reading — UPC, Code 128, and other formats each have their own bar-width rules and their own version of a check digit.
Modern phone cameras do the same job computationally. The camera captures an image of the barcode, and software analyzes the pixel pattern instead of reading reflected laser light directly. That's why almost any smartphone can now double as a barcode scanner with the right app, without any of the dedicated laser hardware retail scanners have used for decades.
The most common barcode types
- UPC-A — 12 digits, the standard on U.S. retail products at checkout.
- EAN-13 — 13 digits, the international equivalent of UPC, used almost everywhere outside North America.
- Code 128 — can encode letters, numbers, and symbols, widely used in shipping and logistics because of its flexibility.
- ITF-14 — a variant built for scanning through corrugated cardboard, commonly used on shipping cartons rather than individual retail units.
- QR code — a 2D code that can hold far more data than a 1D barcode, including full URLs, which is why it's become the standard for marketing and contactless use cases.
- PDF417 — a 2D format capable of holding large amounts of structured data, used on things like shipping documents, boarding passes, and government IDs.
Retail products almost always need UPC or EAN. Internal inventory, shipping labels, and asset tracking have a lot more flexibility, since there's no retail checkout system dictating the format. You can generate any of these formats directly with our free barcode generator.
Barcodes vs RFID: a comparison worth knowing
Barcodes aren't the only automatic identification technology in use, and it's worth understanding how they differ from RFID (radio-frequency identification), since the two get compared constantly in warehouse and retail contexts.
- Line of sight — a barcode has to be visually scanned, one at a time, with a clear line of sight to the code. RFID tags can be read without direct line of sight, and multiple tags can be read simultaneously within range of a reader.
- Cost per unit — a barcode is just ink on a label, essentially free to produce at scale. An RFID tag contains an actual chip and antenna, which costs meaningfully more per unit, even at bulk pricing.
- Bulk counting — RFID's biggest practical advantage is speed at scale — a warehouse can wave a reader near a pallet and capture every tag's data at once, where a barcode system requires scanning each item individually.
- Where each makes sense — barcodes remain the standard for individual retail products, where cost per unit matters and one-at-a-time scanning at checkout is normal anyway. RFID tends to show up in high-value inventory, apparel retail (for rapid stock counts), and situations where reading dozens or hundreds of items at once justifies the added tag cost.
Neither technology has really replaced the other — they solve overlapping but distinct problems, and plenty of businesses use both for different parts of their operation.
Why businesses actually use barcodes
The honest answer is speed and error reduction, not novelty. Typing a 12-digit SKU by hand into a register or spreadsheet is slow and produces mistakes — transposed digits, missed characters. A barcode scan takes a fraction of a second and is accurate close to 100% of the time when the label is printed correctly. For a warehouse moving thousands of units a day, that difference compounds into real labor savings and far fewer inventory discrepancies, which is ultimately the entire economic case for adopting barcoding in the first place.
Getting your own barcode
If you're planning to sell through a retailer or a marketplace that requires a standard barcode, you'll generally need a real UPC or EAN, which is licensed through GS1 or purchased through a reseller, with some tradeoffs worth understanding before you commit to either route. If you just need a barcode for internal inventory, shipping labels, or asset tags, you can generate one yourself in whatever format your scanning system supports, with no licensing required at all.
A couple of common misconceptions worth clearing up
"Any barcode I generate can be sold in stores." Not quite — a barcode generator can produce a technically valid, scannable barcode from any number you give it, but retailers and major marketplaces generally require that number to be a properly licensed GS1 code, not just any 12-digit number that happens to pass the check-digit math.
"Barcodes wear out or expire over time." The barcode itself doesn't degrade — it's just a printed pattern. What actually happens is the physical label wears, fades, or gets damaged through handling, which is a printing and materials issue, not something inherent to the barcode format.
Quick answers
Does a barcode contain the product's price? No. It contains a lookup number. The price is stored in whatever database or point-of-sale system reads that number.
Can two different products share the same barcode? They shouldn't. Reusing a barcode across different products will cause inventory and sales systems to mix up the two items.
What's the difference between a barcode and a QR code? A barcode (1D) encodes a short string of numbers, usually a lookup key. A QR code (2D) can hold significantly more data, including full web addresses, which is why it's used for marketing and contactless scanning rather than retail checkout.
Do I need special software to read a barcode? No — most smartphone cameras can read barcodes and QR codes natively or with a free scanning app.
How is a barcode's check digit calculated? Most 1D formats use a modulo-10 algorithm: digits in specific positions are summed, multiplied by a weighting factor, and combined to produce a single digit that makes the total divisible by 10. If a scanned code doesn't satisfy that math, the scanner rejects the read.
What's the difference between a barcode and RFID? A barcode requires direct line of sight and is scanned one at a time. RFID uses radio waves, doesn't require line of sight, and can read multiple tags at once, but costs significantly more per unit than a printed barcode.
Are barcodes the same everywhere in the world? Not identical, but compatible. UPC is the standard in North America and EAN is the equivalent used in most other regions, but the overwhelming majority of modern scanners read both formats without any special configuration.
Can a barcode "expire" or stop working? The code itself doesn't expire, but the physical label can degrade through wear, fading, or damage, which is what actually causes scan failures over time, not the barcode format itself.
Enjoyed this post?
Share it with your network