WebToolsPlanet
generator Tools

Barcode Generator

Generate barcodes in CODE128, EAN-13, UPC-A, CODE39, and ITF formats — with customizable sizing, colors, and PNG/SVG download.

Last updated: March 25, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is Barcode Generator?

A barcode is a machine-readable representation of data using a pattern of parallel lines (1D linear barcodes) or geometric patterns (2D barcodes like QR codes). Linear barcodes encode data as varying widths and spacings of vertical bars — optical scanners read the white-space pattern by measuring reflected light intensity as the beam sweeps across the barcode. Different barcode symbologies define different encoding rules, check digit algorithms, and valid data types.

The most common 1D barcode formats: **CODE128** (high-density, all 128 ASCII characters, widely used for shipping labels and general logistics), **EAN-13** (European Article Number — the global standard for retail product barcodes, 13 digits with a GS1 check digit), **UPC-A** (Universal Product Code — the US retail standard, 12 digits, a subset of EAN-13), **CODE39** (alphanumeric, uppercase letters + digits + a few symbols, common in industrial and healthcare), and **ITF** (Interleaved 2 of 5 — numeric only, used on shipping cartons). This tool generates all formats as scannable SVG or PNG images ready for print or screen display.

How to Use Barcode Generator

1

Select the barcode format that matches your use case (CODE128 for general use, EAN-13 for retail products, UPC-A for US retail)

2

Enter the data to encode — the input field will validate against the format requirements (EAN-13 needs 12 digits, the check digit auto-calculates)

3

Customize the barcode: adjust width, height, line color, background color, and font size for the human-readable number below

4

Preview the barcode in the display area — scan it with a phone camera to verify it reads correctly before downloading

5

Click "Download PNG" for print use (set DPI to 300 for physical printing) or "Download SVG" for scalable vector use

Common Use Cases

  • Generating EAN-13 barcodes for retail products to register with GS1 for global retail distribution
  • Creating CODE128 barcodes for internal inventory management and asset tracking labels
  • Producing UPC-A barcodes for products sold in US retail stores (Target, Walmart, Amazon FBA)
  • Generating CODE39 barcodes for healthcare applications — patient wristbands, medication labels
  • Making shipping label barcodes (CODE128 encoding carrier tracking numbers for FedEx, UPS, USPS)
  • Creating ITF-14 barcodes for printed shipping cartons containing retail products
  • Generating barcodes for membership cards, gift cards, or loyalty programs
  • Creating library catalog barcodes for book inventory systems

Example Input and Output

Generating an EAN-13 barcode for a retail product:

EAN-13 barcode configuration
Format: EAN-13
Input: 978030640615  (12 digits, check digit auto-calculated)
Width: 2 (bar width multiplier)
Height: 100px
Show text: Yes
Generated barcode details
EAN-13 Barcode Generated ✅

Full barcode: 9780306406157
Check digit: 7 (automatically calculated using GS1 Luhn algorithm)

Human-readable number below bars: 978030640615 7

Structure:
  Country prefix: 978 (ISBN/Bookland)
  Manufacturer: 030640
  Product: 615
  Check: 7

Download: barcode_9780306406157.png (300 DPI)

Client-Side Processing

All barcode generation runs in your browser using the JsBarcode library. The data you encode (product codes, internal IDs) is never sent to our servers.

SVG vs PNG for Barcodes

Use SVG when: embedding barcodes in web pages (scales perfectly, small file size), printing from a browser or design tool (vector scales to any DPI). Use PNG when: submitting to external systems that only accept raster images, or printing from software that doesn't support SVG. For PNG print: generate at 300 DPI (or 600 DPI for small barodes). SVG at width="38mm" prints at the correct physical size on any printer.

GS1 and Retail Barcode Registration

For retail products: register at gs1us.org (US) or gs1.org (global) to obtain a GS1 Company Prefix. The prefix identifies your company. You then assign product numbers (GTINs) from your prefix range. Each product variant (size, color, flavor) needs its own unique GTIN. Amazon requires GS1 barcodes for new ASINs (Amazon Standard Identification Numbers) as of 2022 — they verify GTIN ownership through the GS1 registry.

Frequently Asked Questions

Which barcode format should I use for my product?
For retail products sold globally: EAN-13 (requires a GS1 Company Prefix license from gs1.org — ~$250/year for a prefix, or ~$30 per individual barcode from GS1 US). For US-only retail: UPC-A (subset of EAN-13). For internal use (no retail): CODE128 or CODE39 — no license required. For shipping logistics: CODE128 is the standard (FedEx, UPS, USPS all use CODE128). For numeric-only shipping cartons: ITF-14. For healthcare (FDA-compliant): CODE128 or Code 39.
What is a check digit and why does EAN-13 need exactly 12 or 13 digits?
A check digit is a calculated validation character appended to a barcode number that allows scanners to detect transcription errors. EAN-13's check digit formula: multiply alternating digits by 1 and 3 (weights), sum all products, find the remainder when divided by 10, subtract from 10 (result 10 = 0). Enter 12 digits and the tool auto-calculates and appends the 13th check digit. If you enter all 13, the tool validates that the check digit is correct.
What resolution should I use for printing barcodes?
For reliable barcode scanning: minimum 300 DPI (dots per inch) for physical print. 600 DPI is better for small barcodes. The bar width matters most: the minimum element width (narrowest bar) should be at minimum 0.25mm for CODE128 and EAN-13. Below this, ink spread during printing can fill the white spaces and cause scan failures. Test your printed barcode with at least 3 different scanner types (handheld laser, CCD, phone camera) before production print runs.
Can I use these barcodes commercially without a license?
It depends on the use case: for internal use (inventory, warehouse, library, internal tracking) you can generate any barcode format freely — no license required. For retail products sold in stores or on platforms like Amazon FBA, Walmart, Target: you need GS1-licensed barcodes. Using non-GS1 barcodes on retail products violates retailer policies and may result in product rejection. GS1 barcodes ensure globally unique product identification. This tool generates the barcode image — GS1 registration is handled separately at gs1.org.
What characters can CODE128 encode?
CODE128 can encode the full 128 ASCII character set (0–127), including uppercase and lowercase letters, digits, spaces, and punctuation. It uses three code sets: Code A (control characters + uppercase + digits), Code B (printable ASCII 32–127), and Code C (numeric pairs 00–99 encoded in 1 character for high-density numeric data). Most implementations auto-select the optimal code set or switch dynamically for best density. This is why CODE128 is the most versatile 1D barcode for general use.
Why is my printed barcode not scanning?
Common causes: (1) Print resolution too low — reprint at 300+ DPI. (2) Barcode too small — CODE128 should be at minimum 19mm tall (6.35mm for reduced height). (3) Ink bleed — dark ink spreading into white bars makes them too narrow; increase the bar width multiplier. (4) Insufficient quiet zones — barcodes need white margins (quiet zones) on each side: minimum 10 narrow bars width. (5) Low contrast — use black bars on white background; never use dark backgrounds or colored bars on colored backgrounds.

How This Tool Works

Barcode generation uses the JsBarcode JavaScript library (or equivalent). For each symbology, the library implements the specific encoding algorithm: for CODE128, it selects code sets A/B/C per segment and encodes each character as a pattern of 6 elements (3 bars and 3 spaces with defined widths). The check digit is computed using the symbology-specific checksum algorithm. The encoded pattern is rendered to an SVG or Canvas element with the configured widths, heights, and colors.

Technical Stack

JsBarcode libraryHTML5 Canvas / SVG renderingGS1 check digit algorithmClient-side only