About this tool
This free barcode generator makes printable linear barcodes in six common formats: Code 128, EAN-13, EAN-8, UPC-A, Code 39 and ITF-14. It checks your data against the rules of the chosen format, calculates or verifies the check digit for the GS1 number formats, and lets you download the result as a scalable SVG or a PNG image. The barcode is drawn in your browser with the open-source JsBarcode library, so nothing you type is uploaded.
How to use the barcode generator
- Choose a format. Use UPC-A or EAN-13 for a retail product number you already own, Code 128 for general text and internal labels, and ITF-14 for a case-level GTIN.
- Enter the data. For UPC-A, EAN-13, EAN-8 and ITF-14 you can leave off the last digit and the tool adds the check digit, or type the full number and it checks that the last digit is right. Spaces and hyphens in numbers are removed.
- Set the size. Bar width is the width of the narrowest bar in pixels, height is the bar height, and margin is the blank space on each side measured in bar widths. The default of 11 bar widths covers the minimum quiet zones listed further down.
- Download. SVG is a vector file that stays sharp at any size and suits print layouts. PNG is a bitmap for documents and web pages; pick 2x to 4x for a sharper image.
Which barcode format should you use?
| Format | Data it holds | Check digit | Typical use |
|---|---|---|---|
| UPC-A | 12 digits | GS1 mod 10 (last digit) | Retail products, mainly in the US and Canada |
| EAN-13 | 13 digits | GS1 mod 10 (last digit) | Retail products, the same settings as UPC |
| EAN-8 | 8 digits | GS1 mod 10 (last digit) | Small packs where UPC-A or EAN-13 will not fit |
| ITF-14 | 14 digits | GS1 mod 10 (last digit) | Cases and cartons not scanned at checkout |
| Code 128 | All 128 ASCII characters (this tool accepts printable ones, up to 80) | Mod 103, built in and hidden | Shipping, inventory and asset labels |
| Code 39 | 43 characters: 0-9, A-Z, space and - . $ / + % | Optional mod 43 | Older industrial and internal labels |
The retail uses above follow GS1 US's guide to barcode types. Code 128 is specified in ISO/IEC 15417 and Code 39 in ISO/IEC 16388. Code 39 has no lowercase letters, so this tool converts lowercase input to capitals.
A barcode image is not a product number
Any 12 digits with a correct check digit will produce a UPC-A barcode that scans. That does not make it a valid product number. The numbers inside UPC and EAN barcodes are GTINs (Global Trade Item Numbers), managed by GS1, the not-for-profit standards body behind these formats. Brand owners get them by licensing a GS1 Company Prefix or individual GTINs from their local GS1 office, which in the United States is GS1 US. GS1 US notes that each variation of each product you sell requires a unique barcode. If you sell through retailers or online marketplaces, get your numbers from GS1 first, then use this tool or any other generator to draw the bars. For internal labels such as inventory, asset tags or library items, Code 128 or Code 39 with your own numbering needs no license.
Worked example: the check digit
The sample input is the 12-digit number 629104150021, the same example GS1 uses in its guide to calculating a check digit manually. Starting from the rightmost digit and moving left, the digits are multiplied by 3, 1, 3, 1 and so on, and the products are added:
| Digit | 6 | 2 | 9 | 1 | 0 | 4 | 1 | 5 | 0 | 0 | 2 | 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Weight | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 | 1 | 3 |
| Product | 6 | 6 | 9 | 3 | 0 | 12 | 1 | 15 | 0 | 0 | 2 | 3 |
The products add up to 57. The next multiple of ten at or above 57 is 60, and 60 − 57 = 3, so the check digit is 3 and the full EAN-13 is 6291041500213. That is what the tool shows when the page loads. The same rule, weights 3 and 1 counted from the right, gives the check digit for UPC-A, EAN-8 and ITF-14. Because the weights are 3 and 1, changing any single digit always changes the check digit, which is how scanners and checkout systems catch a misread or mistyped number.
Printing tips
- Keep the quiet zone clear. Every linear barcode needs a blank margin on the left and right. Minimums in bar widths (X): EAN-13 11X left and 7X right, UPC-A 9X each side, EAN-8 7X, ITF-14 10X, according to GS1 Sweden's size guide, and Code 128 10X.
- Print at a sensible size. For EAN-13 and UPC-A, the narrowest bar is 0.33 mm at 100% size, and GS1 allows 80% to 200% for retail scanning, which is about 0.26 mm to 0.66 mm. Scale the SVG proportionally so the narrowest bar falls in that range.
- Do not stretch or crop. GS1 US advises against resizing a barcode image or cutting its height to fit a pack. Change the size settings here and download again instead, and keep the bars at full height.
- Use dark bars on a light background. Black on white is best. Avoid red bars, because many scanners use red light and red bars can look the same as the background.
- Test before a big print run. Scan a proof with the scanner or app that will be used. For retail packaging, a barcode verifier checks print quality against the GS1 grading rules.
Common mistakes
- Making up a UPC or EAN for a product sold in stores. It may scan, but it is not registered to you and can clash with another company's product.
- Typing a 12-digit UPC into the EAN-13 field. Choose UPC-A for a 12-digit number. As an EAN-13, the same product number is written with a leading 0.
- Using Code 39 for lowercase text. Use Code 128, which usually also produces a shorter barcode for the same data.
- Exporting a small PNG and enlarging it in a design app. The edges blur and the bar widths become uneven. Use SVG for print.
Use cases
- Product packaging and labels for UPC or EAN numbers you have licensed from GS1.
- Inventory, asset and bin labels with your own Code 128 numbers.
- Shipping cartons with an ITF-14 case code.
- Event tickets, library cards and membership cards with a simple ID.
Need to encode a web address or longer text? A 2D code holds far more data; use the QR Code Generator, and the QR Code Scanner to read one back. For random IDs to put in a Code 128 barcode, try the UUID Generator or the Random Number Generator.
Frequently asked questions
Yes. The images you download are yours to use on labels, packaging and documents without attribution. What is not free is a retail product number: if a store or marketplace needs a UPC or EAN, the number itself should come from GS1, and you then turn it into a barcode here or anywhere else.
Both encode a GTIN and scan at checkout. UPC-A holds 12 digits and is the usual format in the United States and Canada. EAN-13 holds 13 digits and is used in most other countries. A 12-digit UPC can be written as an EAN-13 by adding a 0 at the front.
You can generate a barcode from any 12 digits with a valid check digit, and it will scan. But a retailer looks the number up in its product catalog, and a made-up number is not assigned to your company and may already belong to someone else. Use a number licensed from GS1 for anything sold in stores.
Code 128 is the usual choice. It accepts letters, digits and punctuation, is compact, and has a built-in check character. Code 39 is also widely readable but only supports capitals, digits and a few symbols, and it produces a wider barcode for the same data.
For UPC-A, EAN-13, EAN-8 and ITF-14, the last digit is calculated from the others. If you type a full-length number and the last digit does not match, there is probably a typo. Check the number against the original, or leave off the last digit and the tool will calculate it.
Use SVG for print and packaging, because it is a vector file that stays sharp at any size in design and layout apps. Use PNG for documents, spreadsheets, websites and label software that only accepts images, and choose a 2x to 4x scale so it stays crisp.