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
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat 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
Select the barcode format that matches your use case (CODE128 for general use, EAN-13 for retail products, UPC-A for US retail)
Enter the data to encode — the input field will validate against the format requirements (EAN-13 needs 12 digits, the check digit auto-calculates)
Customize the barcode: adjust width, height, line color, background color, and font size for the human-readable number below
Preview the barcode in the display area — scan it with a phone camera to verify it reads correctly before downloading
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:
Format: EAN-13
Input: 978030640615 (12 digits, check digit auto-calculated)
Width: 2 (bar width multiplier)
Height: 100px
Show text: YesEAN-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?
What is a check digit and why does EAN-13 need exactly 12 or 13 digits?
What resolution should I use for printing barcodes?
Can I use these barcodes commercially without a license?
What characters can CODE128 encode?
Why is my printed barcode not scanning?
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