Barcode Generator

Generate Code 128, EAN-13, UPC-A, Code 39 or ITF barcodes from text or numbers and download them as PNG or SVG, entirely inside your browser.

🌐 Español

🔒 Private by design: your text is processed locally in your browser and never uploaded to any server.

Five symbologies, and what each one will actually accept

A barcode format is not a style choice. Each symbology defines its own character set and its own length rules, and a scanner configured for one will not read another, so the format dropdown is really a question about which system is going to read the label.

Check digits, and the one nobody adds for you

EAN-13 and UPC-A both end in a check digit computed from the digits before it, and this is where most failed generations come from. Give EAN-13 twelve digits and the thirteenth is calculated and appended for you. Give it all thirteen and the last one is verified rather than recalculated, so a single mistyped digit anywhere in the number invalidates the whole value. UPC-A behaves identically one digit down: eleven digits get a twelfth added, twelve digits get checked.

That means the safest habit when you are inventing codes rather than copying them is to type the short form and let the check digit be computed. When you are copying a number off an existing package, type all of it and let the check verify your typing, which turns the tool into a proofreader.

Code 39 has an optional check character of its own and this tool does not add it. ITF has no check digit in the form generated here, only the even-digit-count rule.

From a value to a file on disk

  1. Type or paste the value into the box. The button stays disabled until there is something in it.
  2. Pick the Barcode format that matches the system reading the label, not the one that looks nicest.
  3. Set Download as to PNG for documents, spreadsheets and most label software, or SVG when the code is going into a print layout.
  4. Leave Show human-readable text under the barcode ticked unless you are placing your own caption, in which case untick it to get bars alone.
  5. Click Barcode Generator. The image appears as a preview, with a download link underneath naming the file (barcode.png or barcode.svg) and a Generate another button to start over.

Two pixels per module, a hundred pixels tall

The narrowest bar is drawn two pixels wide and every wider bar is a multiple of that, the bars are a hundred pixels tall, and a ten pixel quiet zone surrounds the whole thing. That quiet zone matters more than it sounds: scanners need the blank margin to find where the code starts and ends, and cropping it off in an image editor is a classic way to break an otherwise valid barcode.

Those three figures are JsBarcode’s own defaults rather than values this tool sets. It passes the library a format and whether to print the human-readable line, and nothing else. They are left alone because they are sensible for a printed label, but it would be wrong to present them as a calibration we performed.

The PNG comes out of a canvas at exactly that size, so scaling it up in a document will soften the bar edges. The SVG describes the same geometry as vectors, which is why it is the right pick for anything that will be printed at a size you have not decided yet. Both carry the same white background, and both include the caption under the bars unless you turned it off.

What a failure to generate is telling you

When a value does not satisfy the chosen format, the page shows one generic message asking you to check the input; the specific reason is written to the browser console rather than to the page. So the message will not name the problem for you, and in practice it is nearly always one of a short list: an EAN-13 or UPC-A number of the wrong length or with a bad final check digit, an ITF value with an odd number of digits, a letter or punctuation mark in a digits-only format, or a non-ASCII character in a Code 128 value. Whitespace at the ends is not on that list, because it is trimmed away before encoding.

The quickest diagnosis is to switch the format to Code 128 and try again. If it generates, the value was fine and the format’s rules were the problem.

One label here, a sheet of codes elsewhere

This page makes one barcode per click, which suits printing a handful of asset tags or checking that a product number encodes cleanly before it goes to a label printer. For volume, the site’s bulk generation is on the QR side rather than the linear side: the Bulk QR Code Generator turns a pasted list or a CSV into many QR codes at once, delivered as a ZIP or a printable sheet, and the single QR Code Generator returns one PNG with a selectable error-correction level. The rest of the code and asset generators are grouped on the generators hub.

See it in action

Screenshot of the Barcode Generator tool with the sample input “9781234567897”, Barcode format set to Code 128 (general-purpose, default), Download as set to PNG image (default)
Barcode Generator mid-process: the sample input “9781234567897”, Barcode format set to Code 128 (general-purpose, default), Download as set to PNG image (default).
Screenshot of the Barcode Generator result screen showing barcode.png ready to download (4 KB)
The finished result: barcode.png ready to download (4 KB). The download link is a local blob URL — the file never leaves your device.

Frequently asked questions

Does the PNG have a transparent background?

No. Both output formats are drawn on a solid white background, the PNG as a filled canvas and the SVG as a white rectangle behind the bars. That is deliberate rather than an oversight, because a scanner reads the contrast between dark bars and a light background, and a transparent PNG dropped onto a coloured or dark label can stop scanning altogether. If you need the bars on a different background, edit the SVG, where the background rectangle is a separate element you can delete.

Does the Code 39 output include a check digit?

No. Code 39 has an optional mod 43 check character, and this tool leaves it off, so what you get encodes exactly the characters you typed and nothing more. That matches the way Code 39 is used in most internal inventory and asset-tagging systems. If your scanner or your warehouse system is configured to require the mod 43 character, a barcode generated here will be rejected by it, and you will need a generator that adds one.

Why did my lowercase text come back uppercase on a Code 39 barcode?

Code 39's character set has no lowercase letters in it at all, so the encoder uppercases the whole value before it does anything else. Typing sku-1234a and typing SKU-1234A therefore produce the identical barcode, and the human-readable line under the bars shows the uppercased form. It is worth checking that whatever system reads the code is not case sensitive about the value it expects back.

Can I change the bar height, the bar width or the colours?

Not from this page. The tool passes only the format and the human-readable text toggle to the encoder, so everything else stays at the library's defaults, which are two pixels for the narrowest bar, one hundred pixels of bar height, a ten pixel quiet zone around the edges, black bars on white, and a twenty pixel monospace caption underneath. Picking the SVG output and scaling or restyling it in a vector editor is the practical way around that, since an SVG keeps its edges crisp at any size.

What happens to spaces around the value I paste?

Leading and trailing whitespace is stripped before encoding, so a value copied out of a spreadsheet cell with a trailing newline still works. Spaces in the middle are kept and encoded, which Code 128 and Code 39 both handle, but which will fail on EAN-13, UPC-A and ITF because those three accept digits and nothing else. If you paste a value with a space in the middle and a digits-only format selected, that space is the first thing to check.

Should I use a barcode or a QR code for a long value like a URL?

A QR code, almost always. These are all linear symbologies, so every extra character adds width and nothing else, and a URL encoded as Code 128 becomes a very wide, very thin image that is awkward to place on a label and awkward to scan. A QR code stores the same value in a square that grows slowly, and phone cameras read it without a dedicated scanner.

Related tools