How to Generate a Barcode

Create Code 128, EAN-13, UPC-A and Code 39 barcodes online for free. Covers which type to pick, check digits, and printing barcodes that scan.

Updated 4 min read By CodingEagles
Free tool Barcode Generator Make Code 128, EAN-13, UPC-A and Code 39 barcodes; export PNG or SVG. Open tool

A barcode encodes a number or short text as a row of bars a scanner can read in an instant. The main thing to get right is choosing the correct type for your job. Here is how to make a barcode that scans.

TL;DR Open the barcode generator, pick a type, enter your value, then download a PNG or SVG. Check digits are added for you where the format needs them.

Pick the right type

Each barcode type, or symbology, suits a different job:

  • Code 128 is the all-rounder. It handles letters and numbers and packs them compactly, which makes it the right default for internal labels, shipping and inventory.
  • EAN-13 is the 13-digit barcode on retail products across most of the world. Use it when a product needs to scan at a checkout.
  • UPC-A is the 12-digit version common in North America. Same idea, different region.
  • Code 39 encodes letters, numbers and a few symbols. It is bulkier than Code 128 but some older systems still require it.

If you are unsure and just need a working barcode, choose Code 128.

Let the check digit be calculated

EAN-13 and UPC-A end in a check digit, a number derived from the others that lets a scanner catch a misread. You do not have to work it out. Enter the first 12 digits for EAN-13, or the first 11 for UPC-A, and the tool adds the final digit. If you paste a complete code, it checks that the last digit is correct and warns you if it is not.

Give the barcode room. Keep a clear margin, the quiet zone, on the left and right, and do not shrink it so far that the thin bars blur. Print dark bars on a light background, and avoid stretching the image, since distorting the bar widths breaks the read.

Test before a big run

Print one label and scan it with the scanner you will actually use. A quick test catches sizing and contrast problems before you commit to a thousand copies.

Make one now

The barcode generator runs entirely in your browser, so your value is never uploaded. Pick a type, enter the value, set a color, and download a PNG or SVG.

Frequently asked questions

Which barcode type should I choose?
Use Code 128 for general text and numbers, since it is the most versatile. Use EAN-13 or UPC-A for retail products, and Code 39 when a specific system asks for it.
How do EAN and UPC check digits work?
Enter the first 12 digits for EAN-13, or 11 for UPC-A, and the final check digit is calculated and added for you. Paste a full code and it is validated instead.
PNG or SVG for printing labels?
SVG for print, because it stays crisp at any size and keeps the bars sharp. PNG is fine for quick on-screen use.

Ready to try it?

Make Code 128, EAN-13, UPC-A and Code 39 barcodes; export PNG or SVG. Free, in-browser, and 100% private — your data never leaves your device.

Open the Barcode Generator