Barcodes Explained: How to Generate One That Scans

Quick answer

How the stripes encode numbers, the common barcode types, and how to make a barcode that scanners actually read.

By 123MiniApps · Published 2026-07-29 · Updated 2026-09-01 · 1047 words · about 5 minute read

A barcode is the pattern of parallel black bars and white spaces you see on almost every product, encoding a number that a scanner reads in a flash of light. Those stripes are not decoration, their varying widths represent digits according to a strict standard. The Barcode Generator creates scannable barcodes in your browser, and this article explains how they work and how to make one that reliably scans.

Barcodes quietly run retail, logistics and inventory the world over. Understanding what type you need and how to produce a clean one saves the frustration of codes that will not scan at the till or in the warehouse.

How the stripes encode numbers

A one-dimensional barcode encodes data in the widths of its bars and the spaces between them. Each digit is represented by a specific pattern of wide and narrow elements, and the scanner reads the reflected light as it sweeps across, translating the pattern of light and dark back into numbers. Guard patterns at the start, middle and end tell the scanner where the code begins and ends and help it calibrate. Because the information is stored horizontally, a linear barcode only needs to be read across its width, which is why a scanner can read it at any point along the bars' height.

The common barcode types

Different jobs use different barcode standards, and picking the right one matters because scanners and systems expect specific types:

  • EAN-13 / UPC-A: the familiar retail product codes, encoding a fixed-length product number used at checkouts worldwide.
  • Code 128: a compact, flexible format that encodes letters and numbers, widely used in shipping and logistics.
  • Code 39: an older alphanumeric format still common in industry and ID cards.
  • ITF-14: used on shipping cartons and outer packaging.

For a retail product you generally need EAN or UPC; for internal inventory, shipping labels or asset tags, Code 128 is the versatile default. Using the wrong type is a common reason a barcode fails to scan in a particular system.

Retail codes need a real registered number

Anyone can generate the barcode image, but a UPC or EAN used in shops must contain a genuine, registered product number issued to you. Generating the stripes does not register the number, that comes from the official body that allocates them.

The check digit

Most barcode standards include a check digit, a final digit calculated from the others using a formula. When the scanner reads the code, it recomputes the check digit and compares it; if they do not match, it knows the read was faulty and rejects it rather than passing on wrong data. This is what prevents a smudged or misread barcode from silently registering the wrong product. A good generator calculates the correct check digit for you automatically, which is important because an incorrect check digit produces a code that simply will not scan.

Making a barcode that scans

As with QR codes, physical quality determines whether a barcode works in the real world. Keep strong contrast, true black bars on a white background, because scanners read reflected light and struggle with low contrast or coloured bars. Preserve the quiet zones, the blank margins at each end, which scanners need to detect the code's boundaries. Print at an adequate size and resolution so the narrow bars stay crisp; a barcode scaled too small or printed blurry loses the fine width differences that carry the data. And never stretch it in a way that distorts the bar widths.

Try it: Barcode Generator

Generate scannable barcodes in common formats like EAN, UPC and Code 128, entirely in your browser. Nothing is uploaded.

Barcodes versus QR codes

It helps to know when a linear barcode is right and when a QR code serves better. Traditional barcodes are compact and perfect for encoding a short number that links to a database record, a product, a parcel, an asset. QR codes are two-dimensional and hold far more data, including URLs and text, and can be scanned by any phone camera rather than a dedicated laser scanner. For a point-of-sale product code or a warehouse label read by handheld scanners, a linear barcode is the standard; for linking print to a web page for consumers, a QR code wins. Barcodes also pair naturally with an invoice or packing slip when you need machine-readable product references on paperwork.

Barcodes in inventory and everyday workflows

Beyond retail checkouts, barcodes quietly power a huge range of tracking and inventory tasks, and generating your own opens up practical uses for small businesses and even personal organisation. You can label stock, equipment or assets with Code 128 barcodes tied to entries in a simple spreadsheet or database, then scan them to look items up, check them in and out, or count inventory far faster and more accurately than typing codes by hand. Libraries, warehouses, events and repair shops all run on exactly this pattern: a printed code that resolves to a record.

The key to making this work is that the barcode itself only needs to encode a short identifier, an SKU, an asset number, a reference, while all the rich information lives in your own records, looked up when the code is scanned. This keeps the barcode compact and reliable and means you can change what an item's data says without reprinting its label. When you generate barcodes for a batch of items, consistency matters: use the same format throughout, calculate check digits correctly, and print at a size and quality your scanners can read in the conditions they will actually be used. Paired with a spreadsheet exported to structured data, homemade barcodes turn a pile of untracked items into a searchable, scannable inventory with very little effort and no specialist equipment beyond a printer and a scanner or phone.

To summarise: a barcode encodes a number in the widths of its bars and spaces, protected by a check digit that catches misreads, and comes in standard types suited to retail, shipping or industry. Choose the right format for your system, let the generator compute the check digit, and above all print it with good contrast, intact quiet zones and enough size to keep the bars crisp. Do that and your barcode will scan first time, wherever it needs to.

Tools mentioned in this article

Continue reading

← More articles · Browse all 95 tools

Pick a theme

Ten hand-tuned palettes.