← Code 128 Barcode Generator

Code 128 Barcode Generator: How to Make Scannable Labels Step by Step

Reviewed by the OnlineFree.app team · Updated

Key points

  • Code 128 encodes all 128 ASCII characters using code sets A, B and C plus a mod-103 check character.
  • The Code 128 Barcode Generator runs entirely in the browser and exports print-ready SVG or 2× PNG files.
  • Auto subset selection uses Code 128C for even-length numeric strings, cutting the module count roughly in half.
  • Umlauts and the euro sign cannot be encoded in Code 128; transliterate or switch to a 2D symbology.
  • Always print one test label at 100 percent scale and scan it before committing to a full run.

What is Code 128 and what does this generator output?

Code 128 is a variable-length linear barcode symbology that can encode all 128 ASCII characters and appends a mod-103 check character to every symbol. The Code 128 Barcode Generator turns a short ASCII string — an SKU, order number or asset ID — into a scannable SVG or PNG directly in the browser, with no signup, no upload and nothing to install.

The symbology works with three interchangeable code sets. Code 128A covers control characters, digits and uppercase letters; Code 128B covers the full printable ASCII range including lowercase; Code 128C encodes digit pairs, which roughly halves the symbol width for numeric-only data. Because the sets can be switched inside a single symbol, one barcode can hold mixed letters and digits efficiently — that density is why Code 128 replaced Code 39 on most shipping and shelving labels.

What you get out of the tool is deliberately plain: a live SVG preview with 10-module quiet zones on both sides, a symbol readout listing the chosen subset, encoded character count, mod-103 checksum value and total module count, plus SVG and PNG download buttons. It implements generic Code 128 symbology. It is not a GS1-128 application-identifier builder, so structured data such as (01) GTIN or (10) batch numbers has to be assembled by you or by your ERP before you paste it in.

How to generate a Code 128 barcode step by step

The whole flow lives on one screen: parameters on the left, a live preview on the right, downloads and the symbol readout underneath the bars. The layout is intentional — with five tunable values you want the preview visible while you adjust, so you converge in one pass instead of re-downloading files to check them.

Start by opening the generator and looking at the default data, ABC-1234, which is already rendered. Replace it with your own string; the bars redraw as you type. Leave the subset on Auto unless a legacy system demands otherwise. Set module width — the default 2 px per module is a sensible starting point — and bar height, which defaults to 60 px. Toggle the human-readable caption on if the label needs the text under the bars.

Before downloading, read the symbol info panel. It tells you which subset was chosen, how many characters were encoded, the mod-103 checksum value and the total number of modules. That checksum is the value a scanner uses to reject a misread symbol; comparing it across two runs confirms you exported the same barcode twice. Then download SVG for print work or PNG for screen and documents.

Which subset should you pick: Auto, A, B or C?

Leave the subset on Auto in almost every case. Auto picks the shortest legal encoding for the string you typed, using Code 128C when the data is digits only, Code 128B for text with lowercase or mixed characters, and switching between sets where that shortens the symbol.

The practical difference is size. A ten-digit order number such as 0045123456 uses five symbol characters in set C because each pair of digits fits one character, versus ten characters in set B — a saving of roughly 55 modules, or about 110 px at the default 2 px module width. On narrow label stock that saving is often the difference between fitting and not fitting.

Manual selection only matters in specific cases. Set C is valid for even-length digit strings only, so an odd-length number needs a leading zero or an Auto encoding that finishes the last digit in another set. Set A is useful for legacy fixed-width strings containing uppercase text and control characters. If your scanner setup is fine with Auto, changing subsets just adds a way to be wrong.

Module width, bar height and quiet zones

Module width is the width of one narrow bar, and it is the setting that most affects whether a printed label scans. The control accepts 1 to 6 px per module in 0.5 steps, and the SVG width scales live so you can see the symbol grow and shrink as you change it. Wider modules are more forgiving of cheap thermal printers and ink bleed; narrower modules keep long strings inside a small label.

The catch is that the SVG is sized in pixels, not millimetres. If your printer or layout program scales the file to fit, the physical module width shrinks with it and a symbol that scanned on screen can fail on paper. For GS1-128 labels the GS1 General Specifications give an X-dimension range of 0.250 mm to 1.016 mm, with 0.495 mm as the common general-distribution target — useful anchor points when deciding how wide to print.

Bar height runs from 20 to 200 px and defaults to 60 px, which is roughly 16 mm if the SVG prints at its natural 96 px-per-inch size. Quiet zones are not adjustable here and are not decoration: the generator reserves 10 modules of white space on each side, and clipping that margin with a label edge or a border is one of the most common reasons a technically correct barcode refuses to scan. Keep the margin, and let the printer handle the rest.

Common mistakes: umlauts, long strings and scaling

The fastest way to end up with a barcode that will not scan is to encode data the symbology cannot represent. Code 128 covers ASCII 0 to 127 only, so German umlauts such as ä, ö, ü and ß, the € symbol and typographic quotes are not available — they are simply rejected. Transliterate instead (Müller becomes Mueller or MUELLER), or move to a 2D symbology such as QR Code if the field genuinely needs UTF-8 text.

Length is the second trap. The tool warns once your string passes 48 characters and hard-caps at 80. Those limits are practical rather than theoretical: Code 128 has no fixed maximum, but every symbol character costs 11 modules, so an 80-character string is around 915 modules including start, checksum and stop — over 1,800 px wide at the default module width, which is far wider than typical label stock. Shorter data is always easier to scan.

Third, scaling. Pasting the PNG into a word processor and dragging it to 87 percent rounds the module edges into grey mush at the printer. Use the SVG when the barcode is going into a layout that will be resized, and export the PNG at native size for documents. For label headlines and captions, the Online Title Case Converter keeps repeated label text consistently formatted across a batch.

Verifying and printing barcode labels reliably

Scan before you print 500 labels. Generate the symbol, download the SVG, print one copy at 100 percent scale on your real label stock, and test it with the handheld scanner that will actually be used. A phone barcode app is a useful sanity check but reads far more forgivingly than a fixed-mount laser scanner, so a successful phone scan is not proof that a checkout lane will cope.

For anything going to a printer, keep the SVG as the source of truth. It is vector, so it stays crisp at any size, and it survives being placed into a label template without resampling. The PNG is a 2× canvas raster, perfectly fine for screen previews, packing slips and internal documents, but it should never be rescaled by a non-integer factor. If you must resize, regenerate at the new module width instead.

Finally, keep the data string and the checksum value alongside the label file. If a barcode is later re-created by someone else, comparing the mod-103 value tells you immediately whether it is the same symbol. The generator guarantees a correctly constructed Code 128 symbol; it cannot certify print quality, which is measured with a verifier. For that, or for anything else you need done in a browser without an account, OnlineFree.app keeps the other free tools in one place.

Frequently asked questions

Is the Code 128 Barcode Generator free, and does it upload my data?

Yes, it is free and there is no signup. The Code 128 Barcode Generator runs entirely in your browser: the string you type is encoded to SVG or PNG on your own device rather than sent to a server. That matters when the data field holds internal order numbers, asset IDs or customer references you would rather not paste into a third-party service.

How many characters can the Code 128 Barcode Generator encode?

It accepts up to 80 characters and warns once a string passes 48. The symbology itself has no fixed length limit; the ceiling is practical. Every character costs 11 modules, so long strings produce very wide symbols that may not fit your label stock. Shorter data is always easier for scanners to read.

Can I encode German umlauts or a euro sign in Code 128?

No. Code 128 represents ASCII 0 to 127 only, so ä, ö, ü, ß, € and typographic quotes cannot be encoded and will be rejected. Transliterate them instead — ae, oe, ue, ss — or use a QR code generator when the field needs full UTF-8 product names or addresses.

Which subset does Auto choose, and when should I override it?

Auto picks the encoding with the fewest modules: Code 128C for even-length digit-only data, where two digits fit one symbol character, and Code 128B for anything containing lowercase or mixed text. Override it only when a legacy system expects a specific subset. Remember that set C is valid for even-length numeric data only.

Why does my printed Code 128 barcode fail to scan?

The usual causes are print scaling that shrinks the module width, a clipped quiet zone, low contrast, or bars too short for the scanner to aim at. Print the SVG at 100 percent on the real label stock, leave the 10-module quiet zone intact, and measure the narrow bar — below roughly 0.25 mm printed, sizing is your problem.

References

Try Code 128 Barcode Generator free — no sign-up, works in your browser
Open the tool →

More free tools

Step-by-step guides in our blog & guides.

Random Word Combo Generator Life Counter For Mtg Pdf Excel Dönüştürücü Ücretsiz Gezginler حاسبة نهاية الخدمة للموظفين Markdown to JSON Converter Free Wifi Qr Code Generator USD to SAR Converter Best Online Currency Converter Password Generator Strong Word & Character Counter Online Free