Barcode Generator

Create Code 128, EAN-13, UPC-A, EAN-8, Code 39, ITF and ITF-14 barcodes, with check digits calculated for you, and download them as SVG for print or PNG for screens.


Runs entirely in your browser. Nothing you type or upload is sent to a server.

How a barcode is read

A one-dimensional barcode is a sequence of bars and spaces whose widths encode characters. A scanner sweeps across it, measures each width relative to the narrowest one, and looks the pattern up in the format's table. Because only the ratios of widths matter, a barcode can be printed large or small, as long as the narrowest bar is still wide enough for the scanner to resolve.

Every barcode starts and ends with a special start and stop pattern, so the scanner knows where the data is and which way round it is reading. On either side there must be a blank margin called the quiet zone, at least ten times the width of the narrowest bar for most formats. GS1 sets the retail minimums: 11 bar widths on the left of an EAN-13 and 7 on the right, 9 on each side of a UPC-A, and 7 on each side of an EAN-8. This generator always leaves at least that much. Trimming that margin to save space is the single most common reason a perfectly good barcode will not scan.

Choosing a format

FormatEncodesUsed for
Code 128All 128 ASCII charactersShipping labels, inventory, asset tags, tickets. The best default.
EAN-1313 digitsRetail products worldwide, plus books (ISBN) and magazines
UPC-A12 digitsRetail products in the United States and Canada
EAN-88 digitsRetail packages too small for an EAN-13
Code 39A to Z, 0 to 9 and - . space $ / + %Older industrial, automotive and government systems
ITFDigits, in pairsWarehouse and industrial labels with an even number of digits
ITF-1414 digits, the last a check digitCorrugated shipping cartons holding retail products

Code 128 is compact because it switches between character sets as it goes, packing long runs of digits two to a symbol. Code 39 is wider for the same data but needs no check digit, because every character is self-checking, which is why older equipment still relies on it.

Product barcodes need a GS1 number

Drawing a UPC or EAN is easy. The number inside it is the part that matters. Retail barcodes carry a GTIN (Global Trade Item Number), and each one must identify exactly one product in the world. GS1, the nonprofit that runs the system, licenses company prefixes and individual numbers. Major retailers and online marketplaces check GTINs against the GS1 database and reject numbers that do not belong to the seller. For internal labels that never leave your business, use Code 128 with any numbering you like.

How check digits work

EAN and UPC numbers end in a check digit calculated from the others. For UPC-A, multiply the digits in odd positions by 3, add the digits in even positions, and pick the digit that brings the total up to a multiple of ten. For 03600029145:

0×3 + 3 + 6×3 + 0 + 0×3 + 0 + 2×3 + 9 + 1×3 + 4 + 5×3 = 58
58 + 2 = 60, a multiple of 10, so the check digit is 2  →  036000291452

EAN-13 does the same with the weights reversed, 1 and 3 starting from the left. A single misread digit, or two neighboring digits swapped, almost always changes the result, so the scanner rejects the read instead of ringing up the wrong product. Type the number without its last digit and this generator calculates it for you.

Printing barcodes that scan

  • Use the SVG for print. It is a vector, so bar edges stay perfectly sharp at any size. A small PNG scaled up gets blurry edges that change the bar widths.
  • Black on white works best. Avoid red, orange and yellow bars: most scanners read with red light, under which those colors look as light as the paper.
  • Do not stretch a PNG to fit. Scaling a bitmap by an uneven amount resamples the bars to different pixel widths, which blurs the ratios the scanner measures. Resize the SVG instead, or use the bar width setting, and never shrink a barcode so far that the narrowest bar is too thin for the scanner to see.
  • Keep the quiet zone on both sides, and keep the human-readable digits underneath so a cashier can type the number if a label is damaged.

Need to store a link, WiFi details or more than a short code? Use the QR Code Generator instead.

Frequently Asked Questions

What is a barcode?
A barcode is data written as a row of dark bars and light spaces of different widths. A scanner measures those widths and turns them back into the digits or letters they encode, which is faster and far more accurate than typing a number by hand.
Which barcode type should I use?
For products sold in shops, use the EAN-13 or UPC-A number assigned to you by GS1. For anything internal, such as inventory, asset tags, tickets or shipping labels, Code 128 is the best default: it encodes letters, digits and punctuation and is the most compact of the common types. Use ITF for digit-only codes on shipping cartons, and Code 39 when older equipment requires it.
Can I make my own UPC or EAN for products I sell?
You can draw any number, but retailers and marketplaces only accept product numbers licensed from GS1, the organization that issues them, because each number must identify exactly one product worldwide. A made-up number may already belong to someone else's product. Buy a GS1 company prefix or individual GTINs, then use this tool to draw the barcode.
What is a check digit?
The last digit of an EAN or UPC is calculated from the others, so a scanner can tell when a digit has been misread. If you type 12 digits for EAN-13, 11 for UPC-A or 7 for EAN-8, the generator calculates the check digit and adds it for you. If you type the full number, it confirms the check digit is right.
Why won't my barcode scan?
The common causes are printing too small, cropping the blank margin on either side, low contrast, red or orange bars (scanners use red light, so red bars look the same as the background), stretching the image so the bars blur, and a wrong check digit. Print from the SVG and keep the white space around the bars.
What's the difference between a barcode and a QR code?
A barcode stores a short number or code in one dimension and is read by the cheap laser and camera scanners at every checkout. A QR code stores much more data in two dimensions, survives damage, and is read by phone cameras. For links and contact details, use the QR Code Generator.
What size should I print a barcode?
A standard UPC-A is about 37.3 mm wide and 25.9 mm tall (1.47 by 1.02 inches) at 100% size, and GS1 allows from 80% to 200% of that. For other formats, keep bars at least about 0.25 mm wide and the code at least 15 mm tall. Download the SVG so the printer gets perfectly sharp edges at any size.
The Internet Omni-Tool