Which barcode should I use?

8 minute read · updated 2026-10-31

There is no single best barcode. There are families of them, each designed for a particular job, and the right choice depends on what the code has to hold, who is going to scan it, and whether the number inside it has to mean something to anyone outside your business.

This guide covers the eight you are most likely to need.

The retail ones: EAN-13 and UPC-A

These are the striped codes on the back of a cereal box. EAN-13 holds thirteen digits and is the global standard. UPC-A holds twelve digits and is the North American variant. Both hold numbers only, no letters, no spaces.

The important point, and the one that trips most people up: you cannot invent these numbers. A retail barcode number is allocated from a company prefix issued by GS1, the organisation that administers the system. You buy a prefix, and your numbers are drawn from it, so no two products anywhere share an identifier. If you make up a thirteen-digit number, you will almost certainly collide with someone else's product, and any shop you approach will reject it.

So use EAN-13 or UPC-A only when you are selling through retailers or marketplaces that require a GS1 number and you have one. A generator will happily render any thirteen digits for you, including a test number. Rendering it is not the same as owning it.

To get numbers, contact the GS1 office in your country; gs1.org lists them. Books are the exception: an ISBN comes from your national ISBN agency, not from GS1, and turns into an EAN-13 barcode that starts 978 or 979 (see making an ISBN barcode). Once you have a number, the EAN-13 barcode generator adds the check digit and draws it.

The everyday workhorse: Code 128

Code 128 holds letters, numbers and punctuation, and there is no fixed length — it stretches as you add characters, though it gets wide quickly beyond about twenty. Nearly every handheld scanner and warehouse system reads it.

This is the right choice for your own labels. Asset tags, shelf locations, stock references, tool numbers, batch codes, job sheets. You decide the numbering, nobody needs to buy anything, and you can include a prefix that means something to you, such as TOOL-0147.

When not to use it: on retail packaging destined for a supermarket till, and anywhere the label is so small that a long code becomes unreadable.

The older alternative: Code 39

Code 39 holds capital letters, digits and a handful of symbols. It is older and less compact than Code 128 — the same data takes noticeably more width. Its advantage is that very old scanners and some industrial and military systems expect it.

Use it if a system you are feeding specifically asks for Code 39. Otherwise prefer Code 128, which does the same job in less space.

The outer-carton code: ITF-14

ITF-14 holds fourteen digits and identifies a case or pallet rather than a single item. It is printed with a thick black frame, called a bearer bar, because it is often printed straight onto corrugated cardboard where the ink spreads. It is forgiving of rough printing, which is exactly the point.

Like EAN-13, the number comes from GS1. Do not use it for individual retail units or for internal labels.

The 2D codes: Data Matrix, PDF417, Aztec

These are square or rectangular patterns rather than stripes, and they hold far more in far less space. They need a camera-based scanner, not an old laser one.

Data Matrix is tiny and robust. It is what you find etched on circuit boards, surgical instruments and small components, and it is used widely in pharmaceutical traceability. It can be read even when partly damaged. Use it when the label area is genuinely minute. Do not use it where the scanning equipment is a legacy laser gun.

PDF417 is a wide, stacked code that can hold a few hundred to a couple of thousand characters. It is the block on the back of a driving licence and on airline boarding passes. Use it when you need a lot of data in a code that fits a wide strip. Do not use it for a simple product number — it is overkill and wastes space.

Aztec is a square code with a bullseye in the middle, common on rail and airline tickets, including mobile tickets. It needs no quiet zone around it, so it suits cramped ticket layouts. Use it if the system receiving it asks for Aztec. Otherwise a QR code is more widely readable by ordinary phones.

Comparison

CodeHoldsCapacityTypical useAvoid when
EAN-13Digits13 digitsRetail products worldwideYou have no GS1 prefix
UPC-ADigits12 digitsRetail in North AmericaYou have no GS1 prefix
Code 128Letters, digits, symbolsVariable, best under ~20 charactersInternal assets, stock, logistics labelsRetail tills; very small labels
Code 39Capitals, digits, few symbolsVariable, wider than Code 128Legacy and industrial systemsSpace is tight
ITF-14Digits14 digitsOuter cases and palletsSingle retail units; internal labels
Data MatrixText and numbersHundreds of charactersTiny parts, instruments, pharmaOnly laser scanners available
PDF417Text and numbersOver a thousand charactersLicences, boarding passesA short reference is all you need
AztecText and numbersHundreds to thousandsTransport ticketsGeneral public scanning with phone cameras

Choosing in practice

Ask three questions. Is this going through a shop till? Then you need a GS1 number and EAN-13 or UPC-A. Is it for your own records? Code 128. Is the label smaller than a postage stamp, or does it need to carry a lot of text? Then a 2D code, usually Data Matrix.

And before committing to a print run, scan a sample with the actual scanner that will be used. Codeshed will produce any of these as PNG, SVG or PDF, and can generate a whole sheet of sequential Code 128 labels at once, which makes testing cheap.

Read next

Make a code in the workshop →

Codeshed is a trading name of Third Coffee Studio Ltd, registered in England and Wales, company number 17517422.