^BY Bar Code Field Default
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.
^BYw,r,h
^BY parameters
| Parameter | Meaning | Accepted values | Default |
|---|---|---|---|
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.
|
|
2The 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). |
|
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 |
10The guide calls this the initial value at power up. |
^BY notes and gotchas
-
Interaction
Several barcode commands take their own height from
pp. 68, 70, 79, 94, 109, 142, 144^BYwhen their h parameter is left out:^BC,^B2,^B3,^BE,^BUand^B7.^BXuses the^BYheight only as an approximate symbol height when its own h parameter is zero or omitted. - Interaction
-
Note
pp. 148, 149^BYcan be used as often as needed in a label format. Once a^BYhas been received it stays in effect until the next^BY. -
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
pp. 148, 1587, 1588^BYpage. Among the commands documented in this set,^B2and^B3accept 2.0 to 3.0 and the rest are listed as fixed. -
Guide issue
The
p. 148^BYpage'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. -
Guide issue
The
pp. 82, 148^BYentry gives 1 to 10 for the module width, while the^B7entry 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^BYentry also gives h as an initial value with no range, and the only stated range (1 to 32000) is in the^B7entry.
^BY example
^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.