Skip to content

Barcode Generator

Make Code 128, EAN-13, UPC-A, EAN-8 and Code 39 barcodes in your browser. Check digits are calculated and verified. Download as SVG or PNG.

Code 128 · 165 modules wide with quiet zones · SVG 330 × 111 px · PNG 660 × 222 px

ABC-1234567890
Barcode type

Letters, digits and punctuation (printable ASCII), up to 80 characters.

13 symbol characters, digit pairs packed with subset C, check value 24 (modulo 103).

PNG scale (multiplies bar width and height)
Text

The barcode is drawn in your browser and the value is not sent to our server. The preview shrinks to fit a narrow screen; the downloaded files are always exact.

01 · Definition

What is a barcode generator?

A barcode generator turns a number or a short text into a pattern of bars and spaces that a scanner reads back. Retail products carry EAN-13 or UPC-A, which hold a product number ending in a check digit. Code 128 and Code 39 hold letters and digits and are used on internal labels for stock, assets and parcels.

02 · Overview

How the Barcode Generator works

The tool draws five linear barcode types from a number or text you type. EAN-13, UPC-A and EAN-8 take the digits with or without the final check digit: a missing one is added, and a wrong one is reported with the correct value. Code 128 covers printable ASCII, switches between subsets B and C to keep the symbol as short as possible, and adds its modulo 103 check character. Code 39 covers capitals, digits and seven symbols. Every symbol includes its quiet zones and optional text under the bars. Bar width and height are adjustable, and the PNG is drawn at a whole number of pixels per bar module so the edges stay sharp. The barcode is drawn in your browser and the value is not sent to our server.

03 · Guide

Code 128 vs EAN-13 vs UPC-A vs Code 39

Pick the type by what has to scan it. A shop till expects EAN-13 or UPC-A, and the number in it has to be a GTIN licensed from GS1. For labels you control, such as shelf locations, asset tags and order numbers, Code 128 is the usual choice: it holds any printable ASCII character and is much narrower than Code 39 for the same content.

The widths below were counted by this tool's encoder for the 12-digit value 123456789012 (8 digits for EAN-8) and include the quiet zones. Multiply by the width of one module to get the printed width. Code 128 is short for digits because subset C packs two digits into each symbol character.

TypeHoldsCheckWidth
Code 128ASCII 32 to 126, up to 80 characters hereModulo 103 character, added121 modules
EAN-1313 digitsLast digit, GS1 modulo 10113 modules
UPC-A12 digitsLast digit, GS1 modulo 10113 modules
EAN-88 digitsLast digit, GS1 modulo 1081 modules
Code 39A to Z, 0 to 9, space and - . $ / + %, up to 40 hereNone243 modules
The five barcode types this tool draws

04 · Guide

How the EAN and UPC check digit is calculated

Start from the right-hand end of the number without its check digit. Multiply the last digit by 3, the one before it by 1, the one before that by 3, and so on. Add the results. The check digit is whatever brings that total up to the next multiple of ten, or 0 if it is already one.

For 629104150021 the products are 6, 6, 9, 3, 0, 12, 1, 15, 0, 0, 2 and 3, which add up to 57. The next multiple of ten is 60, so the check digit is 3 and the full EAN-13 is 6291041500213. The same rule gives the last digit of UPC-A and EAN-8. The rows below were computed with this tool.

Digits enteredTypeWeighted sumCheck digit
629104150021EAN-13573
400638133393EAN-13891
03600029145UPC-A582
1234567EAN-8600
Check digits for four numbers

05 · Use cases

When to use the Barcode Generator

  1. 01

    Label shelves, bins and assets with Code 128 for a handheld scanner

  2. 02

    Check or complete the last digit of an EAN-13 or UPC-A number

  3. 03

    Put a sample barcode in a packaging mock-up or a test fixture

  4. 04

    Export a barcode as SVG to place in a print layout

06 · Examples

Barcode Generator examples

EAN-13, 629104150021

ex 01

6291041500213

Twelve digits entered, check digit 3 added. The symbol is 95 modules of bars plus quiet zones of 11 and 7 modules, 113 in all.

UPC-A, 03600029145

ex 02

036000291452

Eleven digits entered, check digit 2 added.

EAN-13, 6291041500215

ex 03

The check digit is wrong. For 629104150021 it should be 3, not 5.

A 13-digit number is verified instead of redrawn. One button replaces it with 6291041500213.

Code 128, ABC-1234567890

ex 04

13 symbol characters, digit pairs packed with subset C, check value 24 (modulo 103)

The letters use subset B and the ten digits use five subset C characters. 165 modules wide with quiet zones.

07 · FAQ

Barcode: frequently asked questions

Which barcode type should I use?

Use EAN-13 for a product sold in shops, or UPC-A in the United States and Canada. Use Code 128 for anything scanned inside your own business: it holds letters, digits and punctuation in the least space. Use Code 39 only when older equipment requires it, and EAN-8 only if you were issued an 8-digit number.

How is the check digit worked out?

Counting from the right of the number without its check digit, digits are multiplied by 3 and 1 in turn and added up. The check digit is the amount that takes the sum to the next multiple of ten. For 629104150021 the sum is 57, so the check digit is 3. Enter 12 digits and the tool adds it, or enter all 13 and the tool verifies it.

Can I put these barcodes on products I sell?

The bars are drawn to the same patterns a commercial tool uses, but the number has to be yours. Retail numbers (GTINs) are licensed from GS1: GS1 US, for example, licenses a single GTIN or a company prefix for a range of products. This tool does not issue numbers and does not check that a number is registered.

What size should an EAN or UPC barcode be printed?

GS1 Canada's symbol reference gives a nominal module width of 0.33 mm, with 80% to 200% of that allowed (0.26 mm to 0.66 mm). At 0.33 mm an EAN-13 or UPC-A is 37.29 mm wide including quiet zones, with bars at least 22.86 mm tall. The tool shows the 0.33 mm width under each EAN and UPC symbol. Scale the SVG so one module matches the width you need.

Should I download SVG or PNG?

Use SVG for print and for anything that will be resized: it is vector, so bars stay exact at any size. Use PNG for documents and screens. The PNG is drawn with a whole number of pixels per module (bar width times the PNG scale), so no bar edge is blurred. Do not resize the PNG by a fraction afterwards.

Will the barcode scan?

Each type was tested by decoding generated symbols with the open-source ZXing library at 1, 2 and 3 pixels per module. Whether a printed label reads depends on its size, contrast and print quality, and on leaving the white quiet zones clear, so scan a sample with your own equipment before printing a batch.

Which barcode types are not supported?

The tool does not draw UPC-E, ITF-14, GS1-128 (Code 128 with FNC1 and application identifiers), Codabar or 2D codes such as Data Matrix. Code 128 here does not encode control characters or text outside ASCII. For a 2D code, use the QR code generator.

Is the value I type sent to your server?

No. The barcode is encoded and drawn in the page, and the SVG and PNG files are created in your browser. The page loads standard page analytics, which record the visit and that a download or copy button was used, not the value.

08 · Reference

Specs and further reading

These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.

09 · More

Tools that pair with Barcode

Last updated .