What is a 1D barcode and which format should you use?
A barcode is a machine-readable way to represent data as a pattern of parallel lines and spaces of varying widths. The barcodes this tool creates are one-dimensional (1D), meaning the information is encoded along a single horizontal axis in the thickness and spacing of vertical bars. A scanner sweeps across the pattern and translates those widths back into the original number or text. This is the familiar barcode you see on retail products, shipping labels, and inventory tags. It differs from a QR code, which is a two-dimensional (2D) code storing data both horizontally and vertically, allowing a QR code to hold far more information in a compact square while a 1D barcode holds a shorter string in a wider strip.
This generator is built on JsBarcode, a well-established JavaScript library, and renders the barcode directly in your browser. It supports the most widely used 1D formats. CODE128 is a high-density, general-purpose format that can encode letters, numbers, and symbols, making it ideal for internal inventory, asset tags, and shipping references where you need flexibility. EAN-13 is the 13-digit standard used on retail products worldwide, the barcode you scan at almost any supermarket checkout. UPC (specifically UPC-A) is the 12-digit format used primarily in North American retail. Choosing the right format depends on where the barcode will be used and what system will scan it.
Each format has its own rules about what data is valid. EAN-13 and UPC accept only digits and expect a specific length, and they include a check digit — a final calculated number that lets a scanner verify the code was read correctly. CODE128 is far more permissive and accepts alphanumeric text. If you enter data that does not match the selected format's requirements, the barcode will not render, which is a helpful signal that the input needs adjusting.
How to use Barcode Generator, step by step
- Choose a Format: CODE128 (default), EAN-13, UPC-A, CODE39 or ITF-14. Retail products use EAN-13 or UPC-A; internal labels usually use CODE128.
- Type the number or text into Value. The hint under the box says what the format accepts; for EAN-13 enter 12 digits and the 13th check digit is added for you.
- If an error appears and the preview says No preview, the value does not fit the format. A wrong check digit on a full 13-digit EAN is reported as invalid.
- Untick Show value text to drop the human-readable number under the bars.
- Keep Line color dark and Background light; scanners need strong contrast, and red bars are hard for many laser scanners to see.
- Press Download PNG, then test the printed label with the scanner you will actually use.
Real example: CODE128, EAN-13 and UPC-A
The default CODE128 barcode for PIXOHUB-123 downloaded as a 332 × 142 PNG of 4.6 KB. For EAN-13 we entered the 12 digits 400638133393; the tool added check digit 1 and produced a 234 × 142 PNG of 3.9 KB. Typing the full 4006381333931 was accepted, while 4006381333932, with a wrong check digit, was rejected. A UPC-A code for 03600029145 came out at 242 × 142.
These images use 2 pixels per bar module. Printed at 300 dpi, the 234-pixel EAN-13 is about 20 mm wide, roughly half the 37.29 mm nominal size, so scale it up in whole-number steps for print.
| Format | Value | PNG |
|---|---|---|
| CODE128 (default) | PIXOHUB-123 | 332 × 142, 4.6 KB |
| EAN-13 | 400638133393 → check digit 1 | 234 × 142, 3.9 KB |
| UPC-A | 03600029145 | 242 × 142, 4.1 KB |
Last updated
Barcode Generator compared with other ways to do it
Label printer software
Software that comes with label printers lays barcodes out on the exact label size and prints at the printer's native resolution, which avoids scaling problems. For regular stock labelling, that is the better setup. This tool is for the occasional barcode you need as an image, for a document, a mock-up or a one-off label.
Inkscape and Word
Inkscape can render barcodes as vector shapes, and Word's DISPLAYBARCODE field can place one in a document. Vectors stay sharp at any size, which suits packaging artwork. A PNG from this tool is a fixed-size image, so scale it by whole numbers (2×, 3×) to keep the bar widths exact.
Getting a real retail number
No generator, online or desktop, gives you a valid product number for selling in shops. EAN and UPC numbers are issued through GS1; the generator only draws the bars for a number you already have. For internal use, CODE128 with your own codes is fine.
Printing and using your barcodes
The barcode you create downloads as a PNG, a lossless image format that keeps the bars sharp and evenly spaced. Crisp edges matter a great deal for barcodes: if the bars blur together or the widths shift during printing, a scanner may misread or fail to read the code entirely. A PNG scales cleanly into label templates, product packaging, and design software without introducing the compression artifacts that a JPG would, so it is the right choice for anything you intend to print and scan.
When you print, preserve the quiet zones — the blank margins on the left and right of the barcode — because scanners use them to detect where the pattern begins and ends. Keep the barcode large enough for your scanner and scanning distance, avoid stretching it in a way that distorts the bar widths, and print with good contrast, ideally dark bars on a plain white background. Testing the printed result with your actual scanner before producing a large batch is always worthwhile.
Because everything runs locally in your browser, the numbers and text you encode are never uploaded to a server, and there is no signup, watermark, or usage limit. That makes this practical for small businesses labeling stock, makers packaging a product, or anyone who needs to generate a valid retail or inventory barcode quickly. If you need to encode a longer message, a link, or Wi-Fi details instead of a short product number, a QR code is the better fit — use the Pixohub QR Code Generator for that, and this barcode tool for standard 1D retail and inventory codes.