Home › Barcode Types › Code 128

Code 128 Barcode Generator

The all-round standard for inventory, shipping and asset labels. Free, unlimited and instant — with every professional option included.

Use an example — or type your own number or text above.

Your barcode preview will appear here.

Free for personal and commercial use. No watermark, no sign-up.
For razor-sharp printing, download the SVG — it scales to any size.

About Code 128 Barcodes

Code 128 is the world’s most versatile linear barcode. It encodes the full ASCII set — capital and small letters, numbers, punctuation and control characters — in a compact pattern, which is why it became the default choice for shipping labels, warehouse bins, asset tags and ID cards.

The History of Code 128

Code 128 was designed in 1981 by Computer Identics as a response to a simple problem: the barcodes of the 1970s could not store ordinary text. Code 39 handled only capitals and a few symbols, and retail codes handled only numbers. Warehouses, hospitals and shippers needed to print labels carrying part numbers, serial numbers and mixed text like “AB-2049-x”. Code 128 solved it by fitting the entire ASCII table into a barcode while keeping the pattern narrow. Through the late 1980s and 1990s it became the default symbology of logistics — first in North America, then worldwide — and when GS1 needed a carrier for shipping data, it built GS1-128 directly on top of Code 128. Today it is hard to find a warehouse, courier network or hospital that does not scan Code 128 every day.

How Code 128 Works

Every Code 128 symbol is built from characters drawn from three code sets. Set A carries capitals, numbers and control characters; set B carries the full printable range including small letters; set C is the clever one — it packs two digits into a single character, halving the length of long numbers. A smart encoder (including the one on this page) switches sets automatically: it starts in B for text, jumps to C for a run of digits, and returns to B afterwards. Each character is drawn as three bars and three spaces, and the symbol ends with a modulo-103 check digit that the encoder calculates from every preceding character, weighted by position. That check digit is why a damaged or misprinted Code 128 almost never reads as a wrong value — the scanner detects the error instead of guessing.

Code 128 — Key Facts

Code 128 Sizes and Printing Rules

A Code 128 label can be almost any size, because the data length varies. The narrowest bar (the X-dimension) should be at least 0.19 mm for office printing and 0.25 mm or more for labels that travel, get wet or are scanned at a distance. Leave a quiet zone of blank space on both sides equal to at least ten times the narrow bar width — this generator’s margin slider controls exactly that. For handheld scanning at arm’s length, a total symbol width of 35–60 mm with a height of 15–25 mm is comfortable. Height does not store data, but taller bars scan faster and forgive poor aim, so do not make warehouse labels too short.

Where Code 128 Is Used

In a warehouse, Code 128 labels identify every bin, shelf and pallet position, so a picker with a scanner can confirm a location in a second. Couriers print it on shipping labels next to the tracking number. Hospitals print it on wristbands and medication packaging, where the check digit protects against misreads. Manufacturers use it for serial numbers and work-in-progress tracking; IT departments stick it on laptops and servers as asset tags; and retailers use it internally for stockroom labels even though the shop floor uses EAN. The common thread is trust: a compact code, any text you like, and an error check on every scan.

Code 128 in Practice

One practical detail separates good Code 128 labels from bad ones: the data itself. Keep values short and consistent — a part number like “WDG-2049” scans and files better than a sentence. Use the same padding everywhere (ITEM-0001, not ITEM-1 mixed with ITEM-00001), avoid spaces where a dash will do, and decide once whether your system is case-sensitive. The Serial Numbers tab above exists precisely for this: it produces perfectly uniform series with fixed-length numbers, ready for a whole shelf of assets in one ZIP download.

How to Create a Code 128 Barcode

  1. Enter the content in the box above — the generator is already set to Code 128, with a working example filled in. Type or paste your own number or text.
  2. Adjust the style — bar width, height, quiet zone, colours, the text under the bars and its font. The preview updates as you change things.
  3. Download a print-ready PNG, a razor-sharp SVG, or a JPG — or switch to Serial Numbers / Bulk List above to create many at once.

Getting the Best Result from This Generator

Every option above the preview exists because a real labelling job needed it. Bar width sets the thickness of the narrowest bar — raise it for labels that travel far or are scanned at a distance, lower it only when space genuinely runs out. Barcode height does not change the data, but taller bars are dramatically easier to scan, especially handheld. The quiet zone slider controls the blank margin the scanner needs to find the symbol; the default suits most labels, and crowded artwork is the only reason to touch it. The text settings control the human-readable line under the bars — keep it on for anything people also read, and pick OCR-B for the classic machine-printed look. Colours should stay dark-on-light; the transparent background option is for placing the code over your own light artwork in a design program. Finally, the download size matters: SVG is a vector that stays perfect at any scale and is always the professional choice, while the 3x and 4x PNG options exist for software that cannot take vectors. Set the options once, watch the preview, and only then download.

Code 128 vs the Alternatives

Against Code 39, Code 128 wins on size, character set and error checking; Code 39 survives only where legacy equipment demands it. Against QR codes, Code 128 wins wherever a cheap laser scanner is used and wherever a human must also read the value printed under the bars. Against GS1-128 — its own child — plain Code 128 is the right choice when your data has no GS1 structure; the moment you must encode expiry dates or batch numbers for a trading partner, switch to the GS1-128 page of this generator.

Common Code 128 Mistakes to Avoid

Why a Code 128 Barcode Fails to Scan — Troubleshooting

When a freshly printed Code 128 refuses to scan, the cause is almost never the data — it is the physics of the print. Work through the usual suspects in order. Contrast: scanners see in shades of red light, so black bars on white are the gold standard; red, orange and metallic bars can be nearly invisible, and a dark background with light bars defeats most readers entirely. Quiet zone: the blank margin around the symbol is part of the code — if text, borders or the edge of the label crowd it, the scanner cannot find where the code starts. Size: a symbol shrunk below its sensible minimum merges its fine bars into grey mush; print bigger or simplify the data. Print quality: inkjet bleed, a worn thermal head and low-resolution images all fatten or break bars — print from the SVG, at 100% size, on the best printer setting. Damage and gloss: creases, lamination glare and curved surfaces each steal a slice of the symbol; matte labels placed flat scan best. The professional habit that prevents all of it: print one label, scan it with the actual device that will be used, in the actual lighting, before printing the batch.

A Short Code 128 Glossary

Five terms explain nearly everything about working with Code 128. The symbology is the language itself — the set of rules that turns data into bars and back; Code 128 is one symbology among the twenty-one on this site. The X-dimension is the width of the narrowest bar or space, and every other measurement — total size, quiet zone, print tolerance — is expressed as a multiple of it. The quiet zone is the blank margin at both ends of the symbol; scanners use it to recognise where the code begins, and stealing it is the most common cause of failure. A check digit is a final character calculated from all the others, letting the scanner prove the read is correct instead of merely plausible. And the human-readable line is the printed text beneath the bars — there for people, ignored by scanners, and worth keeping accurate because when a scan fails, a human types exactly what it says. Keep these five straight and the rest of this page — and any barcode specification you are handed — becomes easy reading.

Barcode Print Quality, Explained Simply

Professionals grade printed barcodes from A (excellent) to F (fail) with a device called a verifier, which measures contrast, bar accuracy and defects against the standard for the symbology. You do not need a verifier for everyday work, but the grades explain what “good” means: a Grade A symbol has crisp edges, bars within a hair of their intended widths, and strong contrast. Home and office printing usually lands at B or C — perfectly serviceable for internal labels, shelf edges and documents. Retail packaging and supply-chain labels are held to higher bars because they must scan first time, every time, on equipment you do not control. The practical translation: generate from a proper encoder (as this page does), print from vector artwork, keep contrast absolute, respect the quiet zone, and test-scan. Follow those five rules and your Code 128 labels will behave like professionally produced ones, because the difference was never the price of the software — it is the discipline of the print.

Code 128 — Questions & Answers

Why is Code 128 better than Code 39?

Code 128 is far more compact, supports small letters and symbols, and has a mandatory error-check digit. Code 39 survives mainly where old systems demand it. For any new label, Code 128 is the safer choice.

What is the maximum length of a Code 128 barcode?

There is no strict character limit in the symbology, but practical labels stay under about 40–50 characters: beyond that the symbol becomes very wide and hard to scan in one pass. If your data is longer, a QR Code or Data Matrix holds it in far less space.

Is this Code 128 generator free?

Yes — completely free and unlimited. Create as many barcodes as you like and download them as PNG, SVG or JPG with no watermark and no sign-up. Everything is generated in your browser; nothing is uploaded.

How do I print my Code 128 barcode correctly?

Download the SVG for perfectly sharp printing at any size, or a PNG at Print quality (3x) or higher. Keep the quiet zone (the empty margin) around the code, print a test copy, and scan it with a phone or scanner before a big print run.

Can I make many Code 128 barcodes at once?

Yes — the Serial Numbers tab on this page generates a running series, and the Bulk List tab turns a pasted list (one value per line) into barcodes you can download together as a ZIP file or print as a sheet.

More Barcode Generators

EAN-13 GeneratorUPC-A GeneratorCode 39 GeneratorQR Code GeneratorEAN-8 GeneratorUPC-E GeneratorISBN-13 GeneratorISSN Generator