Sign In
Products
ZPL ViewerBarcode GeneratorImage → ZPLZPL cheat sheetLabel DesignerTemplate Gallery
Developers
API QuickstartAPI ReferenceMCP ServerBulk GenerationWebhooksSDKs & ExamplesLimitsDirectPrint agent NewGitHub ActionVS Code extensionOn-Premise
Solutions
Logistics & ShippingE-CommerceERP & WMSManufacturingRetailHealthcare & LaboratoryAll solutions
Tools
ZPL Diagnostics HubZPL DebuggerSize & DPI AnalyzerDPI ConverterBarcode fit calculatorShipping Label AnalyzerFont InspectorOrientation DebuggerCalibration AssistantPrinter Compatibility CheckerBarcode Readability CheckerPrinter Language DetectorThermal Printer Test PackZPL ToolsEPL ToolsTSPL ToolsCPCL ToolsPrinter Language ConverterAll ToolsGuidesPricing
Language
EnglishTürkçeDeutsch
Home›Guides›ZPL text runs off the label edge (wrap it with ^FB)

ZPL text runs off the label edge (wrap it with ^FB)

Published: · Updated:

An address or product name is longer than you planned and the end of it is simply missing on the printed label, cut off at the right edge. Nothing is wrong with the printer: a plain ^FD field is one line of text, and ZPL does not wrap it for you.

The cause: a text field is a single line

A field made of ^FO, a font and ^FD starts at its origin and runs to the right for as long as the data lasts. Whatever passes the print width is not printed. This one is 58 characters at a 40-dot font, far wider than a 4-inch label:

^XA
^FO30,40^A0N,40,40
^FDShip to: Warehouse 7, Industriestrasse 114, 70565 Stuttgart^FS
^XZ

Open this label in the ZPL viewer →

The fix: put the field in a ^FB block

^FB (Field Block) formats the field into a block of text with automatic word wrap, using the origin, font and rotation of the field (Zebra guide, page 186). Its five parameters:

^XA
^FO30,40^A0N,40,40
^FB740,3,4,L,30
^FDShip to: Warehouse 7\&Industriestrasse 114, 70565 Stuttgart^FS
^XZ

Open this label in the ZPL viewer →

Two details in that example matter. \& inside the data is a forced line break (page 187) — ordinary CR/LF characters in the data are discarded, so pressing Enter in your template does nothing. And the 30-dot hanging indent moves every line after the first one inwards.

The surprise: extra lines overwrite the last one

If the text needs more lines than b allows, ZPL does not cut it off neatly. The guide is explicit: text exceeding the maximum number of lines overwrites the last line (page 186). The result is an unreadable smear on the final line. Either raise b, shorten the data, or use a smaller font; changing the font size also changes the block size, because the line height follows the font.

Other rules from the guide

Before you reach for ^FB: three fixes that keep one line

Wrapping is right for an address. For a product name that must stay on one line, three other things decide whether it fits, and each is a number you can check rather than guess.

  1. Narrow the font, not the text. The width parameter of ^A0 is independent of the height. In our renderer the 58-character line above measures 980 dots at ^A0N,40,40 and 735 dots at ^A0N,40,30 — the second one fits a 4-inch label (812 dots at 203 dpi) with the same 40-dot height. A 25 % narrower glyph is still legible on a shipping label; a smaller font often is not.
  2. Check what the printer thinks the width is. Text is clipped at the print width set by ^PW, not at the physical edge. A 4-inch label driven with ^PW600, or with a printer default left at a narrower media, loses the right 200 dots of every field. The size analyzer reads ^PW/^LL out of a format and tells you the physical size at each resolution.
  3. Move or rotate the field. A second ^FO with its own ^FD splits the data in the template — what ERP templates do when they cannot rely on ^FB — and ^FW rotates a long field along the label's long edge, where a 6-inch label offers 1218 dots instead of 812.

Two neighbouring symptoms have their own pages. If boxes and barcodes are missing on the right as well, not only text, the label itself is being cut off — see ZPL label cut off. If the text is complete but sits off-centre, see centering text in ZPL. The full parameter table for the block command is on the ^FB command page.

Check it before you print

Paste the format into the ZPL preview. The preview follows the rules above: \& breaks the line, a missing or too-narrow width prints nothing, and lines beyond b are drawn on top of the last line — the same smear the printer produces. The render API also returns a warning in the X-Warnings header saying how many lines the text needed. We have not verified these cases on a physical printer; the behaviour is what Zebra's programming guide documents.

If the symptom is something else, the ZPL troubleshooting triage maps what the printer did to its usual cause.

Sources

Frequently asked questions

Why does my ZPL text get cut off at the edge of the label?

A plain ^FD field is a single line and ZPL never wraps it. Whatever runs past the print width is not printed. Put the field in a ^FB block to wrap it.

How do I force a line break inside ZPL text?

Inside a ^FB block, \& in the data is a carriage return/line feed (Zebra guide, page 187). Ordinary CR/LF characters in the data are discarded.

Why does my ^FB text not print at all?

The ^FB width defaults to 0, and if it is missing or smaller than the font width the text does not print (page 186). Give the block an explicit width in dots.

What happens when the text needs more lines than ^FB allows?

It is not truncated: text exceeding the maximum number of lines overwrites the last line (page 186), which prints as an unreadable smear. Raise the line count or shorten the data.

Can I keep the text on one line instead of wrapping it?

Yes: make the font narrower, not smaller. ^A0 takes height and width separately; in our renderer a 58-character line needs 980 dots at ^A0N,40,40 but 735 dots at ^A0N,40,30, which fits a 4-inch label (812 dots at 203 dpi). Also check that ^PW matches the real label width.

Related guides

ZPL label content shifted

A layout that prints shifted has four suspects in the file — ^LH, ^LS, ^LT and the ^FO/^FT difference — before any sensor is to blame.

ZPL label cut off at the edge

A clipped ZPL label has two distinct causes: fields placed beyond ^PW/^LL, or a 300 DPI file on a 203 DPI printer. How to tell them apart and fix each.

ZPL label prints upside down

A rotated ZPL label has three switches: ^PO flips the whole label, ^FW sets the default for every field, and each ^A rotates one field. Find which one is set.

Zebra label prints too small

A 4x6 label printing at two-thirds size in the top-left corner is a 203-to-300 DPI mismatch. Confirm it, see why ^MU rarely helps, rescale the file.

Try your own ZPL code →