DevTools Logo

Barcode Generator

SVG & PNG Barcode Generator

Generate barcodes in 8 formats — style, size for print, and export as SVG or PNG, all in your browser.

Barcode settings

Use for: Retail products worldwide

Accepts: Digits only (0–9)

Length: 12 digits (check digit added) or 13 digits

Check digit: The 13th digit is a mod-10 check digit, auto-calculated from the first 12.

Which barcode format should I choose?
  • EAN-13 — Retail products worldwide
  • UPC-A — Products in the US and Canada
  • EAN-8 — Small retail packaging
  • CODE128 — Shipping, inventory and general purpose
  • CODE39 — Industrial and asset labels
  • ITF-14 — Cartons and logistics (shipping containers)
  • MSI — Inventory and warehouse shelf marking
  • Pharmacode — Pharmaceutical packaging control

Valid value· 13/13 digits

Samples:

Check digit valid. Final barcode value: 5901234123457.

Examples

EAN-13 product barcode

Enter 12 digits (check digit auto-computed) or all 13 digits, select EAN13, and download the SVG to include on a product label. EAN-13 is the standard format used on most retail products worldwide.

CODE128 internal label

CODE128 encodes any printable ASCII character, making it ideal for internal part numbers, shipping labels, or any alphanumeric identifier. Enter your value, adjust height to 60px for a compact label, and export as PNG.

Details

This tool generates standard 1-D barcodes entirely in your browser — no data is sent to a server. Choose from eight widely-used formats, enter a value, tweak line width and height, and toggle the human-readable text below the bars. When the value is invalid for the chosen format (wrong character set or digit count) the error is shown instantly. Download the result as a lossless SVG or a rasterised PNG for print or web use.

Examples

Auto-compute the EAN-13 check digit from 12 data digits

Input
format: EAN13
value: 590123412345
Output
Encoded value: 5901234123457

Entering 12 digits triggers the GTIN mod-10 check: alternating weights of 3 and 1 applied to the data digits give a check digit of 7, producing the final 13-digit barcode 5901234123457.

Detect a wrong EAN-13 check digit

Input
format: EAN13
value: 5901234123450
Output
Check digit should be 7, but you entered 0. Correct value: 5901234123457

When a full 13-digit value is entered, the trailing digit is verified against the recomputed check digit; a 'Fix check digit' button rewrites the input to the correct value in one click.

Validate a CODE128 alphanumeric value

Input
format: CODE128
value: ABC-12345
Output
Valid value

CODE128 accepts any printable ASCII character and any length; the format-specific sample list includes identifiers such as ABC-12345 for internal parts.

About this tool

This generator produces one-dimensional barcodes in eight formats: CODE128, CODE39, EAN-13, EAN-8, UPC-A, ITF-14, MSI and Pharmacode. Values are validated against the chosen format's character set and digit count, reporting problems as you type. For EAN-13, EAN-8 and UPC-A the mod-10 check digit is computed for you: enter the shorter data digits and the symbol encodes the full number, and a one-click fix corrects a wrong trailing digit.

Size and appearance are adjustable: line width, bar height, the margin forming the quiet zone, font size, human-readable text under the bars, and bar and background colors. Below an 8 px quiet zone the tool warns you, since scanners need clear space around the symbol to decode it reliably.

For print, prefer the SVG export: bar geometry stays exact at any size, so nothing blurs when a label printer scales the artwork. PNG suits screens and raster workflows — choose a 1×, 2× or 4× scale, opt for a transparent background, and read the physical size in millimetres from the DPI presets (96, 203, 300, 600).

How to use this tool

  1. Choose a format

    Select the symbology that matches the job — EAN-13 for retail, CODE128 for shipping, ITF-14 for cartons.

  2. Enter the value

    Type the value; validation confirms it fits the format and adds the check digit where required.

  3. Adjust size and colors

    Set line width, height, quiet zone, font size and colors until the preview looks right.

  4. Export or print

    Download an SVG, save a PNG at your chosen scale, copy the image, or print directly.

Use cases

Producing a retail EAN-13 label for testing

Enter 12 or 13 digits, let the tool compute the check digit if needed, and download the SVG for placement on a mock product.

Generating an internal CODE128 inventory label

Encode a part number or SKU containing letters and dashes, resize height to 60px for a compact label, and export as PNG for printing.

Verifying a barcode from a printed sample

Type the digits under the printed bars to confirm the EAN-13 or UPC-A check digit matches, catching scanning errors before they leave the warehouse.

Building a Pharmacode for a pharma package

Enter a small integer (3–131070) and use Pharmacode to get the pharmaceutical-specific binary encoding, then export the SVG at 300 DPI for print.

Which format should I use?

FormatTypical use and input
CODE128Shipping and inventory labels; any ASCII string, any length
EAN-13Retail products worldwide; 12 digits, check digit added automatically
UPC-AUS and Canada retail; 11 digits, check digit added automatically
EAN-8Small retail packaging; 7 digits, check digit added automatically
CODE39Industrial and asset labels; uppercase A–Z, digits and a few symbols
ITF-14Cartons and logistics; exactly 14 digits including the check digit
MSIWarehouse shelf and inventory marking; digits, optional Luhn check digit
PharmacodePharmaceutical packaging control; a whole number from 3 to 131070

Common mistakes

Mistake:Typing a 12-digit EAN-13 value without the check digit and assuming the encoded value is the 12-digit input.

Fix:EAN-13 always encodes 13 digits; entering 12 triggers automatic check-digit computation and the displayed 'Encoded value' is the 13-digit full string.

Mistake:Using lowercase letters in CODE39.

Fix:CODE39 only accepts uppercase A–Z, digits and a small set of symbols (- . $ / + % and space). Lowercase input fails validation immediately.

Mistake:Setting a quiet zone (margin) smaller than 8 px.

Fix:Small margins can cause unreliable scans. The tool warns when margin < 8 px; 10 px is the default and a safe lower bound for most scanners.

Mistake:Exporting a low-resolution PNG when print quality matters.

Fix:SVG is lossless at any size and is the recommended export for print. For PNG, raise the scale (2× or 3×) and the DPI to keep edges sharp on a 300 DPI printer.

Frequently asked questions

Why choose SVG over PNG for printed barcodes?

Scanners depend on precise bar widths, and SVG keeps every edge as vector geometry, so the symbol stays sharp at any size or printer resolution. A PNG is a fixed pixel grid that blurs when enlarged; if a raster file is required, raise the scale to 2× or 4× and set the DPI to match your label.

References & standards