Barcode Generator

Generate Code 128 barcodes from any text or numbers. Enter your data, render the barcode on canvas, and download as a PNG image. Everything runs in your browser — no data is sent to any server.

Ad Space

How Code 128 Barcodes Work

Code 128 is a high-density linear barcode symbology that can encode all 128 ASCII characters. It is one of the most widely used barcode formats in logistics, shipping, inventory management, and retail. Each character is represented by a pattern of bars and spaces with three different widths. The barcode includes a start character, the encoded data, a checksum character for error detection, and a stop pattern.

This tool implements Code 128B encoding, which supports the full range of printable ASCII characters (space through tilde). The barcode is rendered directly onto an HTML5 Canvas element using JavaScript, calculating the exact bar widths and positions for each character in your input. The checksum is computed automatically to ensure the barcode is valid and scannable. Because everything runs in your browser, your data is never transmitted to any server.

Code 128 Structure

Start Code B: Initiates encoding for ASCII characters 32-127

Data Characters: Each character encoded as 3 bars and 3 spaces (11 modules)

Checksum: (Start value + Σ(position × character value)) mod 103

Stop Pattern: Fixed 13-module termination sequence

The resulting barcode is compact, machine-readable, and compatible with virtually all barcode scanners.

Common Uses for Barcodes

Barcodes are used extensively in retail for product identification (UPC/EAN), in logistics for package tracking, in libraries for book management, in healthcare for patient identification and medication tracking, and in manufacturing for inventory control. Code 128 is particularly popular for shipping labels, asset tags, and internal inventory systems because of its ability to encode both text and numbers in a compact format.

Barcode Design Tips

For reliable scanning, ensure adequate quiet zones (blank space) on both sides of the barcode. The recommended minimum quiet zone is 10 times the narrowest bar width. Use high contrast between the bars and background (black bars on white background works best). Avoid scaling barcodes too small, as narrow bars may become unreadable. A minimum height of 15 percent of the barcode width is recommended for handheld scanners.

Privacy and Security

All barcode generation happens entirely in your browser. Your text data is never uploaded to any server, making this tool completely safe for encoding sensitive inventory codes, internal tracking numbers, or confidential identifiers.