Code 128 Barcode Generator

Create scannable Code 128 barcodes from text or numbers in your browser.

Free Code 128 barcode generator. Turn any text or number into a scannable, spec-correct Code 128 barcode with an automatic mod-103 check digit, then download it as a PNG. Everything is generated locally in your browser. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What encoding does this use?

It produces a spec-correct Code 128 barcode following ISO/IEC 15417. It auto-selects Code Set C for runs of four or more even-length digits (two digits per symbol) and Code Set B otherwise, then appends a weighted modulo-103 check digit and the stop pattern.

Code 128 barcode generator

Turn any text or number into a scannable Code 128 barcode and download it as a PNG. Code 128 is the high-density linear barcode used on shipping labels, retail packaging, asset tags and internal documents because it encodes the full set of ASCII characters in a compact space.

How it works

The generator follows the ISO/IEC 15417 specification. Each symbol is a value 0–106 drawn as six elements (three bars and three spaces) whose widths sum to 11 modules. The barcode is built as [START] [data] [CHECK] [STOP]. The tool automatically picks Code Set C for runs of four or more even-length digits — packing two digits per symbol — and Code Set B for letters and mixed text. It then computes the weighted modulo-103 check digit (start value plus each symbol value times its position, mod 103) and appends the 13-module stop pattern. Quiet zones are added on both sides so scanners can lock on.

Code sets explained

Code 128 has three code sets that can be used independently or mixed in the same barcode:

  • Code Set A: encodes uppercase letters, digits, and ASCII control characters (useful for GS1 Application Identifiers that include FNC1).
  • Code Set B: encodes the full printable ASCII character set, one character per symbol — most text-based barcodes use this set.
  • Code Set C: encodes pairs of digits as a single symbol, halving the barcode length for long numeric strings. A 12-digit number becomes 6 symbols instead of 12.

This generator automatically selects Code Set B for general text and switches to Code Set C for long numeric runs to produce the shortest possible barcode.

Practical example

ContentCode set chosenSymbols needed
INV-2048B8 data symbols
40700123C4 data symbols (pairs: 40, 70, 01, 23)
Box AB5 data symbols

Encoding ABC123 produces a Start B symbol, then A, B, C, then the mod-103 check symbol and the stop bars. The result scans back to exactly ABC123 on any compliant barcode reader.

Printing guidance

For reliable scanning, keep a few things in mind:

  • Minimum module width: print at 2 pixels per module or larger. At very small sizes (1px module), some scanners cannot resolve the narrow bars from the spaces.
  • Quiet zones: leave at least 10 modules of blank white space on both the left and right sides of the barcode. The generator adds quiet zones automatically, so do not crop the PNG too tightly.
  • High contrast: black bars on white background is the safest choice. Dark bars on a coloured background can confuse laser scanners.
  • Scanning distance: wider barcodes with larger module widths can be read from greater distances, which matters for warehouse shelf scanning.

Common uses for Code 128

Code 128 is the required symbology for many shipping standards. GS1-128 (formerly UCC/EAN-128) is a specific application of Code 128 used by retailers and logistics carriers to encode shipping container data, expiry dates, lot numbers, and weight in a structured format. If you are printing labels for Amazon FBA, FedEx, or UPS, your carrier’s label spec will likely specify Code 128 or GS1-128 for the tracking number.

Everything is rendered locally on a canvas — your text and the generated image are never uploaded.