Skip to the tool
UPC Generator

Code 128 generator

Code 128 squeezes two digits into each symbol, so 12 digits take 9 symbols where Code 39 needs 14. Letters and numbers both fit, and the generator finds the shortest route through its three code sets for whatever you type.

2.287 in (58.08 mm) wide by 0.734 in (18.64 mm) tall, clear space included

Code 128 barcode BIN-A14-0072

Code 128 is for labels you run yourself: stock, bins, assets and paperwork. A store checkout will not treat it as a product number. Products for sale need a UPC or EAN with a number licensed through GS1. The route to a licensed number is in how to get a UPC code.

  • Narrow bar: 0.33 mm (13 mil)
  • Clear space: 0.13 in (3.3 mm) left, 0.13 in (3.3 mm) right at minimum
  • PNG at 300 dpi: 704 by 221 dots, narrow bar 4 dots, so it prints at 0.339 mm
More options
Show sizes in

Your text, symbol by symbol

Every symbol is eleven modules wide, and the stop pattern is thirteen. Pick one to see its bars.

B, value 34, code set B. Pattern 131123. Runs from module 11 to 22.

The route and the check character

Code 128 has three code sets, and the shortest barcode often switches between them. This is the route for your text, with the arithmetic scanners repeat to confirm a read.

By the UPC Generator team. All 107 bar patterns match the published table, the output matches a second encoder, and sample files are read back by decoding software. Last updated 4 November 2026. How UPC Generator pages are made.

Three code sets inside one barcode

Every symbol is a value from 0 to 102, and what that value means depends on the code set in force. Switching costs one extra symbol, so the shortest barcode depends on your text.

The three code sets inside Code 128
Code set Holds One symbol carries
A Capitals, digits, punctuation, control codes 1 character
B Capitals, lowercase, digits, punctuation 1 character
C Digit pairs from 00 to 99 2 digits

The number 123456789012 goes straight to set C and takes 6 data symbols. Add the start, check and stop and the whole thing is 101 modules, or 39.93 mm with clear space at a 0.33 mm narrow bar. Your text may need a mix. BIN-A14-0072 stays in set B for the letters, then switches to set C for the final 0072. The route table shows that switch when you type it.

The check character, worked through

A scanner adds up the symbols, each multiplied by its position, then divides by 103. The remainder must match the check character. Here is the published example for PJJ123C with Start A, which has value 103.

The check character for BIN-A14-0072, worked through
Symbol Value Position Product
Start A 103 1 103
P 48 1 48
J 42 2 84
J 42 3 126
1 17 4 68
2 18 5 90
3 19 6 114
C 35 7 245

The products total 878, and 878 divided by 103 leaves 54. This generator starts the same text in set B, whose start value is 104, so its total is 879 and its check value is 55. Both are valid. The route table for your own text uses the same steps.

Sizes and clear space

Code 128 has no single required size, because labels range from jewelry tags to pallet sheets. The standard asks for 10 modules of clear space on each side, and the file includes it. GS1 sets its own sizes only for GS1-128 in the supply chain.

Code 128 sizes and the width of the sample with its clear space
Narrow bar Good for BIN-A14-0072 with clear space
0.25 mm Small labels at 300 dpi or higher 1.73 in (44 mm)
0.33 mm Most stock and bin labels 2.29 in (58.08 mm)
0.508 mm Labels scanned from a distance 3.52 in (89.41 mm)

Height is your choice too. Taller bars give a hand scanner more room to be off level, and 15 mm is a comfortable start. Bars do not need to fill the label. Leaving white space around them does more good.

Tab and Enter after the scan

Adding a key press saves a step when you scan into a form. With Tab, each scan moves to the next field, and with Enter, the form submits by itself. The key goes in the barcode using set A's control codes, so it works with any scanner in keyboard mode. It does not print under the bars.

Where Code 128 fits

It suits your own labels because it is compact and holds both letters and digits. If you need a whole list of stock codes, the SKU generator builds them and draws each one in Code 128. If a system insists on the older format, use the Code 39 generator. Every other format, from UPC to Data Matrix, is in the barcode generator, and a product sold at a checkout gets its retail symbol from the UPC generator. ISO sells the Code 128 standard as a paid document. The open references listed at the end are the Wikipedia entry and the GS1 specification. Long text or small parts suit a Data Matrix code, which fits far more in less space. Cartons going out to customers usually need an ITF-14 or GS1-128.

Code 128 in Word and Excel

A plain barcode font cannot make a Code 128 label on its own. That is because the symbol ends in a computed check character and switches between three character sets. The guides to making a barcode in Excel and in Word explain what each program can do by itself. They also say when a file from this tool is the simpler route.

Code 128 questions

What can a Code 128 barcode hold?

All 128 ASCII characters: capitals, lowercase, digits, punctuation and control codes such as Tab. There is no set length, but each character adds width, so keep it to what fits your label. For long text, a Data Matrix holds the same characters in a far smaller square.

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

They are three tables inside one format. A has capitals and control codes, B has capitals and lowercase, and C packs two digits into one symbol. You do not need to choose, because the generator switches between them to make the barcode as short as it can.

What is the difference between Code 128 and Code 39?

Code 128 is shorter, holds lowercase without tricks, and has a required check character. Code 39 is older and needs no check character. The text BIN-A14-0072 takes 156 modules in Code 128 and 223 in Code 39. Use Code 39 only when a system asks for it.

How do I make the scanner press Tab or Enter?

Choose it under Key to press after the scan. The character goes inside the barcode. The scanner sends it like a keystroke, and the cursor moves to the next field or submits the form. It works without changing any scanner setting.

Is Code 128 the same as GS1-128?

GS1-128 is Code 128 with a special start and data written to GS1 rules. It is used for shipping labels with batch numbers and dates. A plain Code 128 from this generator is not a GS1-128.

How small can a Code 128 barcode be?

It depends on your printer and scanner. A 0.25 mm narrow bar prints well at 300 dpi and above, and 0.19 mm needs a good printer and a close scan. Print a test before you run a batch.

2 source documents

  1. Wikipedia: Code 128, symbol table and check character example, fetched 2 November 2026
  2. GS1: General Specifications, Release 26.0, section 5.4 on GS1-128, fetched 2 November 2026