Logistics & internal · any ASCII text

Code 128 barcode generator

Code 128 encodes anything you can type in ASCII — order numbers, SKUs, locations, serials. The generator picks the most compact combination of character sets for you and adds the checksum the standard requires.

Barcode

·

Letters, digits, punctuation and spaces are all encodable. Case is preserved.

Size
Appearance

Keep dark bars on a light background — scanners read contrast, not colour.

Preview

Your barcode appears here.

How it works

Three character sets, switched automatically

Code 128 has three modes. Set A covers uppercase letters, digits, punctuation and the ASCII control characters. Set B covers upper and lower case, digits and punctuation. Set C is the interesting one: it encodes pairs of digits in a single symbol character, so a purely numeric value takes about half the width it would in set B.

A symbol can switch between sets partway through, and getting those switches right is most of the work in a Code 128 encoder. This one starts in the set that suits the first characters, moves into set C whenever a run of digits is long enough to pay for the switch, and moves back out when letters appear. You do not need to think about it — but it explains why 1234567890123456 comes out visibly narrower than ABCDEFGHIJKLMNOP, even though both are sixteen characters.

Built in

The modulo-103 checksum

Every Code 128 symbol carries a checksum character calculated from the start character and the weighted values of everything that follows. It is mandatory, it is never shown in the human-readable text, and it is added silently here. Unlike an EAN check digit, it is not part of the data — a scanner uses it to validate the read and then discards it, so the value your system receives is exactly the value you typed.

Where it fits

What Code 128 is good for

  • Shipping labels. Carrier tracking numbers and SSCC-18 pallet licence plates are usually Code 128, often as GS1-128 with application identifiers.
  • Warehouse locations. Aisle-rack-shelf codes such as A12-04-C mix letters and digits, which rules out numeric-only symbologies.
  • Internal SKUs. If nobody outside your business scans it, you are free to encode whatever your system uses, at whatever length is convenient.
  • Work orders and asset tags. Anything you want scanned into a form field rather than typed by hand.

Where it does not fit is retail. A supermarket till expects EAN-13 or UPC-A, and a Code 128 symbol carrying the same digits will not be recognised as a product code.

Practical limits

Keeping the symbol readable

Code 128 has no fixed length, which is its strength and its trap. Every character adds eleven modules, so a forty-character value becomes a very wide symbol — wide enough that a fixed-position scanner may not see both ends in its field of view. As a rule of thumb, keep values under about twenty characters for handheld scanning, and consider a 2D format such as QR if you need to carry more.

Quiet zones for Code 128 are ten modules at each end, included in every download here. Bar height is a judgement call: taller symbols tolerate a sloppier scan angle, and a common convention is at least 15% of the symbol width, or 12–15 mm on a shipping label.

One more detail worth knowing: spaces are encodable and are preserved exactly, so a value with a trailing space will scan back with that space attached. If your inventory system trims whitespace and the barcode does not, you get mismatches that are maddening to debug. Check the value in the preview line before you print a run.

Questions

Frequently asked questions

What characters can Code 128 encode?

The whole ASCII range from 0 to 127: upper and lower case letters, digits, punctuation, spaces and control characters. Accented and non-Latin characters are not supported.

Why is my numeric barcode shorter than a text one?

Runs of digits are encoded two at a time in character set C, so numbers pack into roughly half the width of the same number of letters.

Do I need to add a check digit myself?

No. The modulo-103 checksum is calculated and inserted automatically, and it is not part of the data your scanner returns.

What is GS1-128 and can I make one here?

GS1-128 is Code 128 with structured application identifiers such as (01) for a GTIN. This tool encodes the raw text, so you can type the AI string yourself, but it does not add the FNC1 character that a full GS1-128 requires.

How long can a Code 128 barcode be?

The standard sets no hard limit, but width does. Keep it under about twenty characters for reliable handheld scanning; this tool caps input at eighty.

Is Code 128 better than Code 39?

For new work, almost always. It is denser, supports lower case, and includes a mandatory checksum. Code 39 is worth using only when old equipment demands it.