Barcode Generator (Code 128)

Turn any text or number into a scannable Code 128 barcode and download it as a sharp PNG — free, in your browser, no watermark.

1,380 views

How It Works

Code 128 is a barcode standard built from 107 distinct bar-and-space width patterns, and it can switch between three internal character sets — called subsets A, B and C — mid-barcode to pack data as efficiently as possible. Subset C is the one that matters most for everyday use: it encodes digits two at a time instead of one at a time, compressing any pair of numeric digits into a single symbol. That is why a purely numeric input — a product code, an order number, an inventory ID — automatically produces a noticeably narrower, denser barcode than the same number of letters would, and why this generator switches to numeric mode on its own whenever the input is all digits, without you choosing anything.

Every Code 128 barcode also carries a mandatory Modulo-103 checksum character, computed from a weighted sum of every encoded character's value. A scanner recalculates that checksum on every read and rejects the scan if it does not match — this is what catches a smudged bar, a print defect or a partial scan before bad data ever reaches your inventory system, rather than silently accepting a misread. Concrete example: type the digits "48522300" and the generator automatically packs them in Subset C two digits at a time, computes and appends the checksum character, and renders a barcode roughly half the width of what the same eight characters would take if any letter were mixed in and Subset B had to be used instead.

On both sides of the actual bars, the generator adds a quiet zone — a blank margin with no printing in it. Scanners use that empty space to detect where the barcode starts and ends; a barcode cropped too tight, with printing running right up to the bars, is one of the most common reasons a technically correct barcode fails to scan.

What to Know

The full printable ASCII set is supported — letters, digits, spaces and punctuation — but accented or non-Latin characters (Turkish ı, ş, ğ and similar) are not part of the Code 128 character table at all. If a barcode needs to scan reliably on any handheld reader, keep the input to plain ASCII.

Code 128 is not the only linear barcode symbology in common use. Code 39 is an older, simpler alternative that is self-checking by design — each character's bar pattern is internally consistent enough that a single misread rarely produces another valid character, unlike Code 128, which relies on its checksum digit to catch errors after the fact. Code 39 marks its start and end with an asterisk (*) and uses wider bars, which makes it forgiving on low-quality printers, but the same width means a Code 39 barcode encoding identical data takes up roughly twice the label area and prints at a noticeably lower density than the Code 128 barcode this generator produces. Code 128 was chosen here precisely because its higher density and mandatory checksum suit compact labels and reliable high-volume scanning better than Code 39's simplicity does.

Any modern barcode app or camera-based scanner reads Code 128 without special configuration — it is one of the most widely supported symbologies in existence, used across shipping, logistics, ticketing and internal inventory labeling. Printing at 100% scale and keeping the white quiet-zone margins intact matters more for scan reliability than bar height or color choice.

Code 128 is not the right choice for retail point-of-sale products. Items scanned at a store checkout use EAN-13 or UPC, a completely different symbology built around centrally assigned product numbers, not an interchangeable alternative to Code 128 — printing an EAN-style number as a Code 128 barcode will not be recognized as that retail product at the till, even though the barcode itself scans perfectly.

Frequently Asked Questions

Which characters can I encode?

The full printable ASCII set — letters, digits, spaces and punctuation. Turkish/accented characters are not part of Code 128; use plain ASCII for anything that must scan.

Will phone apps scan it?

Yes — Code 128 is supported by every barcode app and camera scanner. Print at 100% scale and keep the white margins (quiet zone) intact.

Is this suitable for retail EAN/UPC codes?

Code 128 is for logistics, tickets and internal labeling. Retail products at the till use EAN-13/UPC, a different symbology with assigned numbers — printing an EAN as Code 128 will not scan as a retail product.

Why did my barcode come out narrower when I only typed numbers?

Code 128's Subset C packs two digits into a single symbol instead of one, so a purely numeric input is roughly half the width of the same character count mixed with letters. This happens automatically — there is nothing to configure.

What does the checksum character actually protect against?

It is a Modulo-103 check digit computed from every character in the barcode. A scanner recalculates it on every read and refuses the scan if the numbers do not match, catching print smudges, ink gaps or a partial scan before the wrong data reaches your system.

Comments

No comments yet — be the first to write one!

Similar Tools