🔒 100% private — runs in your browser, nothing is uploaded

Code 128 Barcode Generator

Turn any text or SKU into a scannable Code 128 barcode — drawn in your browser, downloadable as PNG or SVG.

Code 128 is the barcode you see where businesses label their own world: warehouse shelves, shipping cartons, asset tags, library books, internal SKUs. It packs the full ASCII set — letters, digits, punctuation — into a compact symbol, switches between code sets mid-barcode to squeeze long digit runs down, and protects the data with a modulo-103 checksum. Type your text above and this page encodes it properly: the start code, any code-set switches, the checksum character and the stop pattern are all worked out and drawn as real bars, ready to download as a PNG or an SVG.

Type the text for your label — a SKU, an asset number, any short reference. The barcode below is a real Code 128 symbol with the correct checksum, updated as you type, with the full symbol breakdown under it.

For internal and test labels only. A generated barcode does not license the number inside it — retail products need a GS1-licensed GTIN, normally printed as UPC-A or EAN-13.

⚠️ Generated barcodes are for internal and test use: warehouse and shelf labels, SKU and asset tags, samples, mock-ups and scanner testing. A Code 128 symbol is only an encoding — printing one does not license, register or assign the number inside it. Products sold through retail must carry a GTIN (UPC / EAN) licensed through your local GS1 member organisation, normally printed in the UPC-A or EAN-13 symbology, not Code 128. Verystep is not affiliated with or endorsed by GS1. GS1, GTIN, UPC and EAN are trademarks of GS1 AISBL and its member organisations. Encoding follows ISO/IEC 15417 (Code 128). Last verified: November 2026.

Quick answers

What is a Code 128 barcode used for?

Internal labelling: SKUs, warehouse shelves and bins, shipping cartons, asset tags, ID badges and sample or test labels — anywhere an organisation invents its own references and needs machines to read them reliably. It is not the symbology used for retail checkout barcodes, which are UPC-A and EAN-13 carrying licensed GTINs.

Code 128 earned its place by density and range: it encodes all 128 ASCII characters and, in Code C, two digits per symbol, so long numeric references stay short on the label. GS1-128 — the logistics variant with its own application-identifier rules — is built on Code 128, which is why the same bars show up on pallets and cartons throughout the supply chain.

How does the Code 128 checksum work?

Add the start code’s value to each following symbol’s value multiplied by its position (first symbol × 1, second × 2, and so on), then divide by 103. The remainder is the checksum symbol’s value, and it is printed as part of the barcode, just before the stop pattern.

For HELLO in Code B: start 104, then H 40×1, E 37×2, L 44×3, L 44×4, O 47×5 — a total of 761, and 761 mod 103 is 40, so the checksum symbol is value 40. Scanners repeat this arithmetic on every read and refuse the barcode if the remainder disagrees, which is why a damaged or misprinted Code 128 usually fails loudly instead of reading as a different, wrong code.

Which code set should I choose — A, B or C?

You do not have to: this generator chooses automatically. Code C for digit runs (two digits per symbol), Code B for ordinary mixed text with lower-case letters, Code A only when the text contains control characters. The symbol-by-symbol breakdown under your barcode shows exactly which sets were used and where it switched.

Manual choice matters mainly when another system dictates the encoding. Left automatic, the rule that shapes the result is simple: four or more digits in a row are worth a trip into Code C, and anything containing lower-case letters or characters above ASCII 95 must pass through Code B. Pure numbers of an even length are the ideal case — start in C and never switch.

How to use

  1. Type the text to encode — a SKU, an internal reference, a short label string. ASCII characters only.
  2. Pick a bar height for your label stock, then look at the preview and the symbol breakdown under it.
  3. Download the PNG for documents and label software, or the SVG when the barcode will be scaled or print-produced.
  4. Print one label and scan it with the actual scanner or phone app your team uses before printing a run — quiet zones and print quality decide real-world reads.

About this tool

The set switching is the part worth understanding, because it is where naive generators waste label space. Code C reads digits in pairs, so a 12-digit internal reference costs six symbols instead of twelve; Code B covers lower-case letters that Code A cannot reach; Code A exists for the top row of ASCII and control characters. This generator picks the start set from your text, switches to Code C for digit runs of four or more, and latches back afterwards. The breakdown under the barcode lists every symbol it used, so you can audit the encoding instead of trusting it.

One boundary matters more than any setting on this page: a barcode is a font for numbers, not a licence for them. This generator is for labels that live inside your own operation. The barcode on a product sold in shops is a different thing — a GTIN you license from GS1, usually printed as UPC-A or EAN-13 — and no generator, including this one, can issue you one. There is a companion validator on this site that checks the check digits of the codes you already have.

Everything runs in your browser. The text you encode is never uploaded, sent to a server or stored, and the barcode is drawn locally as vector shapes.

How it works

Encoding (ISO/IEC 15417): the text is converted to codeword values 0–102 in code sets A, B or C (in B and A, value = ASCII − 32 for printable characters; in C, each pair of digits is one value 0–99), preceded by a start code (103, 104 or 105) and followed by a checksum and the stop pattern (106). Code-set switches are codewords 99 (to C), 100 (to B) and 101 (to A) in the sets where they apply.

Checksum: checksum value = (start value + Σ symbol value × position) mod 103, positions counting from 1 for the first symbol after the start code. Each codeword is drawn as three bars and three spaces totalling 11 modules (the stop pattern takes 13), flanked by quiet zones of at least 10 modules that this generator always includes.

Worked examples

A warehouse SKU: WH-2049-BLUE: Mixed letters, digits and hyphens — the generator stays in Code B, where the four-digit run is short enough that a trip into Code C would cost as much in switch symbols as it saves.

A long numeric reference: 88412093745516: Fourteen digits, an even count, so the whole string rides in Code C: start C, seven pair symbols (88, 41, 20, 93, 74, 55, 16), checksum, stop — half the width of the same number in Code B.

Checking the checksum by hand: HELLO: Start B (104) + H 40×1 + E 37×2 + L 44×3 + L 44×4 + O 47×5 = 761; 761 mod 103 = 40. The breakdown under the generated barcode shows checksum value 40 — the same number your scanner will compute when it reads the label.

The three code sets, briefly

SetEncodesStart valueBest for
Code AASCII 0–95: digits, capitals, punctuation, control characters103Legacy systems and control characters
Code BASCII 32–127: digits, both letter cases, punctuation104Ordinary mixed text, most labels
Code CDigit pairs 00–99, two digits per symbol105Long numeric references

Every symbol also carries a modulo-103 checksum character before the stop pattern; switches between sets are symbols 99 (to C), 100 (to B) and 101 (to A).

Frequently asked questions

Will scanners actually read barcodes from this generator?

Yes — the output is a standards-shaped Code 128 symbol with correct patterns, checksum and quiet zones, and any ordinary 1D scanner, warehouse gun or phone scanning app should read it. Real-world reads still depend on print: keep the quiet zones clear, print at a size where the narrowest bar survives your printer, and test-scan the first label of every run.

Can I use this to make the barcode for a product I sell?

For internal labels, yes. For the retail barcode on the product itself, no — that barcode must carry a GTIN licensed to you through GS1 and is normally printed as UPC-A or EAN-13, not Code 128. Encoding your GTIN into Code 128 does not change its licensing, and retailers scan for the GTIN symbologies at checkout. The disclaimer at the top of this page states the boundary in full.

Why did my long number come out shorter than my text label?

Code C. In that set each symbol carries two digits, so numeric strings compress by nearly half. The generator switches into Code C automatically for digit runs of four or more, and back out for letters — the breakdown lists each switch so you can see where the saving happened.

What characters can Code 128 encode?

All 128 ASCII characters: digits, upper- and lower-case letters, punctuation, and the control characters (in Code A). Anything beyond ASCII — accented letters, CJK characters, emoji — has no Code 128 representation; this generator will tell you which character it cannot encode rather than silently dropping it. For text like that, a QR code is the right tool, and there is one on this site.

PNG or SVG — which should I download?

SVG for anything that will be resized or professionally printed: it is the exact bar geometry at any scale. PNG for pasting into documents, spreadsheets and most label software; it is rendered at a high resolution with the quiet zones included. Both carry the same encoding — the choice is about your workflow, not the data.

Is the text under the barcode part of the barcode?

No — the human-readable line is a courtesy for people, printed below the bars in the Code 128 convention. Scanners read only the bars. It is worth keeping on internal labels anyway: when a label is damaged, the printed text is how a person types the reference back in.

📦 Embed this tool on your site

<iframe src="https://verystep.com/embed/code-128-barcode-generator/" title="Code 128 Barcode Generator" width="100%" height="520" loading="lazy" style="border:0"></iframe>

Free to use. The embed shows a small "Powered by Verystep" link.

More free tools