BarcodeSheets

Code 128 Barcode Generator

Encode any text, numbers, or mixed data as a scannable Code 128 barcode — free, unlimited, and rendered entirely in your browser.

Unlimited — no caps SVG & print-res PNG free No account 100% in your browser

What Code 128 encodes

Code 128 is a high-density, general-purpose barcode symbology that can represent the full 128-character ASCII set — every uppercase and lowercase letter, every digit, standard punctuation, and even non-printing control characters. That range is what makes it the default choice whenever a barcode needs to carry more than a simple product number: order IDs, tracking numbers, serial numbers, warehouse location codes, or any alphanumeric string your existing system already uses. If you're not sure which symbology to pick and your data isn't a retail product number, Code 128 is almost always the safe default.

Character set, subsets, and length rules

Code 128 encodes data using three interchangeable character subsets. Subset A covers uppercase letters, digits, punctuation, and ASCII control codes. Subset B covers upper- and lowercase letters, digits, and punctuation — the subset used for most human-readable labels. Subset C is numeric-only, but it packs two digits into a single symbol character instead of one, which roughly halves the length of long numeric strings. A capable encoder switches between subsets automatically, mid-barcode, to keep the result as compact as possible for whatever you type.

Length limits

There's no official maximum length written into the specification — the practical limit comes from your label size and the scanner's depth of field, not from the symbology itself. Strings longer than about 20-30 characters start to get visibly wide, so leave enough label real estate for whatever you're encoding.

Check digit

Code 128 always includes a built-in checksum — a modulo-103 check character — but you never see or manage it yourself. It's calculated automatically as part of encoding and isn't one of the digits you type. That's different from GTIN-family formats like EAN-13 or UPC-A, where the check digit is a visible digit printed under the bars.

Where Code 128 is used

Code 128 turns up anywhere a barcode needs to carry arbitrary text rather than a fixed-format retail number: shipping and logistics labels (it's the base symbology behind GS1-128), inventory and asset tags, patient wristbands, event and conference badges, library cards, and internal SKU or lot-number labels. It's rarely the format read at a retail checkout scanner, where EAN-13 and UPC-A are what's expected — use Code 128 for anything that isn't a shelf product, and a dedicated retail symbology for anything that is.

Sizing and printing guidance

Code 128's minimum quiet zone — the clear, unprinted margin on either side of the bars — is 10 times the narrow bar width, known as the x-dimension. At a common x-dimension of 0.25 mm, that works out to roughly a 2.5 mm clear margin on each side. Crowding that margin with text, a border, or another barcode is one of the most common reasons a barcode that looks fine on screen fails to scan once printed.

Printing guidance

For labels a handheld or fixed scanner will read reliably, print at 300 dpi or higher — thermal-transfer and most laser printers handle this without issue, though cheap inkjet output can blur narrow bars enough to cause misreads. Avoid scaling a barcode down below about 80% of its designed size, and keep it pure black bars on a white or light background; low-contrast combinations (light gray on white, red on white) fail scanners even when they look fine to the eye.

Frequently asked questions

What is the difference between Code 128 and Code 39?

Code 128 is denser and supports the full ASCII character set, so the same data prints shorter; Code 39 is lower-density and supports a smaller 43-character set, but is easier for very old scanners and low-cost printers to read reliably. For new systems, Code 128 is usually the better default — see our Code 39 generator at /code-39 for the details.

Does Code 128 need a check digit?

Code 128 always includes a built-in checksum character, but it's computed automatically during encoding — you never type or manage it yourself, unlike EAN-13 or UPC-A where the check digit is one of the visible printed digits.

What data can a Code 128 barcode hold?

Any text made up of standard ASCII characters — letters (upper and lowercase), digits, punctuation, and spaces. That makes it suitable for order numbers, tracking codes, serial numbers, and any alphanumeric identifier, not just numeric product codes.

How long can a Code 128 barcode be?

There's no fixed maximum in the specification. In practice, length is limited by your label size and the scanner's read range — strings much longer than 20-30 characters get noticeably wide, so leave enough room on the label for what you're encoding.

Is Code 128 used at retail checkout?

Rarely as the primary symbology on shelf products — retail point-of-sale scanners expect EAN-13 or UPC-A. Code 128 (and its GS1-128 variant) is far more common on shipping labels, inventory tags, and internal tracking rather than the barcode printed on packaging itself.