^BY Bar Code Field Default

Barcodes ZPL caret command

Sets the module width, the wide-to-narrow bar ratio and the bar height that later barcode commands fall back on, until the next ^BY is received.

Format ^BYw,r,h

^BY parameters

Parameters of ^BY
ParameterMeaningAccepted valuesDefault
wmodule width (in dots)pp. 82, 148

Width, in dots, of the narrow bar (the module) used by the barcode commands that follow.

The ^B7 entry lists 2 to 10 for the module width when ^BY is used with PDF417 (p. 82); see the guide-issue note on this record.

1 to 10 dots

2

The guide calls this the initial value at power up.

rwide bar to narrow bar width ratiop. 148

Target ratio between the width of a wide bar and the width of a narrow bar.

No effect on barcodes that have a fixed ratio. The ratio actually produced depends on the module width, because the printer works in whole dots. The guide gives a table of the resulting ratios for every ratio from 2.0 to 3.0 at every module width from 1 to 10 dots; in that table a module width of 1 dot gives 2:1 for every ratio below 3.0 and 3:1 for 3.0, and 2.0 and 3.0 give exactly 2:1 and 3:1 at every module width. The guide's worked example (module width 9, ratio 2.4) multiplies the module width by the ratio, gets 21.6 dots and says the printer rounds to the nearest dot, printing 22, so the printed ratio can differ slightly from the one selected. The example is the only place the guide describes the rounding (see the guide-issue note).

2 to 3 in steps of 0.1

3.0
hbar code height (in dots)pp. 82, 148

Default height, in dots, of the bars for barcode commands that are sent without their own height.

The guide says w and h can be changed at any time with ^BY, whichever barcode symbology is used.

The ^BY entry states no range for h. The ^B7 entry gives 1 to 32000 for the ^BY height in the context of PDF417 (p. 82).

10

The guide calls this the initial value at power up.

^BY notes and gotchas

  • Interaction

    Several barcode commands take their own height from ^BY when their h parameter is left out: ^BC, ^B2, ^B3, ^BE, ^BU and ^B7. ^BX uses the ^BY height only as an approximate symbol height when its own h parameter is zero or omitted.

    pp. 68, 70, 79, 94, 109, 142, 144
  • Interaction

    Not every barcode reacts to every ^BY value. ^BD is not affected by ^BY at all. For ^BX the module width and ratio have no effect and only the height is used. For ^B7 the ratio is fixed at 3 and has no effect. The ^BQ, ^B0 and ^BO entries do not mention ^BY.

    pp. 64, 82, 106, 124, 128, 146
  • Note

    ^BY can be used as often as needed in a label format. Once a ^BY has been received it stays in effect until the next ^BY.

    pp. 148, 149
  • Note

    The guide's barcode table (Table 34) marks which barcode commands have a fixed ratio and which accept 2.0 to 3.0, and refers back to the ratio table on the ^BY page. Among the commands documented in this set, ^B2 and ^B3 accept 2.0 to 3.0 and the rest are listed as fixed.

    pp. 148, 1587, 1588
  • Guide issue

    The ^BY page's worked example (module width 9, ratio 2.4) says the wide bar of 21.6 dots is printed as 22 dots, a ratio of 2.44, but the ratio table on the same page reads 2.3:1 for ratio 2.4 at module width 9. Other cells do not follow the rounding the example describes either: ratio 2.9 at module width 3 would be 8.7 dots, which rounds to 9 (3:1), yet the table reads 2.6:1. The guide does not explain the differences, so treat the table values as the guide's printed figures rather than something to compute from.

    p. 148
  • Guide issue

    The ^BY entry gives 1 to 10 for the module width, while the ^B7 entry lists 2 to 10 (default 2) for the module width under ^BY. The guide does not say how a module width of 1 behaves with ^B7. The ^BY entry also gives h as an initial value with no range, and the only stated range (1 to 32000) is in the ^B7 entry.

    pp. 82, 148

^BY example

example.zplZPL
^XA
^BY3,2.5,90
^FO40,40^B3N,N,,Y,N^FDPART4471^FS
^XZ

^BY sets a 3-dot module, a 2.5 ratio and a default bar height of 90 dots. The Code 39 command that follows leaves its height parameter empty, so the 90-dot default from ^BY applies to it.

Guides that use ^BY

BarcoderX is a .NET SDK for thermal labels and barcodes. See the barcode types it covers.

Source Zebra, ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide, P1134473-11EN Rev A, 2026/07/05, pages 64, 68, 70, 79, 82, 94, 106, 109, 124, 128, 142, 144, 146, 148, 149, 1587, 1588.

Written by BarcoderX in its own words. Checked against the guide on 2026-11-14.

ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.