Skip to content

Code 128 barcode generator

Type anything printable and get a scannable Code 128 symbol. This is the format to pick whenever the barcode is for your own system rather than a retail till.

Generate a Code 128 barcode

#000000
#ffffff

SVG shape mask (decorative)

Upload an SVG — the barcode is clipped to its shape. A horse SVG makes a horse-shaped barcode.

Live preview

Code 128 is the general-purpose linear barcode. It covers the whole 128-character ASCII set — upper and lower case letters, digits, punctuation and the control characters — which is why almost every shipping label, warehouse bin card and asset tag you will ever print uses it. Unlike EAN or UPC, nobody allocates Code 128 numbers: you decide what the symbol says, and it means whatever your own system decides it means.

Its density comes from three interchangeable character sets. Code set A (Code 128A) carries upper case and control characters, code set B (Code 128B) upper and lower case and punctuation, and code set C (Code 128C) packs two digits into a single symbol character. A good encoder switches between them part-way through a symbol, so a long run of digits ends up about half the width it would need in any other linear format. bwip-js, which draws the preview above, chooses the code sets for you.

The variant you meet in logistics is GS1-128, once called UCC/EAN-128: the same symbology with an FNC1 character in front and GS1 Application Identifiers structuring the payload, so a scanner can tell a batch number from an expiry date. If a carrier has sent you an SSCC label specification, GS1-128 is what they are asking for.

What Code 128 encodes

Character set All 128 ASCII characters, via code sets A, B and C
Length Variable — no limit in the standard, bounded in practice by label width
Check character Modulo 103, computed automatically, not shown in the human-readable line
Dimensions Linear (1D)
Quiet zone 10 × the narrow-bar width on each side
Standard ISO/IEC 15417

Code 128 character set: code sets A, B and C

Every Code 128 symbol character has a value from 0 to 106 and is drawn as three bars and three spaces, eleven modules wide in total; only the stop pattern has a fourth bar and is thirteen modules wide. What a value means depends on the code set in force. The start character — Start A, Start B or Start C — selects the first set, the Code A, Code B and Code C characters switch sets part-way through, and Shift changes between A and B for the next character only.

Code 128A covers upper-case letters, digits, punctuation and the ASCII control characters NUL to US. Code 128B covers the printable range from space to tilde, including lower case, and is where most text starts. Code 128C encodes the pairs 00 to 99 as single characters, which is why a long even-length number comes out at half the width. FNC1 directly after the start character marks a GS1-128 symbol; FNC2, FNC3 and FNC4 are for message appending, reader programming and extended ASCII, and are rarely needed.

The check character is the start value plus each data value multiplied by its position, taken modulo 103. You never have to work it out, or choose a code set: this generator does both. The table is for reading a symbol by hand, checking another encoder, or building a font.

Code 128 values 0–106 in code sets A, B and C, with the widths of bar, space, bar, space, bar, space in modules; the stop pattern adds a final two-module bar. SP is the space character.
ValueCode ACode BCode CWidths
0SPSP00212222
1!!01222122
2""02222221
3##03121223
4$$04121322
5%%05131222
6&&06122213
7''07122312
8((08132212
9))09221213
10**10221312
11++11231212
12,,12112232
13--13122132
14..14122231
15//15113222
160016123122
171117123221
182218223211
193319221132
204420221231
215521213212
226622223112
237723312131
248824311222
259925321122
26::26321221
27;;27312212
28<<28322112
29==29322211
30>>30212123
31??31212321
32@@32232121
33AA33111323
34BB34131123
35CC35131321
36DD36112313
37EE37132113
38FF38132311
39GG39211313
40HH40231113
41II41231311
42JJ42112133
43KK43112331
44LL44132131
45MM45113123
46NN46113321
47OO47133121
48PP48313121
49QQ49211331
50RR50231131
51SS51213113
52TT52213311
53UU53213131
54VV54311123
55WW55311321
56XX56331121
57YY57312113
58ZZ58312311
59[[59332111
60\\60314111
61]]61221411
62^^62431111
63__63111224
64NUL`64111422
65SOHa65121124
66STXb66121421
67ETXc67141122
68EOTd68141221
69ENQe69112214
70ACKf70112412
71BELg71122114
72BSh72122411
73HTi73142112
74LFj74142211
75VTk75241211
76FFl76221114
77CRm77413111
78SOn78241112
79SIo79134111
80DLEp80111242
81DC1q81121142
82DC2r82121241
83DC3s83114212
84DC4t84124112
85NAKu85124211
86SYNv86411212
87ETBw87421112
88CANx88421211
89EMy89212141
90SUBz90214121
91ESC{91412121
92FS|92111143
93GS}93111341
94RS~94131141
95USDEL95114113
96FNC3FNC396114311
97FNC2FNC297411113
98Shift BShift A98411311
99Code CCode C99113141
100Code BFNC4Code B114131
101FNC4Code ACode A311141
102FNC1FNC1FNC1411131
103Start AStart AStart A211412
104Start BStart BStart B211214
105Start CStart CStart C211232
106StopStopStop2331112

Where Code 128 is actually used

Parcel and pallet labels

Carrier labels, SSCC serial shipping container codes and GS1-128 data blocks are all Code 128 underneath.

Warehouse and inventory

Bin locations, pick lists and stock movements — anywhere you own both the printer and the scanner.

Asset tags

IT hardware, tools and lab equipment, usually carrying an alphanumeric asset number.

Healthcare

Wristbands, specimen labels and medication trolleys, often as GS1-128 with an AI-structured payload.

Rules this Code 128 generator enforces

  • Only printable ASCII survives a round trip through most scanners. Accented characters and anything outside ASCII will either be rejected or come back as mojibake.
  • The check character is calculated for you — do not append one yourself.
  • Spaces are legal but easy to lose when a value is retyped by hand; hyphens or underscores are safer separators.
  • Long values make very wide symbols. Past roughly 20 characters, Data Matrix or PDF417 will fit the same data in far less space.

Printing a Code 128 symbol that scans

Code 128 is decoded by measuring the ratio between wide and narrow bars, so anything that thickens or thins the bars unevenly breaks it. Print black on white, export SVG when the label goes to a professional printer, and never stretch the symbol horizontally to make it fill a box in your layout.

Keep the quiet zone. Ten narrow-bar widths of blank space on each side is part of the symbology rather than decoration, and cropping it is the single most common reason a technically correct label refuses to read.

Code 128 questions

Do I need to register a Code 128 number with anyone?

No. Code 128 carries whatever text you put in it. Registration only applies to retail article numbers — EAN-13 and UPC-A — which are allocated by GS1.

What is the difference between Code 128 and GS1-128?

GS1-128 is Code 128 with rules on top: an FNC1 character at the start and GS1 Application Identifiers labelling each field. The bars are identical; only the agreed meaning of the data differs.

How long can a Code 128 barcode be?

The symbology sets no limit, but every character adds roughly 11 modules of width. A 30-character value on a standard thermal printer is already wider than a 100 mm label.

What is the difference between Code 128A, 128B and 128C?

They are the three code sets of the same symbology, not separate barcodes. A adds control characters to upper case, B covers printable ASCII including lower case, and C packs digit pairs 00–99 into one character. One symbol can switch between them, and the scanner returns the same text whichever was used.

Can I force Code 128B or Code 128C?

Not in this generator, and there is rarely a reason to. The encoder chooses the start set and any switches for you. Set C only encodes pairs of digits, so an odd-length number always has one digit encoded in set A or B.

Does this generator make GS1-128 (EAN-128) barcodes?

No. It draws plain Code 128 and does not insert the FNC1 character that marks a GS1-128 symbol, so typing Application Identifiers in brackets will not produce a valid GS1-128 label. Use GS1-aware labelling software for SSCC and batch or expiry labels.

Other barcode formats