Code128 Barcode Generator

Generate a scannable Code128 barcode from any text.

How to Use

Type any text, letters, numbers, dashes, or other standard symbols, into the value field. The Code128 barcode preview updates live as you type, ready to download as a PNG for shipping labels, inventory tags, or ID badges. The default example, SHIP-2024-88214, shows off exactly the kind of mixed letter-number-dash tracking identifier this format handles that fixed-digit formats like EAN or UPC simply can't.

What Makes Code128 Different

Where EAN-13 and UPC-A are locked to a fixed count of pure digits, Code128 encodes the full standard ASCII character range, uppercase and lowercase letters, all ten digits, and common punctuation and control characters, in any length and combination. This flexibility is why it's the go-to format whenever the value being encoded is a real-world identifier rather than a registered product number, a shipment tracking code, an internal SKU, an employee badge ID, or a serial number, none of which fit neatly into EAN or UPC's rigid digit-count structure. Code128 is also described as "high density," meaning it packs more information into less physical barcode width than many older formats, useful when label space is limited.

The Three Code Sets Behind Code128

Internally, Code128 actually has three character subsets, called Code Set A, B, and C, and a smart encoder can even switch between them within a single barcode to stay as compact as possible. Code Set B is the general-purpose subset most commonly used, covering both uppercase and lowercase letters plus punctuation, ideal for mixed alphanumeric values like this tool's default SHIP-2024-88214 example. Code Set A covers uppercase letters, digits, and additional control characters, occasionally used for machine-to-machine data rather than human-facing text. Code Set C is a special numeric-only mode that packs two digits into the space of a single character, roughly doubling data density for barcodes encoding long strings of pure digits. This tool's underlying library automatically picks the most efficient encoding for whatever text you enter, you don't need to choose a code set manually.

Built-in Error Detection

Like the numeric retail formats, Code128 includes its own checksum, calculated using a formula based on the position and value of every encoded character (a "Modulo 103" checksum), and appended automatically as part of the barcode's internal structure, distinct from the human-readable text printed underneath it. A scanner recalculates this checksum after reading the barcode and rejects a read that doesn't match, catching printing defects or scanning glitches the same way any barcode format's error detection does. This happens entirely inside the barcode's encoded bar pattern, you never see or need to think about it, unlike EAN/UPC where the check digit shows up as a visible extra digit in the printed number.

Common Use Cases

Shipping and courier tracking numbers are probably Code128's single most visible use, that long alphanumeric code on a package label is almost always Code128 under the hood. Warehouses and inventory systems use it for internal SKUs and bin locations, since it can encode a company's own existing naming conventions without needing to conform to an external numbering registry. Event ticketing and access badges frequently use Code128 for unique serial numbers, and many industries layer it into GS1-128 (see the FAQ below) for structured supply-chain data like batch numbers and expiry dates alongside a core identifier.

Common Mistakes

Assuming any value will encode successfully regardless of characters used is a common surprise, Code128 supports standard ASCII but not extended Unicode like accented letters or emoji, covered in the FAQ below, an unsupported character produces an error rather than a mangled result. Confusing plain Code128 with GS1-128 is another frequent mix-up in a supply-chain context specifically, if a trading partner or retailer requires GS1-128 formatted barcodes with proper Application Identifiers, a plain Code128 generated here won't automatically satisfy that requirement without the additional structure GS1-128 demands. Finally, packing an unnecessarily long string into the barcode when a shorter internal identifier would do makes for a wider, denser, harder-to-scan-quickly code, worth trimming down to just what's actually needed for lookup.

Frequently Asked Questions

What is Code128 used for?

Code128 is a flexible, high-density barcode format that encodes the full ASCII character set, letters, numbers, and symbols. It's widely used in shipping, logistics, and inventory systems where the encoded value isn't a fixed-length product number like UPC or EAN.

Why choose Code128 over EAN or UPC?

EAN and UPC are locked to specific digit-count product identifiers. Code128 accepts any text of any length, letters, numbers, dashes, and other symbols, making it the better choice for shipment tracking numbers, internal SKUs, or any alphanumeric identifier.

Is Code128 the same thing as GS1-128?

They're related but not identical. GS1-128 is a specific, structured application of Code128 used across shipping and supply-chain logistics, it adds a special leading function character and a system of standardized "Application Identifiers" (numeric prefixes marking a batch number, expiry date, quantity, and similar structured fields within the encoded string). This tool generates plain Code128, encoding exactly the text you type with no added structure, perfectly valid for internal tracking numbers and general labels, but not automatically compliant with the specific GS1-128 formatting supply-chain partners may require.

What is the maximum length of text I can encode?

Code128 doesn't impose as strict a hard limit as fixed-length formats like EAN or UPC, but there's a practical ceiling, longer input produces a wider, denser barcode image, and extremely long strings become progressively harder for a scanner to read reliably, especially at a small printed size. Keeping an encoded value to somewhere under a few dozen characters, like a typical tracking number or SKU, produces the most reliably scannable result.

Can I encode special characters like accented letters or emoji?

Code128 supports the standard ASCII character set, letters, numbers, common punctuation, and control characters, but not extended Unicode characters like accented letters (é, ñ) or emoji. If your value contains a character outside that supported range, generation will fail with an error rather than silently dropping or mangling the unsupported character.

Is my data sent anywhere when I generate this barcode?

No. The barcode is rendered entirely in your browser using the open-source JsBarcode library loaded from a CDN, the text you enter is never transmitted to a server, it exists only in your browser tab and inside the downloaded image once you save it.