Understanding Barcode Symbologies and How to Encode Them
What this generator does
A barcode packs a short string — a product code, an SKU, a batch number — into a pattern of bars and spaces that a scanner can read. This generator turns whatever value you type into that pattern with the JsBarcode library, drawing the result as a live SVG. It covers eight symbologies: Code 128, Code 39, EAN-13, EAN-8, UPC, ITF-14, MSI, and Pharmacode, each encoding data under its own rules. An Auto Detect mode inspects your input and picks a compatible symbology when you are not sure which one fits.
Beyond the raw bars, you control bar width, height, margins, the line and background colors, and the human-readable value printed underneath. Once the layout looks right, download it as a PNG for everyday use or copy it as SVG for print work that has to stay sharp at any size.
Choosing the right symbology
The format you pick depends on where the barcode will be scanned. Code 128 is the versatile choice for internal labels because it encodes the full ASCII set, letters and symbols included. Code 39 still appears in industrial and defense settings where older scanners are common. For anything sold in a shop, retail symbologies apply: EAN-13 and EAN-8 for international products, UPC for the United States. ITF-14 marks shipping cartons, MSI turns up on warehouse shelf labels, and Pharmacode is the dedicated standard for pharmaceutical packaging.
A concrete example
Enter 590123412345 and choose EAN-13. The symbology expects twelve digits plus a thirteenth check digit calculated from the first twelve. If your value is off, the tool reports the correct check digit instead of drawing an invalid code, so you can fix it before printing. Pharmacode behaves differently again: it accepts only a number between 3 and 131070 and rejects anything outside that window.
Notes and edge cases
Each symbology enforces its own length and character rules — EAN-8 wants seven to eight digits, MSI accepts digits only, and Code 39 allows A–Z, 0–9, and a handful of symbols. When the input breaks a rule, an inline message names the problem, whether it is an invalid character, a length mismatch, or a bad check digit. You can also hide the printed value, realign it left, center, or right, and adjust the font size when the label has to fit a tight space.