QR guidetext→bars

Code 128 barcodes, explained simply

Code 128 is the everyday barcode for labels. It can hold letters, numbers and symbols, it packs them into less space than older types, and almost every scanner reads it. If nobody has told you which barcode to use, Code 128 is the safe choice.

You’ve probably been asked for “a Code 128” by a warehouse, a shipping company or a piece of software — or you’ve seen “128” printed under a barcode and wondered what it means. This page explains what Code 128 is, how it compares to the other common barcodes, and how to print one that scans first time.

What Code 128 can hold

A barcode is a row of black bars and white gaps. Their widths spell out a value — like Morse code, but read by a light instead of an ear. Each barcode type has its own alphabet, and Code 128’s is large: all 128 basic computer characters, which is where the name comes from.

In practice, that means it can hold:

  • Capital and small letters: Order-ab12
  • Digits: 004512, leading zeros kept
  • Punctuation and symbols: - . / + % # @ &
  • Spaces

It cannot hold accented letters (é, ü), emoji, or other alphabets. For those, or for a web link, use a QR code instead.

The three “modes”, and why numbers come out shorter

Code 128 has three character sets, called A, B and C. You don’t normally pick one — a good generator switches between them for you, even in the middle of a barcode.

  • Set A — capital letters, digits, punctuation, and invisible control codes like Tab.
  • Set B — capital and small letters, digits and punctuation. The usual one for text.
  • Set C — digits only, packed two at a time. This is the clever part.

Because set C squeezes two digits into the space of one character, a long number makes a much shorter barcode than the same number of letters. 12345678 takes four characters’ worth of bars, not eight. If you get to choose your codes, an even number of digits makes the most compact barcode of all.

Code 128 compared with other barcodes

TypeHoldsUse it for
Code 128Any typed text, any lengthShipping and stock labels, asset tags, tickets, internal IDs
GS1-128 (“EAN-128”, “UCC-128”)Code 128 with a fixed layout of product number, batch, expiry date and so onCartons and pallets going to retailers; medicines and healthcare
EAN-13Exactly 13 digitsProducts sold in shops, worldwide
UPC-AExactly 12 digitsProducts sold in shops, mainly the US and Canada
Code 39Capital letters, digits and a few symbolsOlder warehouse systems, ID badges, some government and car-industry labels
QR codeLong text, links, any languageAnything people scan with a phone camera

When you can’t use Code 128

Products sold in shops. Checkout scanners expect EAN-13 or UPC-A, and the number isn’t something you make up. It comes from GS1, the body that hands out product numbers, so no two products in the world share one. Shops and Amazon check them. Inside your own warehouse, though, Code 128 is fine for anything you like.

When a customer asks for GS1-128. Big retailers often want shipping labels in this format. It looks like Code 128 to the eye, but the data is laid out in numbered fields written in brackets, like (01) for the product number, (10) for the batch and (17) for the expiry date. A plain Code 128 of the same digits will scan, but the retailer’s system won’t understand it. Use label software that supports GS1-128 for these.

Searches like “UPC 128” or “EAN 128 barcode” usually mean one of these two. UPC is a separate barcode type; “EAN-128” is GS1-128.

How a Code 128 barcode is built

Read from left to right, every Code 128 has the same five parts:

  1. A blank margin, called the quiet zone, so the scanner can tell where the barcode begins.
  2. A start character, which also says which character set comes first.
  3. Your data.
  4. A check character, worked out from everything before it. If a bar is misread, the sums don’t match and the scanner rejects the read instead of returning the wrong value. It’s added for you and isn’t shown in the text under the bars.
  5. A stop pattern, then another quiet zone.

That built-in check is why Code 128 almost never misreads. A damaged barcode fails to scan; it doesn’t scan as something else.

How to scan a Code 128

  • With a barcode scanner (the handheld “gun”). Almost all of them read Code 128 straight out of the box. Plugged in by USB, the scanner acts like a keyboard: it types the value wherever your cursor is, then usually presses Enter.
  • With a phone. Phone cameras read QR codes easily but often ignore ordinary barcodes. Google Lens, or any free “barcode scanner” app, reads Code 128 fine. Hold the phone so the barcode runs across the screen, not up and down.

How to print one that scans first time

Most scanning problems come down to printing, not the barcode itself. Check these:

  1. Leave blank space on both sides. The quiet zone should be at least ten times the width of the thinnest bar. Text or a box edge too close to the bars is the most common reason a barcode won’t scan.
  2. Don’t stretch it out of shape. Resize the image with its corners, keeping its proportions. Squashing it sideways in Word or Canva changes the bar widths, which are the data.
  3. Black on white. Dark bars on a light background. Red bars don’t work — many scanners use red light, which makes red look white.
  4. Keep it tall enough. A tall barcode can be scanned at a slight angle. A thin strip has to be lined up exactly.
  5. Keep values short for small labels. Every extra character makes the barcode wider. On a small label, a long value forces thin bars, and thin bars are harder to print cleanly.
  6. Test before you print a hundred. Print one, scan it with the scanner it will actually be used with, and check the value that comes out.

Make one now

The barcode generator makes Code 128, Code 39, EAN-13 and UPC-A barcodes and downloads them as PNG images, with the quiet zone already included. Type your value, check it, and download. Need something people will scan with a phone camera, like a link? Use the QR code generator instead, or make many QR codes at once from a list.

More guides

All guides →