What Is a Barcode? A Complete Beginner's Guide
What a barcode is, how scanners read the bars, the main types from UPC and EAN to Code 128 and Data Matrix, and what you need to put one on a product.
By StylQR Editorial TeamPublished 5 min read

Table of contents
A barcode is a pattern of bars and spaces, or of small squares, that a machine can read to get a number or text. On a cereal box, the barcode holds a product number. The checkout scanner reads it, the store's system looks up the name and price for that number, and the item appears on your receipt in a fraction of a second.
This guide explains how barcodes work, where they came from, the main types you'll see and what you need to put one on your own product.
How a barcode stores information
The classic barcode is one-dimensional (1D): information is stored only in the widths of the bars and spaces from left to right. The height doesn't hold data; it just gives the scanner a bigger target. Each pattern of widths stands for a digit or character, according to the rules of that barcode type, called a symbology.
Most barcodes also include:
- Start and stop patterns that tell the scanner where the code begins and ends, and which way round it is.
- A check digit, calculated from the other digits, so the scanner can spot a misread.
- Quiet zones: blank margins on either side. Without them, the scanner can't tell where the barcode starts.
- Human-readable text under the bars, so a cashier can type the number if the scan fails.
Two-dimensional (2D) barcodes, such as QR codes, Data Matrix and PDF417, store data across both width and height in a grid. That lets them hold far more in a smaller space, and they include error correction so they can still be read when partly damaged. 1D vs 2D barcodes compares the two families.
How scanners read barcodes
A barcode scanner shines light at the code and measures what bounces back. Dark bars absorb light; light spaces reflect it. The scanner turns that into a pattern of wide and narrow pulses, and a decoder converts the pattern into characters using the symbology's rules, then checks the check digit.
There are two main kinds of scanner:
- Laser scanners sweep a red laser line across the bars. They're fast and read from a distance, but only handle 1D codes. Because they use red light, bars printed in red are invisible to them.
- Image-based scanners, including phone cameras, take a picture and decode it in software. They read 1D and 2D codes from any angle.
How to read and decode barcodes goes into scanners and apps in more detail.
A short history of the barcode
Norman Joseph Woodland and Bernard Silver filed a patent application for a barcode system in October 1949, and the patent was granted in 1952. Their early design used concentric rings, like a bullseye. The idea only became practical once lasers and computers were cheap enough for shops.
In 1973, the US grocery industry chose the Universal Product Code (UPC) as its standard. The first retail UPC scan took place on 26 June 1974 at a Marsh supermarket in Troy, Ohio: a 10-pack of Wrigley's Juicy Fruit gum, as recorded in the history of the barcode. The EAN system used across most of the world grew out of the same idea, and both are now managed by GS1, a global non-profit standards organization.
The main types of barcode
There are dozens of symbologies. A handful cover most real uses:
| Barcode | Type | Where you see it |
|---|---|---|
| UPC-A, UPC-E | 1D | Retail products in the US and Canada |
| EAN-13, EAN-8 | 1D | Retail products in most other countries |
| ISBN | 1D (EAN-13) | Books |
| ITF-14 | 1D | Outer cartons and cases in distribution |
| GS1-128 | 1D | Logistics labels with dates, batch numbers, weights |
| Code 128 | 1D | Shipping, warehouses, internal labels |
| Code 39 | 1D | Older industrial, asset and ID labels |
| GS1 DataBar | 1D | Fresh produce, coupons, small items |
| Data Matrix, GS1 DataMatrix | 2D | Healthcare, electronics parts, small items |
| PDF417 | 2D | ID cards, boarding passes, shipping documents |
| QR Code | 2D | Links, payments, menus, tickets |
GS1 Canada's overview of barcode standards explains which GS1 barcodes are meant for retail checkout and which are for distribution and logistics only. For examples of each type, see different types of barcodes explained.
Retail barcodes need a GS1 number
This is the part beginners most often miss. Drawing a barcode is easy. The number inside a retail barcode, called a GTIN (Global Trade Item Number), has to be unique worldwide, and the system that guarantees that is GS1.
To sell through supermarkets, marketplaces and most retailers, you license a company prefix from your national GS1 organization and build your product numbers from it. A generator then turns each number into a barcode image. StylQR's barcode generator draws EAN, UPC and other GS1 barcodes from the number you supply, with check-digit validation, but it doesn't issue GTINs. What is a GS1 barcode? covers the process.
Internal barcodes are different. For stock in your own warehouse, library books, tool checkout or event badges, you can use any numbering you like with a symbology such as Code 128.
Making a barcode with StylQR
- Open the barcode generator and pick a type, for example EAN-13 for retail or Code 128 for internal labels.
- Enter the number or text. The generator validates it live and corrects the check digit where the symbology has one.
- Set the bar width and height in mm and check the printed-size readout. Keep the quiet zone on.
- Choose colors. Dark bars on a light background are safest; the generator warns you about colors a red laser can't read.
- Run the Test scan.
- Download PNG, JPG or WEBP at 300–1200 DPI, SVG, an exact-size PDF, or Avery label sheets.
For hundreds of product or asset labels, the bulk barcode generator takes a spreadsheet or a number sequence of up to 5,000 rows.
Barcodes and QR codes
QR codes are barcodes too, just two-dimensional ones. Retail is gradually moving toward 2D codes on packaging, which can carry a product number plus a link, batch and expiry information. Standard 1D barcodes will stay in use alongside them for years. QR code vs barcode explains the differences, and GS1 Sunrise 2027 covers the move to 2D at checkout.
Where to start
If you're putting barcodes on products for retail, start with GS1 to get your numbers, then generate the barcodes. If you need barcodes for your own stock, tools or tickets, pick Code 128 and start labeling. Either way, how to choose the right barcode format for your business helps you settle on a symbology before you print.
Frequently asked questions
Does a barcode contain the product's price?
Usually not. A retail barcode holds a product number, and the store's system looks up the price and description for that number. That's why the same product can have different prices in different shops.
Can I make my own barcode for free?
You can draw any barcode for free with a generator like StylQR. For products sold through retailers, the number inside must come from your national GS1 organization, which licenses company prefixes.
Can a phone read barcodes?
Many phones can read common barcodes through the camera, Google Lens or a scanner app, though support varies by phone and app. Shop checkouts use dedicated laser or camera scanners.
Is a QR code a type of barcode?
Yes. A QR code is a two-dimensional barcode. The word barcode covers both the striped one-dimensional kind and 2D codes like QR, Data Matrix and PDF417.


