Code 128 Barcode Generator

Type a part number, a lot or a bin and this Code 128 barcode generator draws the shortest barcode for it, shows every symbol and its check character, and sizes the bars to the dots your label printer prints.

  • Shortest code sets, or A, B or C
  • Check character worked out
  • Tab, Enter and FNC1
  • SVG, PDF, EPS and PNG

Code 128 Barcode Generator

Barcode

Letters, numbers and symbols (ASCII), up to 80 characters.

Insert
Code 128

Your barcode preview appears here.

Put on a label
  • Free for commercial use
  • No signup
  • No watermark
  • Runs in your browser

How this code is built

14 symbols · 176 modules with quiet zones

  • Start B104
  • P48
  • A33
  • C35
  • K43
  • -13
  • A33
  • I41
  • -13
  • Code C99
  • 2020
  • 2626
  • Check54
  • Stop106
  • Set A: capitals, digits, controls
  • Set B: capitals, lower case, digits
  • Set C: two digits a symbol

Width in each code set

Code setSymbolsWidth
Auto (shortest)in use142.29 in
Only set A152.43 in
Only set B152.43 in
Only set CNot for this data

The check character, worked out

SymbolCode setValueWeightValue × weight
Start BB1041104
PB48148
AB33266
CB353105
KB434172
-B13565
AB336198
IB417287
-B138104
Code CB999891
20C2010200
26C2611286

Sum 2526. 2526 mod 103 = 54: the check character is value 54.

Size

Module 0.33 mm (13 mil)

in

Style

Bar color
#
Background
#

Free for commercial use, with no sign-up and no watermark.

patterns, all in the value table below
107
A, B and C, mixed for the shortest code
3 sets
dpi: bars rounded to whole dots
203 to 600
SVG, PDF, EPS and 300+ dpi PNG
4 files

How to make a Code 128 barcode

Three steps take you from the data to a barcode that scans the first time.

Data to encode

LOT42{TAB}QTY12{CR}
Insert{TAB}{CR}{LF}{FNC1}

A Code 128 barcode generator that shows its work

Each barcode comes with the reasons behind it: which code set each part uses, what the check character adds up to and how the bars meet your printer.

  • Start B
  • S
  • K
  • U
  • -
  • Code C
  • 20
  • 26
  • 10
  • 31
  • Code B
  • -
  • A
  • Check 57
  • Stop
  • Set A: capitals, digits, controls
  • Set B: capitals, lower case, digits
  • Set C: two digits a symbol

Every code set, coloured

Under the preview, each symbol sits on the colour of its set: A, B or C. You see where the code switches to set C for a run of digits and back, and how many symbols that saves.

PACK in set B

SymbolValueWeightValue × weight
Start B1041104
P48148
A33266
C353105
K434172

Sum 495. 495 mod 103 = 83: the check character is value 83.

The check character, worked out

The table lists each symbol, its value, its weight and the product, then the sum and the sum mod 103. It updates as you type, with the same values the bars carry.

  • Start A
  • L
  • O
  • T
  • 4
  • 2
  • HT
  • Q
  • T
  • Y
  • 1
  • 2
  • CR
  • Check 67
  • Stop

A scanner set up as a keyboard types:

LOT42 ⇥ QTY12 ⏎

Tab, Enter and FNC1 that scan

A scanner set up as a keyboard types a Tab or an Enter from the code, so one scan fills a form. FNC1 ends a variable-length GS1 field. Each one is a button with a plain note.

Module chosen: 0.33 mm (13 mil)

Printer (dpi)Dots a moduleModule
203 dpi30.375 mm · 14.8 mil
300 dpi40.339 mm · 13.3 mil
600 dpi80.339 mm · 13.3 mil

Bars sized to your printer

Thermal label printers print in whole dots. Pick 203, 300 or 600 dpi and every module rounds to whole dots, so each bar prints at the same width; the module shows in millimeters and mils.

BIN-A01
BIN-A02
BIN-A03
BIN-A04
BIN-A05
BIN-A06

Every label its own number, all at one module width

A sheet of numbered labels

Put on a label sends your barcode to the label maker at the same module width. There it counts up or reads a list, one number to a label, on Letter or A4 label sheets.

(00)106141411234567897
  • Start C
  • FNC1
  • 00
  • 10
  • 61
  • 41
  • 41
  • 12
  • 34
  • 56
  • 78
  • 97
  • Check 34
  • Stop

GS1-128: FNC1 after the start, then (00) and the 18-digit SSCC

GS1-128 in the same place

Switch to GS1-128 for shipping labels: type application identifiers in brackets, the check digits and dates are checked, and FNC1 goes in after the start and between fields.

Code 128 barcode samples

Four Code 128 barcode samples drawn by this generator, each on the colours of its code sets, with its symbols and its check character.

Pack-AI-2026

Text in set B

15 symbols · Start B · check 58

Text: Pack-AI-2026

Capitals, lower case and digits in set B, one symbol a character.

0123456789

Digits packed in set C

8 symbols · Start C · check 73

Digits: 0123456789

Ten digits packed two to a symbol in set C: five data symbols.

PO-55871234-A

Letters and digits: B, then C, then B

14 symbols · Start B · check 34

Mixed: PO-55871234-A

Set B for the letters, set C for the eight digits, then B again.

sku-red-xl

Lower case in set B

13 symbols · Start B · check 98

Lower case: sku-red-xl

Lower case lives in set B, so this Code 128 never leaves it.

What is Code 128?

Code 128 is a linear barcode that holds all 128 ASCII characters: capitals, lower case, digits, punctuation and control characters. It is compact for its range, so warehouses, carriers, labs and factories use it wherever a code carries letters as well as numbers.

It reads left to right as a quiet zone, a start character, the data, a check character, a stop character and a second quiet zone. Every symbol is 11 modules wide, made of 3 bars and 3 spaces from 1 to 4 modules each; the stop is 13 modules with its final bar. The quiet zones are 10 modules each.

Because each symbol always takes 11 modules, the width of the barcode follows directly from the number of symbols and the module width you choose: this generator prints both.

Quiet zone
Start
Data
Check
Stop
Quiet zone

Each symbol is 11 modules wide, 3 bars and 3 spaces; the stop is 13

Code 128 code sets A, B and C

Code 128 has three code sets that share the same 107 patterns. Set A covers capitals, digits, punctuation and the control characters such as Tab and Enter. Set B covers capitals, lower case, digits and punctuation. Set C packs two digits into each symbol, 00 to 99.

A barcode can start in any set and switch with a Code A, Code B or Code C symbol, or Shift for one character between A and B. Set C pays off for a run of four or more digits at the start or end, and six or more in the middle. The example X00Y stays in set B in 7 symbols; 098x1234567y23 takes 16 symbols with set C for the middle digits.

Auto in this generator works out the shortest mix for your data every time, and the width table shows what holding a single set would cost.

X00Y7 symbols · 99 modules with quiet zones

  • Start B
  • X
  • 0
  • 0
  • Y
  • Check 56
  • Stop

098x1234567y2316 symbols · 198 modules with quiet zones

  • Start B
  • 0
  • 9
  • 8
  • x
  • 1
  • Code C
  • 23
  • 45
  • 67
  • Code B
  • y
  • 2
  • 3
  • Check 101
  • Stop
  • Set A: capitals, digits, controls
  • Set B: capitals, lower case, digits
  • Set C: two digits a symbol

How the Code 128 check character works

The check character is a weighted sum mod 103. Take the start character’s value, add each following symbol’s value times its position (the first symbol after the start is position 1), and divide by 103: the remainder is the value of the check character, printed just before the stop.

For PJJ123C in set A: start 103, then 48 × 1, 42 × 2, 42 × 3, 17 × 4, 18 × 5, 19 × 6 and 35 × 7 add up to 878, and 878 mod 103 is 54. The scanner does the same sum, and a code whose check character matches reads; that is how the symbology catches a misread bar.

The check character is part of the bars only. Scanners don’t send it, and the printed line under the barcode shows your data without it.

PJJ123C in set A

SymbolValueWeightValue × weight
Start A1031103
P48148
J42284
J423126
117468
218590
3196114
C357245

Sum 878. 878 mod 103 = 54: the check character is value 54.

The Code 128 value table

All 107 values with their meaning in sets A, B and C and their bar and space widths. Values 0 to 95 are characters in sets A and B, 0 to 99 are digit pairs in set C, 96 to 102 are function characters in sets A and B, and 100 to 102 in set C, 103 to 105 are the three starts and 106 is the stop.

Code 128 values 0 to 106 in sets A, B and C
ValueSet ASet BSet CBars and spaces
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

Code 128 and GS1-128

GS1-128 is Code 128 with GS1 rules: an FNC1 right after the start, then application identifiers such as (00) for an SSCC, (01) for a GTIN, (10) for a lot and (17) for an expiry date. A variable-length field with another field after it ends with an FNC1, which scanners pass on as the GS character.

GS1 sets the limits for logistics labels: at most 48 data characters, a symbol up to 165.10 mm wide with its quiet zones, and a module from 0.495 mm. For your own part numbers, bins and assets, plain Code 128 is the right choice; for cartons and pallets that travel between companies, choose GS1-128.

Size and print a Code 128 barcode

The module, the narrowest bar, sets the size of the whole barcode. 0.25 to 0.5 mm suits most labels; 0.33 mm is about 13 mil. Below 7.5 mil many scanners read the bars poorly, and the generator says so.

A thermal printer at 203 dpi prints dots of 0.125 mm, so a 0.33 mm module becomes 3 dots, 0.375 mm. Choosing the printer in the generator rounds the module to whole dots before you print, which keeps every bar the same width. Keep the 10-module quiet zone clear on both sides, and make the bars at least 6.35 mm tall, or 15 percent of the code’s length when that is more.

In Word or Excel, a Code 128 font needs its start, check and stop characters added by a formula. A PNG or SVG from this generator already has them: insert it like any picture, at 100 percent.

Modulemil203 dpi300 dpi600 dpi
0.25 mm9.82 dots · 0.25 mm3 dots · 0.254 mm6 dots · 0.254 mm
0.33 mm133 dots · 0.375 mm4 dots · 0.339 mm8 dots · 0.339 mm
0.5 mm19.74 dots · 0.5 mm6 dots · 0.508 mm12 dots · 0.508 mm

Rounded to whole dots, every bar prints at the same width. Keep 10 modules clear on each side.

Who uses this Code 128 barcode generator

Code 128 is the everyday barcode for anything that isn’t a retail product: parts, places, cartons and samples.

Shipping and receiving

Carton and pallet labels carry an SSCC in GS1-128, the shipping label standard between suppliers, carriers and stores.

Warehouses and stockrooms

Bin, shelf and location labels like BIN-A01-03 mix letters and digits, which Code 128 holds in few symbols.

Asset and tool tracking

Laptops, tools and fixtures get a barcode asset tag that any scanner and most phone apps read.

Labs and production

Sample tubes, batches and work orders take a barcode with the date and a serial, printed in rolls on thermal printers.

Code 128 barcode generator FAQ

What people ask before they print a Code 128.

Open the Code 128 barcode generator

Is this Code 128 barcode generator free?

Yes. Every Code 128 and GS1-128 barcode is free to make and download as SVG, PDF, EPS or PNG, for commercial use, with no sign-up and no watermark.

What can a Code 128 barcode hold?

All 128 ASCII characters: capitals, lower case, digits, punctuation and control characters like Tab and Enter, plus the FNC1 function character for GS1 data.

How long can a Code 128 barcode be?

The standard sets no fixed length; the width grows by 11 modules a character, or a pair of digits in set C, and your label sets the practical limit. GS1-128 allows 48 data characters.

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

They are the three code sets of one barcode. A has capitals, digits and control characters, B has capitals, lower case and digits, and C packs two digits into each symbol. Auto mixes them for the shortest code.

Does the scanner read the check character?

It checks it and leaves it out. The scanner works out the same weighted sum mod 103, and when it matches it sends only your data.

Can I see a Code 128 barcode sample before I print?

Yes: the preview is the real barcode at its real size, and the samples on this page show text, digits, a mix and lower case with their check characters.

Code 128 or GS1-128 for shipping labels?

Use GS1-128 for cartons and pallets that go to customers or carriers: it carries the SSCC and other application identifiers they read. Use Code 128 for your own bins, parts and assets.

What module width should my label printer use?

Pick your printer’s dpi in the generator and the module rounds to whole dots: 3 dots (0.375 mm) at 203 dpi for a 0.33 mm module. Keep it at 7.5 mil or wider for reliable scanning.

Can I make a sheet of numbered Code 128 labels?

Yes. Choose Put on a label and the label maker places the barcode at the same module width, counting up or reading your list, one number to a label on Letter or A4 sheets.

Make your Code 128 barcode now

Type your data, keep Auto for the shortest code and download a Code 128 barcode sized to your printer, with the check character shown.