Barcode generator

Type a product number or any text and get a scannable barcode. EAN-13 and UPC-A get their check digit added or verified; Code 128 picks its most compact encoding. Download it as SVG or PNG.

Barcode type

12 digits (the check digit is added) or 13 digits (the check digit is verified).

Product barcodes for retail (EAN/UPC) must use a number licensed to your company by GS1. Making up a number can clash with someone else's product.

Barcode

Check digit 1 added: 4006381333931

Made in your browser. Nothing is sent or put in the page address.

Last updated:

How it works

For EAN-13 and UPC-A, the page adds the GS1 check digit: starting from the rightmost digit, it multiplies every other digit by 3 and the rest by 1, adds them up and takes the amount needed to reach the next multiple of 10. If you type the full number, it checks that last digit instead and tells you the right one if it doesn't match. The digits are then drawn with the standard left-hand and right-hand patterns, guard bars and quiet zones.

For Code 128, the page switches between character set B (letters, digits and symbols) and set C (pairs of digits) to use the fewest symbols, then adds the mod-103 checksum and the stop pattern. Example: 400638133393 gets check digit 1, so the EAN-13 is 4006381333931.

A barcode is a number or a short text written as bars that a scanner can read in a split second. This generator makes the three formats most people need: EAN-13 and UPC-A for products, and Code 128 for everything else, from shipping labels to inventory tags. Everything happens in your browser and there is nothing to install.

How to use it

  1. Pick the type: EAN-13, UPC-A or Code 128.
  2. Type the code. For EAN-13 you can type 12 digits and let the page add the check digit, or all 13 to have it checked. For UPC-A it’s 11 or 12 digits. Spaces and dashes are ignored.
  3. Choose the bar width (1 to 4 pixels per module) and whether to show the digits under the bars.
  4. Download the result as SVG or PNG.

If something is wrong, such as a letter in an EAN-13, the wrong number of digits or a check digit that doesn’t match, the page tells you instead of drawing a barcode that won’t scan.

The check digit, step by step

EAN-13 and UPC-A end in a check digit that lets the scanner catch a misread. The rule, set by GS1, is the same for both. Take the example 400638133393:

  1. Starting from the right, multiply the digits by 3, 1, 3, 1 and so on: 3, 9, 3, 3, 3, 1, 8, 3, 6, 0, 0, 4.
  2. The digits multiplied by 3 are 3, 3, 3, 8, 6 and 0, which add up to 23, times 3 is 69.
  3. The others are 9, 3, 1, 3, 0 and 4, which add up to 20.
  4. 69 + 20 = 89. The next multiple of 10 is 90, so the check digit is 1.

The full code is 4006381333931. For the UPC-A 03600029145 the same steps give 58, so the check digit is 2 and the code is 036000291452. A Montana Department of Agriculture guide for producers selling to stores describes the same structure: a company prefix, an item number and a final check digit.

How the bars are built

Each EAN-13 and UPC-A digit takes seven modules, drawn as two bars and two spaces. The left half uses one set of patterns and the right half another, so a scanner knows which way the code is facing. In an EAN-13, the first digit isn’t drawn as bars at all; it’s encoded in which of two pattern sets the next six digits use. Taller guard bars mark the start, the middle and the end.

Code 128 works differently. Each symbol is 11 modules wide, made of three bars and three spaces of one to four modules. It has three character sets; this generator uses set B for text and set C, which packs two digits into one symbol, for runs of digits. ABC123456 is encoded as A, B, C, a switch to set C, then 12, 34 and 56. That’s 8 symbols with the start code instead of 10. A checksum (the weighted sum of the symbols, modulo 103) and a stop pattern close the code.

Getting real product numbers

The bars only carry a number. For retail, that number must be unique worldwide, so stores require GTINs issued by GS1 US or the GS1 office in your country. Marketplaces such as Amazon check product codes against the GS1 database.

UseFormatWhere the number comes from
Products in US storesUPC-AGS1 US
Products in other countriesEAN-13Your country’s GS1 office
BooksEAN-13 starting with 978 or 979Your country’s ISBN agency
Warehouse, shipping, assetsCode 128Your own system

Printing tips

  • Keep the white margin on both sides. The page leaves the standard quiet zone: 11 modules on the left of an EAN-13, 9 on each side of a UPC-A and 10 on each side of a Code 128.
  • Print dark bars on a light background. Red bars, or bars on a red or dark background, often fail.
  • Don’t squeeze the barcode to fit. Resize it evenly, and prefer the SVG for print.
  • Scan a test print with a phone before printing hundreds of labels.

Frequently asked questions

Can I use these barcodes on products I sell in stores?

The barcode itself will scan, but retailers only accept product numbers your company has licensed from GS1, the organization that issues UPC and EAN numbers. Making up a number can collide with another company's product. Get a GS1 Company Prefix or single GTINs from GS1 US, then type those numbers here.

What's the difference between UPC-A and EAN-13?

UPC-A has 12 digits and is the standard in the US and Canada. EAN-13 has 13 digits and is used in the rest of the world. A UPC-A is an EAN-13 with a leading zero, and the bars are identical: 036000291452 as a UPC-A scans the same as 0036000291452 as an EAN-13.

When should I use Code 128?

For internal labels: inventory, shipping boxes, asset tags, library cards or anything with letters. It holds any plain ASCII text and packs long runs of digits tightly. It isn't for retail product codes, which must be EAN-13 or UPC-A.

SVG or PNG?

SVG is a vector file: it stays sharp at any size and is the best choice for print and label design software. PNG is a picture made of pixels at the bar width you chose, handy for documents and websites. If you print a PNG, don't stretch it, or the bars can blur and fail to scan.

Why won't my barcode scan?

The usual causes are printing too small, too little white space on the sides, low contrast or a stretched image. Keep the quiet zones the page leaves around the bars, print black on white, and test with a phone scanner app before printing a batch. For retail, GS1 sets minimum and recommended sizes.