# 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.

- URL: https://generate.now/barcode
- Category: Media & assets
- Price: free, no account required
- AI-powered: no (runs in the browser)
- Last updated: 2026-11-11

## 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.

## 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.

## 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.

| Type | Holds | Check | Width |
| --- | --- | --- | --- |
| Code 128 | ASCII 32 to 126, up to 80 characters here | Modulo 103 character, added | 121 modules |
| EAN-13 | 13 digits | Last digit, GS1 modulo 10 | 113 modules |
| UPC-A | 12 digits | Last digit, GS1 modulo 10 | 113 modules |
| EAN-8 | 8 digits | Last digit, GS1 modulo 10 | 81 modules |
| Code 39 | A to Z, 0 to 9, space and - . $ / + %, up to 40 here | None | 243 modules |

*The five barcode types this tool draws*

## 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 entered | Type | Weighted sum | Check digit |
| --- | --- | --- | --- |
| 629104150021 | EAN-13 | 57 | 3 |
| 400638133393 | EAN-13 | 89 | 1 |
| 03600029145 | UPC-A | 58 | 2 |
| 1234567 | EAN-8 | 60 | 0 |

*Check digits for four numbers*

## When to use the Barcode Generator

- Label shelves, bins and assets with Code 128 for a handheld scanner
- Check or complete the last digit of an EAN-13 or UPC-A number
- Put a sample barcode in a packaging mock-up or a test fixture
- Export a barcode as SVG to place in a print layout

## Barcode Generator examples

### EAN-13, 629104150021

```
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

```
036000291452
```

Eleven digits entered, check digit 2 added.

### EAN-13, 6291041500215

```
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

```
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.

## 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.

## References

- [ISO/IEC 15417:2007, Code 128 bar code symbology specification](https://webstore.iec.ch/publication/10265): ISO/IEC. The standard that defines Code 128: character encoding, dimensions and the check character.
- [EAN/UPC Symbol Reference](https://www.gs1ca.org/gs1ca-components/documents/EAN-UPC-Symbol-Reference.pdf): GS1 Canada. Nominal module width of 0.33 mm, the 80% to 200% size range, and symbol widths and minimum bar heights at each size.
- [Guidelines for size](https://gs1.se/en/guides/how-to-guides/size-guide/): GS1 Sweden. Quiet zones in modules: 11 left and 7 right for EAN-13, 7 each side for EAN-8, 9 each side for UPC-A.
- [Check Digit Calculator](https://www.gs1us.org/tools/check-digit-calculator): GS1 US. GS1's own calculator for GTIN-8, GTIN-12 and GTIN-13 check digits, to compare results against.
- [How to Get UPC Barcodes for Products](https://www.gs1us.org/upcs-barcodes-prefixes/how-to-get-a-upc-barcode): GS1 US. How product numbers are licensed, as a single GTIN or a company prefix.

## Related tools

- [QR Code Generator](https://generate.now/qr-code): Make a QR code for a URL, text, a WiFi network or a vCard contact. Download as SVG or PNG up to 2,048 px. Codes are static, with no redirect or expiry.
- [Test Credit Card Numbers](https://generate.now/credit-card): Stripe's published test card numbers in one filterable list: successful payments by brand, declines by reason, and 3D Secure. They work in test mode only.
- [UUID Generator](https://generate.now/uuid): Generate UUID v4, v7 or v1, one at a time or up to 1,000. Output as standard, uppercase, braces (GUID), no hyphens, URN or Base64, and decode any UUID you paste.

## More in Media & assets

- [Favicon Generator](https://generate.now/favicon): Make a favicon from text, an emoji or an image. Get a zip with favicon.ico, six PNG sizes from 16 to 512 px, site.webmanifest and the HTML link tags.
- [Placeholder Image Generator](https://generate.now/placeholder): Make a placeholder image at any size from 16 to 4,096 px. Set the background, text color and label, then download SVG or PNG or copy a data: URL.

[All 39 tools](https://generate.now/tools)
