Types of Barcodes

There are two families of barcodes: linear (1D) codes such as UPC, EAN, Code 128 and Code 39, and 2D codes such as QR Code, Data Matrix and PDF417. Which one you need depends on where it will be scanned and what data it carries.

Short answer: use UPC-A or EAN-13 for retail products, Code 128 for inventory and shipping labels, ITF-14 or GS1-128 for cartons and pallets, and a QR code for anything people scan with a phone. Data Matrix and PDF417 are for packing a lot of data into a small space, such as medicine packs and ID cards.

What is the difference between 1D and 2D barcodes?

A linear (1D) barcode is the familiar row of black bars and white spaces. The data is in the widths of the bars, read along a single line by a laser or camera scanner. Linear codes are cheap to print and read very quickly, but they hold little data (usually a product or reference number of 8 to about 40 characters) and get wide as the data grows.

A 2D barcode stores data in a grid of square modules or dots, both horizontally and vertically. It holds far more (a QR code can carry a full web address, a contact card or several thousand digits) and includes error correction, so it still reads if part of it is scratched or covered. 2D codes need a camera-based (imaging) scanner or a phone; classic laser scanners can’t read them.

Example EAN-13 linear barcode for 9520123456788
Linear: EAN-13
Example QR code linking to barcodejar.com
2D: QR Code

Retail barcodes: UPC and EAN

Products sold in shops carry a GTIN (Global Trade Item Number) issued under a GS1 licence, printed as a UPC or EAN barcode. UPC-A holds 12 digits and is the traditional code in the US and Canada. EAN-13 holds 13 digits and is used everywhere else; a UPC-A is simply an EAN-13 with a leading zero, and checkout systems worldwide read both. UPC-E and EAN-8 are shorter versions for packs too small for the full code. Books use EAN-13 barcodes that start with 978 or 979 (the ISBN). Read UPC vs EAN for the details.

Example UPC-A barcode for 012345000058
UPC-A
Example UPC-E barcode for 01234558
UPC-E
Example EAN-8 barcode for 95200002
EAN-8
Example ISBN barcode for 978-1-56581-231-4
ISBN (EAN-13)

Logistics and inventory barcodes

Code 128 is the workhorse of warehouses and shipping labels. It encodes all 128 ASCII characters, switches to a compact mode for long runs of digits, and every scanner reads it. GS1-128 is Code 128 with GS1 rules: the data is split into fields by Application Identifiers, such as (01) for the GTIN, (17) for the expiry date, (10) for the batch and (00) for the SSCC pallet number.

Code 39 is older and less dense but still required by some automotive, defence and healthcare systems. ITF-14 (Interleaved 2 of 5 with a 14-digit GTIN) tolerates the rough printing on corrugated cartons and is usually framed by a thick bearer bar. Codabar survives in libraries and blood banks.

Example Code 128 barcode for SKU-48213-B
Code 128
Example GS1-128 barcode with GTIN, expiry date and batch
GS1-128
Example Code 39 barcode for ASSET 1042
Code 39
Example ITF-14 barcode with bearer bars for 15400141288763
ITF-14

2D barcodes: QR, Data Matrix, PDF417 and Aztec

QR Code is the 2D code people know, because every phone camera reads it: menus, payments, WiFi and links. Data Matrix is smaller for the same data and is the standard for marking electronic components, medical devices (UDI) and medicine packs as GS1 DataMatrix. PDF417 is a stacked code found on US and Canadian driver’s licences and many shipping documents. Aztec needs no quiet zone and is widely used on rail and airline mobile tickets.

Example Data Matrix code
Data Matrix
Example PDF417 stacked barcode
PDF417
Example Aztec code
Aztec Code

Barcode types compared

TypeKindDataTypical use
UPC-A1D12 digits (GTIN-12)Retail products, US and Canada
UPC-E1D8 digits (compressed UPC-A)Small packs in North America
EAN-131D13 digits (GTIN-13)Retail products worldwide, books (ISBN)
EAN-81D8 digits (GTIN-8)Very small retail packs
Code 1281DAll 128 ASCII charactersShipping, inventory, warehouse labels
GS1-1281DGS1 data with Application IdentifiersPallets, cases, batch and expiry dates
Code 391DA–Z, 0–9, space and - . $ / + %Automotive, defence, ID badges
ITF-141D14 digits (GTIN-14)Outer cartons and corrugated boxes
Interleaved 2 of 51DDigits, even countWarehousing, cartons
Codabar1DDigits and - $ : / . +Libraries, blood banks, older systems
GS1 DataBar1D / stackedGTIN, plus extra data in ExpandedFresh food, coupons, small items
Intelligent Mail4-state20–31 digitsUS mail sorting (USPS)
QR Code2DUp to 7,089 digits or ~2,900 charactersLinks, WiFi, payments, marketing
Data Matrix2DUp to 3,116 digits or 2,335 charactersParts marking, healthcare (UDI), pharma
GS1 DataMatrix2DGS1 data: GTIN, batch, expiry, serialMedicines, medical devices
PDF417Stacked 2DUp to ~1,850 charactersDriver’s licences, ID cards, shipping
Aztec Code2DUp to ~3,000 charactersTrain and airline tickets
MaxiCode2DUp to 93 charactersUPS parcel sorting
Micro QR2DUp to 35 digitsTiny parts and labels

BarcodeJar supports over 100 symbologies, including postal, pharmaceutical and composite codes. Browse them all on the barcode types page.

Which barcode should I use?

Start from where the code will be scanned and who controls the scanner. Retail checkouts expect GS1 codes; your own warehouse can use anything your scanners read; customers with phones need a QR code.

If you need to…UseNotes
Selling a product in shops or online marketplacesUPC-A (US/Canada) or EAN-13Needs a GS1-licensed GTIN
Publishing a bookISBN barcode (EAN-13 starting 978/979)Needs an ISBN from your national agency
Labelling stock, bins or SKUs inside your businessCode 128Any letters and numbers you choose
Marking shipping cartons of a retail productITF-14 or GS1-128GTIN-14 for the case
Pallet labels with batch, expiry or SSCCGS1-128Use the SSCC generator for pallet IDs
Amazon FBA unitsFNSKU label (Code 128)Amazon assigns the FNSKU
Asset tags, ID badges, library cardsCode 128 or Code 39Code 39 if old scanners require it
Small parts or lots of data in a tiny spaceData MatrixNeeds a 2D imaging scanner
Medicines and medical devicesGS1 DataMatrixFollow your regulator’s UDI or serialisation rules
Something customers scan with a phoneQR codeStatic QR codes never expire
ID cards or documents with lots of textPDF417Common on driver’s licences

How do I check a barcode will scan?

Before printing a run, check three things. First, the number: retail codes end in a check digit, which you can confirm with the check digit calculator or barcode validator. Second, the size and quiet zone: see the barcode size guide. Third, the print itself: scan a proof with a phone using our barcode scanner, ideally also with the scanner that will be used in practice.

Frequently asked questions

What are the main types of barcodes?

Barcodes are either linear (1D) or two-dimensional (2D). The most common linear types are UPC and EAN for retail products, Code 128 and Code 39 for logistics and inventory, ITF-14 for shipping cartons and GS1-128 for supply-chain data. The most common 2D types are QR Code, Data Matrix, PDF417 and Aztec.

What type of barcode is used on products in stores?

UPC-A in the US and Canada and EAN-13 almost everywhere else. Both encode a GS1 product number (GTIN), and modern checkout scanners read both. Small packs may use the shorter UPC-E or EAN-8.

Which barcode is best for inventory?

Code 128 is the usual choice for internal inventory, SKU and bin labels: it encodes letters and numbers, is compact and every scanner reads it. If you need more data in a small space, or want phones to scan it, use Data Matrix or a QR code.

Can my phone scan every type of barcode?

Phone cameras read QR codes natively. Most other common types (UPC, EAN, Code 128, Code 39, Data Matrix, PDF417, Aztec) can be read with a scanner app or our online barcode scanner. Laser scanners read only linear barcodes; reading 2D codes needs an imaging (camera-based) scanner.

Do I need permission to use a barcode type?

No. The symbologies themselves are open standards that anyone can print. What you may need is a valid number: retail UPC/EAN codes must carry a GTIN licensed from GS1. Internal codes such as Code 128 asset tags can hold any data you like.

What is the difference between a 1D and a 2D barcode?

A 1D barcode stores data in the widths of parallel bars and is read across one line, holding roughly 20–50 characters. A 2D barcode stores data in a grid of squares or dots, holds hundreds to thousands of characters, and keeps working when part of it is damaged thanks to error correction.

Related free tools