What is a barcode, and how does it work?
A barcode is a machine-readable pattern of black bars and white spaces. A scanner shines a light at the pattern, reads the reflected light, and translates the bar widths into a string of characters. The result is a fast, error-resistant way to identify a product, a parcel, a document, or an internal asset without typing anything.
Almost all retail barcodes are 1D — the bars encode the data horizontally, and the height is only there so the scanner can find the bars. 2D barcodes (like QR codes) encode data in both dimensions and can hold far more information, but they are a different technology and are not generated by this tool. This page focuses on 1D barcodes because that is what retailers, shippers, and warehouses standardise on.
What each format is actually for
The most common mistake is picking a format because it looks familiar, rather than because it is what the receiving system expects. Here is a quick decision guide:
| Format | Best for | Data rules |
|---|---|---|
| Code128 | Internal SKUs, tracking numbers, asset tags, shipping labels | Any ASCII character, variable length |
| EAN-13 | Retail products worldwide (except USA/Canada) | 13 digits (the last is a checksum) |
| EAN-8 | Small retail items — confectionery, cigarettes, tiny packaging | 8 digits |
| UPC-A | Retail products in USA and Canada | 12 digits |
| Code39 | Automotive, defense, healthcare — legacy systems | A–Z, 0–9, and a few symbols |
| ITF-14 | Shipping cartons, pallets, GS1 logistics | Exactly 14 digits |
| MSI | Inventory and shelf labels | Numeric only |
| Pharmacode | Pharmaceutical packaging verification | Number between 3 and 131070 |
| Codabar | Libraries, blood banks, courier services | Digits and a few symbols |
You cannot sell retail products with a barcode you generated yourself
This is the single most important thing on this page, and most "free barcode generator" sites bury it.
To sell products in a physical store or on Amazon, the barcode number itself must be registered with GS1 — the global standards body that manages product numbers. Registering with GS1 gets you a company prefix, which guarantees that every product code you use is unique across the entire world. A barcode image generated by a tool without a registered prefix will scan, but it is not a valid retail barcode and marketplaces, distributors, and retailers will reject it.
What this tool is genuinely good for:
- Rendering a number you have already registered with GS1 into an EAN-13 or UPC-A image.
- Internal barcodes for your own inventory, assets, documents, or warehouse — where a GS1 prefix is not required.
- Prototyping packaging designs before you commit to a print run.
- ITF-14 shipping labels on cartons you already use registered GTINs for.
If you are starting from zero, the correct sequence is: register with GS1 → receive your company prefix → allocate a GTIN → come back here to render the barcode image. Skipping the first two steps will save you nothing and cost you a lot when you try to list the product anywhere.
Print checklist — will your barcode actually scan?
Generating a barcode is only half of the problem. The other half is producing a label that a scanner will actually read. Follow these rules before you mass-print:
- Contrast matters more than color. Dark bars on a light background. Black on white is the safest choice. Some scanners can read low-contrast labels, but many cannot — do not gamble on it.
- Leave a quiet zone. At least 10× the narrow bar width on the left and right of the barcode. If your design trims that margin off, many scanners will fail to detect the barcode at all.
- Print at 300 DPI or higher. Below 300 DPI, thin bars can blur into each other and the scanner reads the wrong character.
- Do not stretch non-uniformly. If you resize the barcode to fit a design, scale it proportionally. Squashing it horizontally changes the bar widths and breaks it.
- Use SVG for print. PNG is fine for digital use, but SVG is a vector format and stays crisp at any print size.
- Test-scan a real sample. Every time. Even if the digital preview looks perfect, print one label and scan it with an actual scanner before you send the file to a printer.