Skip to content
Processing locally — files never leave your device

Barcode Generator

Generate 1D barcodes in Code 128, EAN-13, UPC, and Code 39 formats. Customize size and labels. Download as SVG.

Bloggers — embed this widget for free

Add this tool to your own site with one line of HTML. Free forever — just keep the small credit link.

How to use Barcode Generator

  1. Choose a barcode symbology from the Format dropdown — Code 128, EAN-13, EAN-8, UPC, or Code 39.
  2. Type the value into the Value box. Each format has rules: EAN-13 needs 12–13 digits, UPC needs 11–12 digits, Code 39 accepts A–Z, 0–9 and a few symbols, and Code 128 accepts any printable ASCII.
  3. Watch the live preview render below. If you enter invalid data for the chosen format, an error message tells you exactly what is wrong instead of drawing a broken barcode.
  4. For EAN and UPC, you can omit the final check digit — the generator calculates and appends it for you automatically.
  5. Click Download SVG to save a vector file that prints sharply at any size, from a 2 cm label to a full sheet.

A practical guide to 1D barcodes

A linear (1D) barcode encodes a number or short string as a pattern of parallel bars and spaces of varying width. A scanner sweeps a beam across the symbol, measures the relative widths, and reconstructs the digits. The set of rules that maps characters to bar patterns is called a symbology. Different industries standardised on different symbologies, which is why this tool offers five of them — picking the right one matters more than it might seem.

Code 128 — the flexible workhorse

Code 128 encodes the full 128-character ASCII set and packs it densely, which is why it dominates shipping labels, logistics, and internal asset tracking. It has three sub-modes (A, B, C); mode C compresses pairs of digits into a single symbol, so a long numeric string takes very little width. If you are labelling boxes, shelves, or equipment with an alphanumeric code like SNAPTOOLS-2026, Code 128 is almost always the right answer.

EAN-13 and UPC — retail product codes

These are the GS1 retail symbologies you see on grocery items. EAN-13 carries 13 digits and is the worldwide standard; UPC-A carries 12 digits and is used in the US and Canada. Both end with a check digit computed from the preceding digits — a weighted modulo-10 calculation that lets a scanner detect a misread. EAN-8 is a compact 8-digit variant for tiny packages such as cosmetics or confectionery where a full EAN-13 simply will not fit.

Code 39 — legacy and industrial

Code 39 (also called Code 3 of 9) is one of the oldest alphanumeric symbologies. It encodes uppercase A–Z, digits 0–9, and a handful of symbols, and it frames each symbol with an asterisk start/stop character. It is less dense than Code 128 but remains mandated in some automotive, defence, and healthcare systems, so you will still meet it on older labels.

Print size and the quiet zone

Because the download is SVG, the barcode stays crisp at any size — but two rules keep it scannable. First, do not shrink the bars below the printer's reliable resolution; thin bars that blur together cause misreads. Second, leave a quiet zone: a clear margin of at least ten times the narrowest bar width on the left and right. Without it, scanners struggle to find where the symbol begins and ends.

When a 2D code fits better

A 1D barcode is perfect for a short number a laser scanner reads at speed, but it tops out at a few dozen characters. When you need to carry a URL, a batch of metadata, or anything a phone camera should act on, reach for a matrix code instead.

  • QR code generator — a 2D matrix that holds product pages, manuals, or thousands of characters.
  • QR code decoder — note that this reads QR codes, not 1D barcodes, which use a different scanner.
  • vCard QR code generator — encode supplier or contact details next to a product label as a 2D code.

Frequently asked questions

Which barcode format should I use?
Code 128 is the most flexible choice for internal labels, asset tags, and shipping — it encodes the full ASCII set (letters, digits, symbols) very densely. Use EAN-13 for retail products sold internationally, UPC-A for products sold in North America, EAN-8 for small packages where a full EAN-13 will not fit, and Code 39 for older industrial, automotive, and government systems that still require it.
What is the difference between EAN-13 and UPC?
They are closely related GS1 retail symbologies. UPC-A holds 12 digits and is the standard in the United States and Canada. EAN-13 holds 13 digits (a UPC-A with a leading country/region prefix) and is the global standard used everywhere else. A UPC-A is essentially an EAN-13 with a leading zero, so most modern retail scanners read both.
Do I need to include the check digit?
No. For EAN-13, EAN-8, and UPC the last digit is a checksum calculated from the others. You can type the 12 data digits for EAN-13 (or 11 for UPC) and the generator computes the correct check digit and appends it. If you type all 13 (or 12) digits yourself, it validates that the check digit is correct.
Why does my value show an error?
Each symbology has strict character and length rules. EAN-13 rejects letters and any length other than 12–13 digits; UPC rejects anything but 11–12 digits; Code 39 rejects lowercase letters and most punctuation (it allows A–Z, 0–9, space, and $ % * + - . /). Switch to Code 128 if you need to encode arbitrary text like SKU-AB12.
Can I print these barcodes for product labels?
Yes. The download is an SVG vector, so it scales to any physical size without becoming blurry or pixelated — ideal for label sheets, shelf tags, and packaging. Keep a quiet zone (blank margin) of at least 10× the narrowest bar width on each side so scanners can lock on.
Are these the same as QR codes?
No. These are 1D (linear) barcodes — a single row of bars and spaces that encode a number or short string. QR codes are 2D matrix codes that hold far more data, including URLs, WiFi credentials, and contact cards. If you need a 2D code, use the QR generator instead.
Is my barcode data sent to a server?
No. Whether you are encoding a confidential internal SKU or a not-yet-public product GTIN, the value stays on your machine: JsBarcode draws the SVG in the page from the digits you enter, with no upload and no logging of the number. A barcode value is rarely a secret in itself, but for unreleased-product GTINs or internal asset schemes you may not want exposed, it is reassuring that the number never touches a server here.
Will a retailer accept a barcode I generated here?
The symbol will scan correctly, but for retail sale the number itself must be a legitimate GS1-issued GTIN that you have licensed for your product. This tool draws the barcode for any number you supply; it does not register or allocate GTINs. For internal use — warehouses, libraries, asset tracking — you can use any numbering scheme you like, typically with Code 128.

More tools you might find useful in the same flow.

Built by Muhammad Tahir · About