Barcode Generator
Generate CODE128, EAN, UPC, and other barcodes as images.
This tool runs entirely in your browser. Your data is never uploaded, never stored, and never leaves your device.
Type a code and this tool draws it as a real, scannable barcode in one of eight symbologies — CODE128, EAN-13, EAN-8, UPC-A, CODE39, ITF-14, MSI or pharmacode — and hands it back as a PNG.
How to use it
- 1Enter the content: a product number, an asset tag, or any short string.
- 2Pick the format — CODE128 accepts arbitrary text, EAN-13 wants 12 or 13 digits, pharmacode a number from 3 to 131070.
- 3Adjust the bar height if you need to, then use Download PNG.
Example
- Input
- 5901234123457, format EAN-13
- Output
- a barcode with the digits printed beneath the bars, and a download saved as barcode-ean13.png
Switch the format to EAN-8 without changing the digits and the image is replaced by: "5901234123457" isn't valid for EAN8 — check the required digit count.
What happens to your data
JsBarcode draws onto a canvas element that is kept hidden in the page, and the picture you see is that canvas read back with toDataURL as a base64 PNG; the Download button's href is that same string, so the file is built in your tab and no image is requested from or written to a server. When the content is rejected for the chosen symbology the data URL is cleared, so the previous barcode and its download link vanish rather than being left to be saved by mistake.
Last updated August 2026
Somebody has asked for a barcode, and the request usually arrives from one of three places: a shop that will not stock a product without one on the packaging, a stockroom where every shelf and every laptop needs a label a scanner can read, or an integration that needs a few test codes to point a scanner at. All three end with the same picture of black bars, and only one of them involves buying anything.
Settle which one you are doing before you touch the format list, because that decision is most of the job. A code used inside your own operation can say whatever you like — an asset number, a job reference, a bin location — and CODE128 is the sensible default there, since it takes letters and punctuation as well as digits. A code that has to work at someone else's till is a different animal. EAN-13 and UPC-A numbers are issued to a company rather than invented, and the retailer looks the number up instead of reading meaning out of the bars. Making up a plausible thirteen digits gives you a barcode that scans beautifully and either means nothing or means somebody else's product.
The other thing to decide early is the printed width. A linear barcode is read across its width, so width is both capacity and legibility — squeeze one to fit a label and it will still look correct on screen while failing under a scanner. Fix the label size first, keep the plain white space at either end of the bars intact, and treat the height as the part you are free to play with.
How it works
Toolvore draws each barcode with JsBarcode, which is fetched only once there is something to render rather than when the page loads. The library writes into a canvas element kept hidden in the layout, and the picture you see is that canvas read back as a base64 PNG, so the image on screen and the file behind Download PNG are the same string. Three things are fixed and cannot be changed from the page: the value is always printed beneath the bars, the quiet zone is a flat twelve pixels on every side, and the output is a raster PNG rather than a vector. That last one is the real weakness. With no bar width setting, no colour control and no SVG, a barcode headed for a printed label has to be sized in whatever program receives it, and blowing a small PNG up to fill a box softens exactly the edges a scanner needs sharp. Only the bar height is yours to set: the field is marked 20 to 200, nothing clamps a number you type past that, and anything that is not a number falls back to 80.
Common use cases
- Asset tags for laptops, tools and test equipment
- Shelf, bin and rack labels in a small warehouse
- Numbering crates for an office move so they can be scanned back in
- A membership or ticket number that has to be read at a door
- Test codes for checking a scanner or a point-of-sale integration
- Reprinting a damaged label from a code you already hold
- Pharmacode marks for a pharmaceutical packing line
Frequently asked questions
Which barcode format should I choose?+
Match the symbology to whoever is scanning it. CODE128 handles letters, digits and punctuation, and is the usual choice for anything internal — asset tags, bin labels, job numbers. CODE39 is older and produces a wider symbol for the same data, but some legacy systems still ask for it by name. EAN-13 and UPC-A belong at retail checkouts and nowhere else. ITF-14 goes on outer cases and cartons rather than on the retail unit inside them. MSI turns up in shelf labelling and stock control, and pharmacode is a packing-line mark read by machine vision rather than by a handheld scanner. If nobody has specified one, use CODE128.
Do I need to buy a barcode to sell a product in a shop?+
For retail, yes — and what you are buying is the number, not the picture. Retail codes are allocated through GS1, which issues a company prefix; the digits after it identify your individual products, and the retailer's system looks the whole number up in a database that expects it to belong to you. Any generator, this one included, draws bars for whatever you type and has no way of knowing whether the number is yours. Inside your own operation there is nothing to buy at all: warehouse, library, workshop and asset codes are yours to invent, which is the case CODE128 exists for.
What is a check digit, and why is my number rejected?+
The final digit of a retail code is calculated from the digits before it by a weighted sum, so most numbers of the right length are not valid codes. Type thirteen digits for EAN-13 with a wrong last one and it fails even though the count looks correct. The format list accepts twelve digits as well as thirteen, which spares you the arithmetic — enter the twelve you were given and the last is derived from them. One thing to know when it does go wrong here: the message always ends with a nudge about digit count whatever the real cause was, so read it as a general this value will not encode in this format.
Why will my printed barcode not scan?+
Four causes cover nearly all of it. The quiet zone, meaning the plain margin at each end of the symbol, has been cropped or crowded by a border or a fold — the image carries a fixed twelve-pixel margin, so add space around it in your layout rather than trimming in. Contrast is wrong: bars need to be dark on a light background, and red ink is close to invisible to a red-light scanner. The print is too small, or has been scaled up from a small image until the edges have gone soft. Or the label sits on a curve, under gloss, or wrapped round a corner.
What is the difference between UPC-A and EAN-13?+
UPC-A is twelve digits and grew up in North America; EAN-13 is thirteen and is the international form. They are closer than they look — an EAN-13 beginning with a zero is a UPC-A with that leading zero written out, and the bar patterns line up accordingly. Scanners sold in the last couple of decades read both without being told which they are looking at, so the choice is really about the form your number was issued in. Use that form rather than converting between them yourself, since the check digit is calculated over the digits as issued and a hand conversion is an easy thing to get wrong.
Can a barcode hold a web address or a paragraph of text?+
Not one of these. Every format on offer is linear, meaning the data runs in a single dimension, so capacity is width and a web address becomes a symbol far too wide to print or scan sensibly. CODE128 will accept arbitrary text, which is not the same as that being a good idea: the image grows with every character, and the bars get relatively narrower against the label around them. Anything longer than a short identifier belongs in a two-dimensional symbology such as QR or Data Matrix, which stack data in both directions and are what phone cameras are built to read.
Can I generate a batch of barcodes from a spreadsheet?+
Not here. There is one content field, one image and one download, so a hundred labels means a hundred passes by hand. Two things to watch if you do that: the image redraws the moment you type and replaces what was there, so save each one before starting the next, and the file is named after the format rather than the value, so every CODE128 download arrives as barcode-code128.png and your browser will start appending numbers to tell them apart. Rename as you go. For a genuine print run, a label program with mail-merge, or a barcode font applied to a spreadsheet column, is the right tool.
Is anything I type sent anywhere?+
No. The barcode is drawn by a library loaded into the page, onto a canvas element that stays hidden, and the picture you see is that canvas read back as a base64 PNG. The Download PNG link points at that same string, so the file is assembled inside your browser and no image is requested from or written to a server. Nothing is kept between visits either: the content, format and height live in the page while it is open and go when you close the tab. That matters more than it sounds for a barcode, since what people encode is often an order number, a serial or an internal asset ID.
Related tools
JSON Formatter & Validator
Format, validate, and minify JSON documents.
Cron Expression Parser & Builder
Build cron expressions and see their next run times explained.
QR Code Generator
Generate a downloadable QR code from any text or URL.
URL Parser
Break a URL into protocol, host, path, and query parameters.