Menu

Barcodes with ZPL

Complete guide to 10 barcode types for Zebra printers with practical examples and configuration

Try our free ZPL tools right now

Free, no signup required — Instant results

Barcodes in ZPL

ZPL supports over 30 barcode types between 1D (linear) and 2D (two-dimensional). Each type has its own command and specific parameters. The ^BY command is essential: place it BEFORE the barcode command to define module width (bar thickness), the wide-to-narrow ratio, and default height. This guide covers the 10 most widely used types in logistics, retail, manufacturing and pharmaceuticals — with copy-ready examples optimized for shipping platforms like Amazon, eBay, Shopify, FedEx and UPS, and compatible with printers from Brother, DYMO, Rollo and Zebra.

Barcode types

Code 128

^BC

The most widely used barcode in global logistics and shipping. Encodes all 128 ASCII characters (numbers, upper and lowercase letters, symbols). Has 3 automatic subtypes: A (uppercase + control), B (upper + lowercase) and C (numeric only, more compact). The printer selects the optimal subtype automatically.

Ejemplo de código:

^XA
^FO50,50^BY2
^BCN,100,Y,N,N
^FD123ABC456^FS
^XZ

Casos de uso:

  • Shipping labels (Amazon, eBay, FedEx, UPS)
  • Serial numbers and lot tracking
  • Warehouse product identification
  • Parcel logistics and transportation

QR Code

^BQ

2D code that stores up to 4,296 alphanumeric characters or 7,089 digits. Supports error correction (levels L, M, Q, H) allowing the code to be read even if partially damaged. The data prefix defines the mode: QA (automatic), QM (manual). Requires prefix FDQA, or FDMM,A for data with special characters.

Ejemplo de código:

^XA
^FO50,50
^BQN,2,5
^FDQA,https://zplpdf.com^FS
^XZ

Casos de uso:

  • URLs and web links on labels
  • Extended product information
  • Tickets, boarding passes and event entry
  • Marketing and campaign tracking

EAN-13

^BE

Global standard for consumer products in retail. Used throughout Europe, Asia, Latin America and international markets. Requires exactly 12 data digits (the 13th check digit is calculated automatically). The first digits identify the country of origin (000-019 = USA/Canada, 400-440 = Germany, 500-509 = UK).

Ejemplo de código:

^XA
^FO50,50^BY2
^BEN,100,Y,N
^FD012345678901^FS
^XZ

Casos de uso:

  • Supermarket and retail products
  • Inventory with point-of-sale (POS) systems
  • Price tags in brick-and-mortar stores
  • International product cataloging

UPC-A

^BU

The primary standard for consumer products in the United States and Canada. Required by major retailers like Amazon, Walmart, Target and Costco. Requires exactly 11 data digits (the 12th check digit is calculated automatically). The North American equivalent of EAN-13 — scanners at US retailers are tuned for this format.

Ejemplo de código:

^XA
^FO50,50^BY2
^BUN,100,Y,N
^FD12345678901^FS
^XZ

Casos de uso:

  • Retail products sold in the US and Canada
  • Amazon, eBay and Shopify listings
  • US point-of-sale and inventory systems
  • Shelf labels and price tags

Code 39

^B3

One of the oldest and most widely adopted barcodes in industry. Encodes only uppercase letters (A-Z), numbers (0-9) and 7 special symbols (-, ., space, $, /, +, %). Self-checking (no mandatory checksum required). Lower density than Code 128 but compatible with virtually every scanner on the market.

Ejemplo de código:

^XA
^FO50,50^BY2
^B3N,N,100,Y,N
^FDABC-123^FS
^XZ

Casos de uso:

  • Automotive industry (AIAG standard)
  • Defense and government (MIL-STD-1189)
  • Healthcare and laboratory specimens
  • Industrial inventory control

DataMatrix

^BX

Extremely compact 2D code capable of storing up to 2,335 alphanumeric characters in a very small area. Has built-in Reed-Solomon error correction (tolerates up to 30% damage). The quality parameter (0-200) controls the level of redundancy. Ideal for direct part marking (DPM) on metal, plastic and glass surfaces.

Ejemplo de código:

^XA
^FO50,50
^BXN,5,200
^FDSN:ABC123456^FS
^XZ

Casos de uso:

  • Electronic components and PCBs
  • Pharmaceuticals (GS1 standard)
  • Direct part marking on metal surfaces
  • Medical devices and traceability

PDF417

^B7

High-capacity stacked 2D code that stores up to 1,850 alphanumeric characters or 2,710 digits. Supports 9 security levels (error correction). Can encode text, numbers and binary data. The legal standard for identity documents in many countries and widely used by airlines.

Ejemplo de código:

^XA
^FO50,50
^B7N,5,2,3,10,N
^FDExtensive data here^FS
^XZ

Casos de uso:

  • Driver's licenses and ID cards
  • Airline boarding passes
  • Government identity documents
  • Forms with large amounts of structured data

Aztec

^BO

Compact 2D code that does NOT require a quiet zone (white border) around it, making it ideal for very tight spaces. Stores up to 3,832 digits or 3,067 characters. Supports configurable error correction. Magnification controls the symbol size. Commonly used in transit ticketing systems worldwide.

Ejemplo de código:

^XA
^FO50,50
^BON,5,N
^FDCompact Aztec data^FS
^XZ

Casos de uso:

  • Public transit and rail tickets
  • Labels in very confined spaces
  • Applications where no quiet zone is available
  • Electronic travel documents

GS1-128 (EAN-128)

^BC with FNC1

A variant of Code 128 that uses GS1 Application Identifiers (AI) to encode structured information such as expiration dates, lot numbers, weight and serial numbers. Activated by using the FNC1 character (>8) at the start of the data field. Mandatory in supply chains that follow the GS1 standard — required by major retailers like Walmart, Target and Amazon vendor programs.

Ejemplo de código:

^XA
^FO50,50^BY2
^BCN,100,Y,N,N
^FD>801034531200000111719112510ABC123^FS
^XZ

Casos de uso:

  • GS1-compliant supply chains (Walmart, Target)
  • Food product traceability
  • Pharmaceuticals (date + lot + serial)
  • Logistics with structured information

Interleaved 2 of 5

^B2

1D barcode that encodes only numeric digits in pairs (always an even number of digits). Very compact for pure numeric data. Each pair of digits is encoded by interleaving bars and spaces, reducing the space required. If you have an odd number of digits, prepend a leading zero. Widely used for carton-level shipping labels (ITF-14).

Ejemplo de código:

^XA
^FO50,50^BY2
^B2N,100,Y,N
^FD1234567890^FS
^XZ

Casos de uso:

  • Distribution and warehouse operations
  • Carton and pallet labels (ITF-14 standard)
  • Financial and banking sector
  • Shipping container identification codes

Barcode tips for ZPL

  • Always place ^BY BEFORE the barcode command to define module width, ratio and height
  • Use ^BY2 as the standard setting — ^BY1 may be difficult to scan, ^BY3 takes more space
  • Leave sufficient quiet zone: minimum 10 times the module width on each side of a 1D barcode
  • For QR codes, use magnification 5 as a starting point and adjust based on label size
  • Always enable the human-readable interpretation line (Y parameter) so the number is visible below the bars
  • Verify every barcode with a real scanner before production — the viewer helps but the scanner is the definitive test
  • For shipping and logistics (FedEx, UPS, USPS), Code 128 (^BC) is the universal standard — avoid Code 39 unless required
  • 2D codes (QR, DataMatrix) are ideal when you need to store more than 20 characters of data
  • On small labels, prefer DataMatrix or Aztec over QR — they are more compact for the same amount of data
  • If the barcode does not scan, first check ^BY (module width), then print darkness (~SD) and print speed (^PR)

Frequently asked questions about ZPL barcodes

Which barcode should I use for shipping labels?

Code 128 (^BC) is the worldwide standard for logistics and parcel shipping. It is the format used by Amazon, eBay, FedEx, UPS and USPS on their labels. Use ^BY2 for module width and enable human-readable interpretation with Y so the number is legible beneath the bars.

What is the difference between Code 128 and GS1-128?

GS1-128 is a variant of Code 128 that uses GS1 Application Identifiers (AI) to structure the data. While Code 128 encodes any text, GS1-128 uses prefixes like (01) for GTIN, (17) for expiration date, and (10) for lot number. It is activated with the >8 prefix in the ^BC data field and is required by major retailers such as Walmart, Target and Costco.

How do I control the size of a barcode in ZPL?

Use the ^BY command before the barcode. The first parameter (1-10) controls the module width (bar thickness), the second (2.0-3.0) the wide-to-narrow ratio, and the third the height. Example: ^BY2,3,100 creates bars 2 dots wide, ratio 3:1 and 100 dots tall.

Why is my barcode not scanning correctly?

The most common causes are: 1) ^BY too small (try ^BY2 or ^BY3), 2) incorrect print darkness (adjust with ~SD, recommended 15), 3) print speed too high (reduce with ^PR4), 4) insufficient quiet zone around the barcode, 5) wrong data format for the barcode type (e.g. EAN-13 requires exactly 12 digits).

When should I use a 2D code instead of a 1D code?

Use 2D codes (QR, DataMatrix, PDF417) when you need to store more than 20 characters, when label space is limited, or when you need error correction (damage tolerance). For short data like SKUs or serial numbers under 20 characters, 1D codes (Code 128) are more efficient and universally compatible with all scanners.

Do ZPL barcodes work on non-Zebra printers like Brother, DYMO or Rollo?

ZPL barcode commands are native to Zebra printers. To print on other brands (Brother, DYMO, Rollo, generic thermal printers), convert the ZPL to PDF using ZPLPDF. The barcodes are rendered at high resolution in the PDF and are fully scannable from any printer — no special drivers needed.

How do I add a QR code with a URL in ZPL?

Use ^BQ with the QA prefix for automatic detection: ^FO50,50 ^BQN,2,5 ^FDQA,https://yoururl.com^FS. The 2 indicates QR model (always use 2), and 5 is the magnification (adjust from 1 to 10 based on desired size). For mixed data use FDMM,A followed by the content.

Test your barcodes

Visualize and verify your ZPL barcodes with our free tools before printing.