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.
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.
Frequently Asked Questions
Can barcode scanners read the barcodes generated by this tool?
Yes. This tool generates standard Code 128B barcodes with proper start codes, checksums, and stop patterns. The output is compatible with all barcode scanners and readers that support the Code 128 symbology.
Is my data sent to a server?
No. All barcode generation happens locally in your browser using JavaScript and the HTML5 Canvas API. Your text data never leaves your device, making this tool safe for sensitive or confidential codes.
What characters can I encode in a Code 128 barcode?
Code 128B supports all standard printable ASCII characters including letters (uppercase and lowercase), numbers, spaces, and common punctuation marks. This covers characters from space (ASCII 32) through tilde (ASCII 126).
Is Barcode Generator free to use?
Yes, Barcode Generator is completely free with no sign-up, no login, and no hidden fees. The tool runs entirely in your browser — your data never leaves your device.
Is my data safe when using this tool?
Yes. This tool runs 100% in your browser using JavaScript. No data is sent to any server, stored in any database, or shared with any third party. When you close the page, processing stops immediately.