Code 128 Barcode Generator
Create Code 128 barcodes (auto, 128A, 128B, 128C) and GS1-128 labels from AI syntax with check-digit validation. Download PNG or SVG.
Code 128 packs every ASCII character into a compact linear barcode, which is why it appears on shipping labels, inventory and asset tags and lab samples. This generator picks the shortest mix of code sets automatically or lets you force 128A, 128B or 128C, and it builds GS1-128 (formerly UCC/EAN-128) labels from AI syntax, checking lengths, characters and check digits. The barcode is drawn in your browser.
How to use this tool
- Enter the data. For GS1-128, write each Application Identifier in brackets, e.g. (01)09506000134352(17)261231(10)ABC123.
- Choose the mode — Auto gives the shortest barcode for almost any data.
- Set the bar (module) width, the bar height and whether the text is printed.
- Download a PNG for labels and screens, or an SVG for print artwork.
Formula
check value = (start value + Σ position × character value) mod 103 · width = 11 × characters + 2 modules
Every symbol character is 11 modules wide and the stop pattern 13, so a symbol with n characters (start, data, check and stop) is 11n + 2 modules, plus a quiet zone of at least 10 modules on each side. Set C stores two digits per character, so runs of four or more digits are switched into C. A GS1-128 symbol starts with FNC1, and an FNC1 separator follows every variable-length field except the last; predefined-length AIs such as (01), (11)–(17) and (31nn) need none.
Example
ABC-123456 in Auto mode starts in set B for “ABC-”, switches to set C and stores 12, 34 and 56 as three characters: start + 4 + Code C + 3 + check + stop = 11 characters, 123 modules wide (143 with quiet zones), or 246 px of bars at 2 px per module. In GS1 mode, (01)09506000134352(17)261231 — GS1’s sample GTIN with an expiry date of 31 December 2026 — is 24 digits that all fit set C: start, FNC1, 12 digit pairs, check and stop make 16 characters.
Frequently asked questions
What is the difference between 128A, 128B and 128C?
A covers uppercase letters, digits, punctuation and control characters; B covers upper- and lowercase letters, digits and punctuation; C encodes the digit pairs 00–99, halving the width of long numbers. Auto switches between them for the shortest result.
Can Code 128 hold accented letters or Korean?
Not reliably — it is limited to ASCII. Use a QR code or Data Matrix for other scripts.
Why is my GS1-128 data rejected?
Each AI is checked for its length and allowed characters, dates must be valid YYMMDD, and the mod-10 check digit of (00), (01), (02), (402) and (410)–(416) must match. A wrong check digit usually means a typing error.
How big should I print it?
Keep the narrowest bar at least about 0.25 mm for office printers and scan a test print. GS1 logistics labels use larger modules (about 0.5 mm) and bars roughly 32 mm tall; use SVG to scale exactly.
Sources
Last updated: 2026-10-30