Skip to content
Barcode Generator

Barcode Generator: EAN, UPC and Code 128 at True Print Size

A code that looks perfect on screen can still fail at the till, so this barcode generator adds the check digit for you, sizes the bars in millimetres for your printer and exports true-size SVG and PDF. Nothing you type leaves your browser.

Barcode type

Print size

Type a value to see the barcode at its real print size.

Real X — —
Magnification —
Symbol size — —

Runs in your browser: nothing you type or open is uploaded.

What a barcode generator can and cannot do for you

A barcode generator turns a number or a text into bars. Most codes I have been asked to fix were drawn correctly and then printed badly, so the tool above is built around print: it adds or checks the check digit for you, lets you set the bar width in millimetres, mils or EAN/UPC magnification and snaps it to your printer's dots, and exports vector SVG and PDF at true size, plus PNG at the dpi you choose. You can also build a whole sheet of labels from a pasted list or a local CSV file, and a separate tab calculates check digits and converts UPC-E to UPC-A and back.

Everything runs in your browser. The bars, the PDF and the ZIP files are all drawn by code on this page, so the tool makes no network calls of its own, and the numbers you type and the files you open are not uploaded anywhere.

One honest limit: a barcode generator draws bars, it does not issue numbers. Retail EAN and UPC numbers (GTINs) come from your GS1 member organisation and are licensed to your company. For your own stock, bins and tools you need no licence at all: use Code 128 with codes you invent.

Pick the symbology before you pick the size

The type is decided by where the code will be scanned: a supermarket till expects EAN-13 or UPC-A, a warehouse scanner reads Code 128, an outer carton gets ITF-14.

Common linear barcodes and what they carry
TypeDataWhere I use it
EAN-1313 digits: 12 + check digitRetail products worldwide; books (prefix 978/979 = ISBN)
UPC-A12 digits: 11 + check digitRetail products in the US and Canada
UPC-E8 digits, zero-suppressed UPC-ASmall US packs where UPC-A will not fit
EAN-88 digits: 7 + check digitVery small retail packs, with an EAN-8 number from GS1
ITF-1414 digits (GTIN-14)Outer cartons and cases of a retail product
Code 128Printable ASCII, upper and lower case; digits packed in pairsStock, bins, assets, shipping labels; the base of GS1-128
Code 39A–Z, 0–9 and - . space $ / + %Older industrial and asset systems that require it
Code 93The same characters as Code 39; two check characters added for youCompact upper-case labels when a system asks for it
CodabarDigits and - $ : / . + between start and stop letters A–DLibraries, blood banks and other older workflows
MSIDigits only, with a mod 10 checkShelf and bin labels in older warehouse systems
PharmacodeA whole number from 3 to 131070Pharmaceutical packs that call for it

If nobody forces Code 39 on you, choose Code 128: it has lower case and is much shorter for the same data. The guide to choosing a barcode type walks through retail, cartons, logistics and inventory one by one.

Check digits: the last digit is calculated, never typed

EAN-13, UPC-A, EAN-8, ITF-14 and SSCC all end in a GS1 mod-10 check digit. Type the number without it and the generator appends it; type the full number and it verifies it. When the last digit is wrong you get a message such as "should be 1, not 2" with the full corrected number and a one-click fix, rather than a vague "invalid value". Beside the number the tool explains what the prefix means (978 and 979 are books, 977 is a serial, 020–029 is in-store use) and shows that an EAN-13 starting with 0 is a UPC-A.

Weights 3, 1, 3, 1… starting from the rightmost digit of the body
check digit = (10 − weighted sum mod 10) mod 10

EAN-13 body 590123456789. Twelve digits, so the rightmost gets weight 3 and the leftmost weight 1: 5·1 + 9·3 + 0·1 + 1·3 + 2·1 + 3·3 + 4·1 + 5·3 + 6·1 + 7·3 + 8·1 + 9·3 = 127. The next multiple of ten is 130, so the check digit is 3 and the full number is 5901234567893.

UPC-A body 03600029145. Eleven digits, so here the leftmost digit gets weight 3: 0·3 + 3·1 + 6·3 + 0·1 + 0·3 + 0·1 + 2·3 + 9·1 + 1·3 + 4·1 + 5·3 = 58. Check digit 2, full UPC-A 036000291452, the same item as EAN-13 0036000291452.

EAN-13 barcode 5901234567893 with 11X left and 7X right quiet zones and 95 modules of bars
An EAN-13 is 95 modules of bars plus quiet zones of 11X on the left and 7X on the right.

The most common mistake I see is weighting from the wrong end, which gives a plausible but wrong digit. The Check digit tab shows every digit with its weight and product, so you can follow the sum yourself, and it also takes an SSCC. The step-by-step check digit guide has more examples for EAN-8, ITF-14 and SSCC.

Printing at the right size

Barcode size is set by the X-dimension: the width of the narrowest bar, one module. For EAN-13 and UPC-A the nominal X is 0.33 mm (13 mils) and the symbol may be scaled from 80 % to 200 % (UPC summary). The widths below include the quiet zones, 113 modules for EAN-13 and UPC-A and 81 for EAN-8 (quiet zones per the GS1 General Specifications).

EAN/UPC size by magnification, quiet zones included
MagnificationX (mm)X (mils)EAN-13 / UPC-A widthEAN-8 width
80 %0.26410.429.83 mm21.38 mm
100 %0.3301337.29 mm26.73 mm
150 %0.49519.555.94 mm40.09 mm
200 %0.6602674.58 mm53.46 mm

Bar height scales with the magnification too. Left on auto, the tool draws EAN-13, UPC-A and UPC-E bars 22.85 mm high at 100 % (EAN-8: 18.23 mm), with the digits below them, and it warns when you make them shorter.

Snap the bars to your printer's dots

A printer cannot draw 0.33 mm exactly. It prints whole dots, so every module becomes 2, 3 or 4 dots wide, and if the module is not a whole number of dots some bars grow and others shrink. So I always pick X from the printer: X = dots × 25.4 ÷ dpi, magnification = X ÷ 0.33 mm.

Bar chart of module widths at 203, 300 and 600 dpi; 2 dots at 203 dpi and 3 dots at 300 dpi fall below 80 percent
Whole-dot module widths on common printers, compared with the 80–200 % range.

On a 203 dpi thermal label printer, 2 dots give 0.250 mm, only 75.8 %, which is too small for EAN/UPC. Three dots give 0.375 mm, 113.7 %, and an EAN-13 42.42 mm wide with its quiet zones. On a 300 dpi laser, 4 dots give 0.339 mm, 102.6 %, and a width of 38.27 mm. The generator snaps for you, shows the real X and the magnification on a gauge, and warns below 80 % or above 200 %. The preview is drawn at true size with its width and height marked. The barcode size guide covers mils, quiet zones and bar height in more depth.

Batch labels from a list or a spreadsheet

For a run of shelf or bin labels, paste one value per line or open a CSV or TXT file from your computer; it is read locally in the browser. A sequence builder makes runs such as BIN-0001 to BIN-0250 from a prefix, a start number, a step, zero padding and a suffix, and adds GS1 check digits for EAN/UPC types. A sheet holds up to 500 lines.

Lines that fail are listed with their line number, the value, the problem and a suggested fix, instead of quietly disappearing from the sheet, and one button corrects all the wrong check digits at once. The PDF is laid out on A4 or US Letter with columns, rows and margins you set, and each barcode keeps its true size: a short code stays short rather than being stretched to fill a box. Instead of the sheet you can download a ZIP with one SVG or one PNG per label.

Why a barcode won't scan: my checklist

I go through these in order before blaming the scanner:

  1. Size. EAN/UPC below 80 % (X under 0.264 mm), or a module that does not land on whole printer dots.
  2. Quiet zone. The white margin is cropped, or text, a fold or a box edge sits too close to the bars. Code 128 needs at least 10X each side (Code 128 summary).
  3. Truncated height. Bars cut short to fit the pack. The tool warns when they are shorter than they should be.
  4. Colour and contrast. Red-light scanners do not see red, orange or yellow bars, and many cannot read light bars on a dark background. Black, dark blue or dark brown on white is safe, and the tool warns about red-light colours, light bars on a dark background and low contrast.
  5. Scaled image. A PNG stretched in Word or a design app by a non-whole factor gets uneven bars. Place SVG or PDF, or export PNG at the printer's dpi.
  6. Wrong check digit. A guessed last digit makes the scanner reject the whole code.

Do you need GS1 numbers?

For anything sold through a retailer or a marketplace that asks for a UPC or EAN, yes. Retailers check the company prefix against GS1 data, and a made-up or cheaply resold number can belong to someone else's product. The first three digits of an EAN-13 identify the GS1 member organisation that issued the prefix, not the country where the product was made (EAN summary). Prefixes 020–029 are for a store's internal use only.

For internal labels you need nothing from anyone: inventory, assets, tool cribs and file boxes are better served by Code 128 with your own codes. This is general information, not legal advice; your GS1 organisation sets the rules for its numbers.

The rules behind every code it draws

GS1 check digits use mod 10 with weights 3 and 1 from the right, for 7, 11, 12, 13 and 17-digit bodies (EAN-8, UPC-A, EAN-13, GTIN-14 and SSCC-18). Code 128 uses mod 103: the start value plus each symbol value times its position. The tool uses sets B and C: set C packs pairs of digits, starting with four or more digits at the front, switching for four or more at the end or six or more in the middle. So 12345678 becomes start 105 and 12, 34, 56, 78 with check value 47. That is 79 modules, 99 with quiet zones, and 25.15 mm wide at X 0.254 mm. Code 39 has an optional mod 43 check character, and Code 93 always carries two check characters, C and K, with mod 47.

Sizes follow X = dots × 25.4 ÷ dpi and width = modules × X, quiet zones included; magnification is X divided by 0.33 mm. These cases are recomputed independently and checked against the tool:

Control cases
InputExpected result
EAN-13 body 4006381333934006381333931 (sum 89, check 1)
EAN-13 body 5901234567895901234567893 (sum 127, check 3)
EAN-13 4006381333932Rejected, correct check digit 1
UPC-A body 03600029145036000291452
UPC-A 036000291453Rejected, correct check digit 2
EAN-8 body 963850796385074
EAN-8 96385075Rejected, correct check digit 4
ITF-14 body 123456789012312345678901231
SSCC body 00012345678901234000123456789012343
ISBN 9780306406159780306406157
UPC-E 04252614UPC-A 042100005264
UPC-E 01234565UPC-A 012345000065
Code 128 PJJ123C, start BCheck value 55
Code 128 12345678 at 300 dpi, 3 dotsStart C, 12 34 56 78, check 47; 99 modules, 25.15 mm wide
Code 39 CODE39 with mod 43Check character W
Code 93 TEST93Check characters C = 41 (+) and K = 6
Codabar 12345A12345A
EAN-13 at 203 dpi, 3 dotsX 0.3754 mm, 113.7 %, 42.42 mm wide
EAN-13 at 300 dpi, 3 dotsX 0.254 mm, 77.0 %, warning below 80 %

Before any print run I still scan a test print with the scanner that will read it in real life. The file proves the data; only a test print proves the printer, the label stock and the ribbon.

Guides

Questions and answers

Can I make my own UPC barcode for Amazon or a retail store?

You can draw the bars here, but the number itself must be a GTIN licensed to your company by GS1. Retailers and marketplaces check the company prefix, and made-up or resold numbers can clash with real products.

What is the difference between UPC and EAN?

UPC-A has 12 digits and is used mainly in the US and Canada; EAN-13 has 13 digits and is used worldwide. A UPC-A is the same number as an EAN-13 with a leading 0, and retail scanners read both.

What is the difference between Code 128 and Code 39?

Code 128 encodes upper and lower case letters, digits and symbols, and packs digits in pairs, so it is much shorter. Code 39 has only upper case, digits and a few symbols; use it only when an existing system requires it.

What is the minimum size of an EAN-13 barcode?

80 % magnification: X 0.264 mm and 29.83 mm wide including the quiet zones. Do not cut the bar height to make it fit.

How do I make many barcodes at once from Excel?

Copy the column and paste it into the batch box, or save the sheet as CSV and open it, up to 500 lines at a time. The file is read in your browser, and lines that fail are listed with the reason and a suggested fix.

Can barcodes be printed in colour?

Yes, if the bars are dark and the background light. Red, orange and yellow bars, and light bars on a dark background, often fail with red-light scanners.

Updated · About this site