PublicSoftTools

Barcode Generator Free

Generate barcodes online in Code 128, EAN-13, UPC-A, Code 39, and more formats. Customize colors and download as PNG or SVG. No signup, runs entirely in your browser.

⏱ 9 min read · Complete guide below

Any text or numbers
#000000
#ffffff

How the Barcode Generator Works

  1. 1Enter the value you want to encode — text, a number, or a product code — in the input field.
  2. 2Select a barcode format (Code 128, EAN-13, UPC-A, Code 39, etc.) from the dropdown. Each format has different character rules shown below the input.
  3. 3Optionally adjust the bar color, background color, and whether to show the human-readable text below the bars.
  4. 4Click Download PNG for a raster image or Download SVG for a scalable vector file ready for print.

About Barcode Symbologies

A barcode is a machine-readable representation of data using parallel bars and spaces of varying widths. Different industries have adopted different barcode standards — retail uses EAN-13 and UPC-A, logistics uses Code 128, healthcare uses Code 39, and pharmaceuticals use Pharmacode. Choosing the right format depends on your industry, the characters you need to encode, and the scanner hardware in use.

Barcode Format Comparison

FormatCharactersLengthCommon use
Code 128All ASCIIVariableLogistics, shipping, internal tracking
EAN-13Digits only12 digits (+ check)Retail product packaging worldwide
UPC-ADigits only11 digits (+ check)Retail product packaging in USA/Canada
EAN-8Digits only7 digits (+ check)Small product labels
Code 39A–Z, 0–9, symbolsVariableHealthcare, automotive, government
ITF-14Digits only13 digits (+ check)Carton/case-level packaging (GS1)
MSIDigits onlyVariableWarehouse shelving, inventory
PharmacodeNumber (3–131070)VariablePharmaceutical packaging

Tips for Better Barcodes

Use SVG for Print

SVG scales to any resolution without pixelation. For labels and packaging, always download SVG and place it in your design software at the target print size.

Maintain Quiet Zones

Leave blank white space (quiet zone) of at least 10 bar widths on each side of the barcode. Scanners need this margin to detect where the barcode starts and ends.

High Contrast Only

Dark bars on a white or light background scan most reliably. Avoid colored backgrounds — most laser scanners use a red beam that cannot distinguish certain color combinations.

Test Before Printing

Always scan the barcode with the actual scanner hardware that will be used in production before committing to a large print run. Phone camera apps are not always representative of industrial scanners.

EAN-13 for Retail

If you need barcodes for retail products sold in stores, obtain a registered GS1 company prefix at gs1.org. Arbitrary numbers are not valid for retail checkout systems.

Choose Code 128 for Text

When encoding internal reference codes, serial numbers, or mixed alphanumeric data, Code 128 is the best choice — compact, high-density, and universally supported by modern scanners.

The Complete Guide to Barcodes

Barcodes are so woven into daily life — on every product, parcel, and boarding pass — that we barely notice them, yet they quietly run the world's supply chains, retail checkouts, and inventory systems. A barcode is simply a way to store a short piece of data in a form a machine can read instantly and reliably. This guide explains how that encoding actually works, the difference between the many barcode types, why retail barcodes cannot simply be invented, and how to make sure the barcodes you generate will scan the first time, every time.

How a Barcode Encodes Data

A standard one-dimensional barcode represents data through the widths of its bars and the spaces between them. Each character in the encoded value maps to a specific pattern of narrow and wide bars and gaps, defined by the barcode's standard (its “symbology”). A scanner shines a light across the code and measures the reflected pattern — dark bars absorb light, light spaces reflect it — then decodes that sequence of widths back into the original characters. Because the information is in the relative widths, a barcode can be scaled up or down and still scan, as long as the proportions are preserved.

Two features make barcodes reliable. The first is the check digit: many formats append a digit calculated from the others, so the scanner can verify it read the code correctly and reject a misread rather than returning wrong data. This is why an EAN-13 takes 12 digits of input and produces 13 — the last is a computed check digit. The second is the quiet zone: the blank margin on each side of the code, which tells the scanner where the barcode begins and ends. Omitting the quiet zone is one of the most common reasons a barcode fails to scan.

1D vs 2D Barcodes

The barcodes covered by this tool are one-dimensional (1D) — the familiar pattern of vertical bars that stores data along a single horizontal axis. 1D codes are compact, universally supported by laser scanners, and perfect for storing a short identifier like a product code or serial number. Their limitation is capacity: a long value makes the barcode physically wide, so 1D codes are best kept short.

Two-dimensional (2D) codes such as QR codes and DataMatrix store data in a grid of squares, using both dimensions to pack in far more information — a whole URL, a Wi-Fi password, or a structured payload — in a small footprint. They also include error correction that lets them scan even when partly damaged. The rule of thumb: use a 1D barcode when you need a short identifier read by retail or logistics scanners, and reach for a QR code when you need to encode more data or want people to scan it with a phone camera.

The GS1 System: Why You Cannot Just Invent an EAN

One of the most common misunderstandings is thinking any 12-digit number typed into an EAN-13 generator becomes a valid retail barcode. It does not. The retail barcode system is governed by GS1, a global standards organisation, and the numbers are meaningful: the leading digits are a company prefix that GS1 licenses to a specific business, and the following digits identify individual products within that company. This structure is what guarantees that every product in every shop worldwide has a genuinely unique code.

So while this tool produces a technically correct, scannable EAN-13 from any 12 digits — perfect for testing, internal use, mock-ups, or non-retail tracking — a product you intend to sell through retailers needs a real GS1 company prefix and registered product codes, obtained from GS1 directly. Using an unlicensed or made-up number for a retail product risks clashing with someone else's legitimate code and being rejected by store systems. For internal warehouse, asset, or document tracking, on the other hand, you are free to encode whatever scheme you like, which is where a general format like Code 128 shines.

Getting Barcodes to Scan Reliably

A barcode that looks fine on screen can still fail in the real world, and a few practical rules prevent almost all scanning problems. Contrast is paramount: dark bars on a light background scan best, and coloured backgrounds should be avoided because many laser scanners use a red beam that cannot distinguish certain colour combinations. Size matters too — a barcode printed too small loses the fine detail scanners rely on, so respect the minimum dimensions for your format and add width if you are encoding a long value. Preserve the quiet zones on each side, and for anything going to print, use the SVG download rather than PNG, because a vector image stays razor-sharp at any physical size while a raster image can blur or pixelate.

Above all, test before you commit. Scan a sample with the actual hardware that will be used in production — an industrial scanner, not just a phone app, if that is what your workflow uses — before ordering a large print run of labels or packaging. A five-minute test catches problems that would otherwise be baked into thousands of prints.

Choosing the Right Symbology

Picking the correct barcode type comes down to what you are encoding and who will scan it. Code 128 is the versatile workhorse: it encodes any text or numbers compactly and is ideal for shipping labels, internal reference codes, and serial numbers. EAN-13 and UPC-A are the retail standards for products sold in shops (EAN globally, UPC in North America). EAN-8 exists for small packages where a full EAN-13 will not fit. Code 39, though older and less dense, remains common in healthcare, automotive, and government because of its simplicity and wide hardware support. ITF-14 is used on shipping cartons and cases. Match the format to your industry and the characters you need to encode, and the comparison table above makes the trade-offs easy to see at a glance.

Frequently Asked Questions

Which barcode format should I use?

Code 128 is the most versatile — it encodes any ASCII text or numbers and is used in logistics, shipping labels, and internal tracking. EAN-13 and UPC-A are the retail standards for product packaging (the barcodes you scan at a supermarket checkout). Code 39 is older and limited to uppercase letters plus digits, but remains common in healthcare and government. Use EAN-8 for small product labels where space is tight.

How do I generate an EAN-13 barcode?

Select the EAN-13 format and enter exactly 12 digits — the 13th digit is the check digit, which JsBarcode calculates and appends automatically. If you enter fewer or more than 12 digits, the barcode will show a validation error. The first 2–3 digits encode the country prefix (GS1 prefix), the next digits identify the company, and the final digits identify the product.

Is the barcode generated locally or on a server?

All barcodes are generated entirely in your browser using the JsBarcode library compiled to JavaScript. Your input data is never sent to any server. This makes the tool safe for generating barcodes containing internal part numbers, serial codes, or sensitive product identifiers.

What is the difference between PNG and SVG download?

PNG is a raster format — it has a fixed pixel resolution. SVG is a vector format that can be scaled to any size without losing sharpness. For print applications (labels, packaging, signage) SVG is the better choice because it stays crisp at any size. For web use or quick sharing, PNG is more universally supported.

Can I use these barcodes commercially?

The barcodes generated here are standard format barcodes — the symbologies themselves (Code 128, EAN, UPC, etc.) are open standards. However, if you need a registered EAN-13 or UPC barcode for a retail product sold in stores, you must obtain a GS1 company prefix and product codes from GS1 (gs1.org). Randomly generated 12-digit EAN numbers are not licensed for retail use.

What is the minimum print size for a barcode to scan reliably?

For standard 1D barcodes like Code 128, the recommended minimum print size is about 25 mm (1 inch) wide and 15 mm tall. The bars must have sufficient contrast and quiet zones (white space on each side). For small labels, use simpler formats like Code 39 with fewer characters, or increase the bar width setting. Always test-scan before committing to a print run.

Why is my EAN-13 barcode showing an error?

EAN-13 requires exactly 12 digits as input (the 13th check digit is calculated automatically). Common issues: spaces or dashes in the input, letters included, or the wrong number of digits. Make sure you are entering only the 12-digit product code without any separators. UPC-A requires exactly 11 digits, EAN-8 requires exactly 7 digits, and ITF-14 requires exactly 13 digits.