"Generate a barcode" means different things depending on what you're labelling. A warehouse bin, a library book or an internal part number is one problem. A product going on a supermarket shelf is a completely different one — and most free barcode generators, including this site's, only solve the first.
Looking for a QR code instead?
If what you actually want is something a phone camera can scan — a link, a WiFi password, a contact card — that's a QR code, not a barcode, and it's a different tool: our QR Code Generator handles web links, plain text, WiFi logins and vCard contacts, with custom colors, shapes and an optional logo. The rest of this guide is specifically about Code 128, the striped 1D barcode used for inventory and asset labels, which needs a barcode-style scanner rather than a phone camera.
What Code 128 actually is
Code 128 is a 1D barcode format that can encode any plain text — letters, digits, spaces and most punctuation — in a single barcode. That's unlike older formats that only accept digits, which is why it's the common choice for internal codes: a part number like SHELF-A3-042 encodes just as easily as a plain number.
Every Code 128 barcode carries a checksum digit worked out from the data itself, so a scanner can tell a misread apart from a correctly-read one. A generator that skips this, or approximates the bar widths instead of using the published symbol table, can produce something that looks like a barcode but won't scan reliably — which defeats the point of having one.
When you shouldn't use Code 128
If the barcode needs to be scanned at a retail checkout, Code 128 is the wrong tool, no matter how well it's generated. Retail products use EAN-13 or UPC, which require a globally unique number issued by GS1 (or your country's numbering authority), not just any text you choose. Point-of-sale systems are built to expect that specific format and that specific numbering authority — a Code 128 barcode of your own invented number won't ring up correctly, if it scans at all.
Code 128 is the right call for anything that stays inside your own systems: shelf and bin labels, equipment tags, library or asset codes, ticket and voucher numbers — anywhere you control both the printer and the scanner.
Encoding a link instead of plain text
Some internal systems scan a barcode to open a URL — a link to an asset's maintenance record, for example. Code 128 can hold a URL fine, but the usual trap is pasting in a link with characters a barcode scanner's receiving system doesn't expect, like spaces or an ampersand in a query string. Run the URL through a URL encoder first so those characters are safely percent-encoded, then encode the result as your barcode — that way the system reading the scan gets back exactly the link you intended.
Making sure it actually scans
- Keep the white margin. The quiet zone on either side of the bars isn't decorative — cropping it off is one of the most common reasons a correctly-encoded barcode fails to scan.
- Don't shrink it too far. If the narrowest bar gets thinner than your scanner's optics can resolve, scans start failing intermittently, even though the image looks fine on a screen.
- Test before printing a batch. Scan the barcode with a phone camera or scanner app first. It takes a few seconds and catches a bad print run before you've wasted a sheet of labels.
- Watch case sensitivity. Code 128 treats
SKU-1025andsku-1025as different data, so keep your numbering consistent.