Barcode Generator (Code 128, EAN-13, UPC-A)

Create Code 128, EAN-13 and UPC-A barcodes in your browser, with automatic GS1 check digits, adjustable bar size and SVG or PNG download.

Last updatedHow we build & check our tools
Results will appear here once you enter your values.

Which barcode format should you use?

FormatEncodesTypical use
UPC-A12 digits (11 + check digit)Retail products sold in the US and Canada
EAN-1313 digits (12 + check digit)Retail products everywhere else, books (ISBN-13 starts 978 or 979)
Code 128All 95 printable ASCII charactersWarehouse SKUs, shipping labels, asset tags, internal IDs

UPC-A and EAN-13 are retail symbologies: a point-of-sale scanner expects a number that GS1 has assigned to your company. If you just need to label bins, inventory or equipment, Code 128 is the better choice because it accepts letters and punctuation and is compact for long strings.

How the check digits are calculated

UPC-A and EAN-13 use the GS1 mod-10 check digit. Starting with the rightmost data digit, multiply digits alternately by 3 and 1, add the products, and take the amount needed to reach the next multiple of 10. For 400638133393 the weighted sum is 89, so the check digit is 1 and the full EAN-13 is 4006381333931. Type 11 UPC or 12 EAN digits and the generator appends it; type the full number and it tells you if the last digit is wrong.

Code 128 uses a mod-103 checksum that is encoded as a bar pattern but never printed. Each symbol value is multiplied by its position (the start code counts once), the products are summed, and the remainder after dividing by 103 becomes the check symbol. Strings made only of an even number of digits are packed two digits per symbol with subset C, which roughly halves the barcode width; other text uses subset B.

Every EAN-13 or UPC-A symbol is 95 modules wide: a 101 start guard, six left digits of 7 modules, a 01010 center guard, six right digits and a 101 end guard. The first EAN digit is not drawn directly; it selects the odd/even parity pattern of the left half.

Printing barcodes that actually scan

  • Keep the quiet zone. Leave blank space on both sides (GS1 specifies 11 modules left and 7 right for EAN-13; Code 128 needs 10). The preview includes a 10-module margin; do not crop it.
  • Do not stretch the image. Resizing a PNG to a non-integer scale blurs bar edges. Download the SVG for print layouts, or pick a bar width in whole pixels that matches your printer resolution.
  • Respect minimum size. A UPC-A at 100% magnification is about 37.3 mm wide with bars 22.85 mm tall; GS1 allows 80% to 200%. Thermal label printers at 203 dpi need at least 2 px per module for reliable reads.
  • Use black on white. Red bars, low-contrast colors and glossy laminates can make scanners fail.
  • Buy real product numbers. Generating a UPC does not register it. Retailers and marketplaces check numbers against the GS1 database.

Frequently Asked Questions

Common questions about the Barcode Generator (Code 128, EAN-13, UPC-A)

The generator draws a correct UPC-A barcode for any 12-digit number, but retail use requires a company prefix licensed from GS1 US. Amazon, Walmart and most retailers verify numbers against GS1's registry, so invented numbers will be rejected.
From the same team

Turn your GPU into an OpenAI-compatible API endpoint

Wide Area AI routes your LLM API calls to your own hardware over a Cloudflare Tunnel — free local inference with edge caching and automatic cloud failover. Works with any OpenAI SDK.

Start routing — free

Sources & References

GS1 General Specifications

EAN-13/UPC-A symbol structure, quiet zones, magnification and check digit rules

How to calculate a check digit manually

Mod-10 weighting of 3 and 1 used for UPC and EAN check digits

Code 128

Code 128 symbol table, subsets B and C, and the mod-103 checksum (ISO/IEC 15417)

International Article Number (EAN)

L/G/R digit encodings and first-digit parity patterns