Saltar al contenido

Code 39 barcodes in ZPL with ^B3

To print a Code 39 barcode in ZPL, set ^BY and use ^B3N: ^BY2,3,120^FO60,60^B3N,N,120,Y,N^FDOZ-0042^FS. Code 39 accepts digits, capital letters, space and - . $ / + %, and is wider than Code 128 for the same data.

Actualizado 2026-10-20 · Renderizados hechos con el motor de OpenZPL

Abrir en el visor

Generador

Generando…

Etiqueta de 4 × 2 pulgadas a 203 dpi. Una vista previa muestra cómo la impresora dibuja el código; confirme con un escáner antes de imprimir una serie.

The ^B3 command

ParámetroQué haceValores
^BY w, rModule width and wide-to-narrow ratio^BY2,3: 2 dots, ratio 3
^B3 oOrientaciónN, R, I, B
^B3 eMod-43 check digitY or N
^B3 hBar height, in dotsfor example 120
^B3 fPrint the human-readable lineY or N
^B3 gPrint that line above the barsY or N
Code 39 barcode for OZ-0042 with *OZ-0042* printed under it
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^BY2,3,120
^FO60,60^B3N,N,120,Y,N
^FDOZ-0042^FS
^XZ

The human-readable line shows the asterisks that start and stop every Code 39 symbol; they are not part of the data. The ratio changes the width: OZ-0042 measures 286 dots at ^BY2,3 and 232 dots at ^BY2,2.

^BY2,2: 232 dots

The same Code 39 with a wide-to-narrow ratio of 2, narrower
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^BY2,2,120
^FO60,60^B3N,N,120,Y,N
^FDOZ-0042^FS
^XZ

^BY2,3: 286 dots

Code 39 barcode for OZ-0042 with *OZ-0042* printed under it
etiqueta de 4 × 2 in a 203 dpi (8 dpmm) · 812 × 406 px · Abrir en el visor
^XA
^BY2,3,120
^FO60,60^B3N,N,120,Y,N
^FDOZ-0042^FS
^XZ

Datos válidos e inválidos

DatosResult in the OpenZPL engine
OZ-0042Válido
oz-0042Drawn as OZ-0042: lower case is printed as capitals
OZ_0042Not drawn: the API answers 400 Bad Request with ERROR: Code 39: invalid character '_'

If you need lower case or symbols such as _, use Code 128, which encodes all of ASCII in less space.

The mod-43 check digit (^B3N,Y,…) is not added by the OpenZPL engine yet: the code renders without it. If your scanner requires it, check the result on the printer; see compatibility.

Verifique un código de barras antes de imprimir una tanda

Una vista previa muestra cómo la impresora dibujará el código: anchos de barras, zona muerta y la línea legible por humanos. No prueba que cada escáner lo lea en su medio. Imprima una etiqueta a la densidad real y escáneela con el escáner que utiliza su cliente o transportista; para códigos de venta al por menor y logística, un verificador de códigos de barras califica la calidad de impresión.

Preguntas

Code 39 or Code 128?

Code 128 for new labels: it is shorter and takes any ASCII character. Code 39 stays where a customer or an older system requires it.

Why are there asterisks under my Code 39 barcode?

They are the start and stop characters, printed in the human-readable line by convention. Scanners don't return them.

Fuentes