
Barcode Generator
Learn how to use the Barcode Generator tool to create Code 128, EAN-13, UPC-A, and Code 39 barcodes. Download as PNG or SVG.
Last reviewed: April 2026New to this tool? Click here for instructions
How to Use the Barcode Generator
To use the Barcode Generator, follow these steps:
1. Choose a barcode format: Select Code 128, EAN-13, UPC-A, or Code 39 using the chips at the top.
2. Enter your data: Type the text or number to encode. EAN-13 requires exactly 12-13 digits; UPC-A requires exactly 11-12 digits; Code 39 supports uppercase letters, digits, and some special characters.
3. Click Generate: The barcode will appear in the preview area.
4. Download: Click Download PNG for a raster image or Download SVG for a scalable vector file.
When to Use the Barcode Generator
Use the Barcode Generator when you need to encode text or numbers into a barcode format for various applications, such as inventory management, shipping labels, and product identification.
How It Works
The Barcode Generator allows you to create barcodes online without the need for any server upload. It supports multiple barcode formats including Code 128, EAN-13, UPC-A, and Code 39. The tool uses a client-side approach, meaning all processing occurs in your browser, ensuring privacy and security.
Tips, Edge Cases, or Limitations
Ensure your input data is correct and meets the format requirements for accurate barcode generation.
For best results, use high-resolution printers when downloading SVG files for print purposes.
The tool is free and 100% client-side, making it accessible and secure for all users.
Frequently Asked Questions
Generate standard-compliant barcodes in Code 128, EAN-13, UPC-A, and Code 39 formats — export as PNG or SVG, with automatic check digit calculation, configurable DPI, and bulk ZIP download. No server upload, no account, no file size limits.
What This Tool Does
The Barcode Generator produces retail- and logistics-ready barcodes in four widely deployed symbologies: Code 128 (ISO/IEC 15417), EAN-13 (ISO/IEC 15420), UPC-A, and Code 39 (ISO/IEC 16388). Every barcode renders client-side in your browser — your SKU strings, product numbers, and serial codes never touch a server. Output formats are PNG (raster, configurable DPI from 72 to 600) and SVG (vector, infinitely scalable without pixelation), making the tool suitable for thermal shipping labels, retail shelf stickers, inventory asset tags, and HTML web embeds alike. For EAN-13 and UPC-A, the tool applies the GS1 modulo-10 check digit algorithm automatically, so generated codes conform to the GS1 General Specifications and ISO/IEC 15420 out of the box.
How to Use It: Step-by-Step with Worked Example
Step-by-step instructions
- Select a barcode format from the Format dropdown: Code 128, EAN-13, UPC-A, or Code 39.
- Type or paste your data string into the input field. For EAN-13, entering 12 digits is sufficient — the tool appends the check digit automatically.
- Choose your Export Format: PNG for fixed-resolution printing, SVG for scalable or web use.
- Set DPI to match your output device — 300 for most thermal label printers, 203 for lower-resolution Zebra-class printers.
- Optionally set width and height in pixels. The tool labels the equivalent inch or millimetre dimension based on your chosen DPI.
- Click Generate. The barcode renders instantly in the output pane, including quiet zones and human-readable digits beneath the bars.
- Click Download PNG or Download SVG to save the file. Use the Try Example button to pre-load a realistic EAN-13 payload and see the output immediately.
Worked example: EAN-13 barcode for a retail product
The following walkthrough uses a real GS1-structure EAN-13 payload, sized for a 4″ × 1.5″ thermal label at 300 DPI — a standard format for warehouse pick-and-ship workflows.
- Barcode format
- EAN-13
- Input value
- 590123412345 (12 digits — no check digit supplied)
- Export format
- PNG
- DPI
- 300
- Label size
- 4″ × 1.5″ thermal printer (1200 × 450 px at 300 DPI)
After selecting EAN-13 and entering 590123412345, the tool computes the GS1 modulo-10 check digit: alternating multiply by 1 and 3 across the 12 digits yields a sum of 43; the check digit is 10 − (43 mod 10) = 7. The complete 13-digit code becomes 5901234123457. With PNG output, 300 DPI, 1200 × 450 px, clicking Generate renders the full EAN-13 symbol — start guard bars (101), six left-side digits encoded with odd/even parity patterns, centre guard (01010), six right-side digits, and stop guard (101) — with the 13-digit string printed below in OCR-B. Downloading the PNG and scanning it with any retail barcode reader returns 5901234123457.
Worked Example Output
- Input
590123412345(EAN-13, 12-digit base)- Auto-computed check digit
- 7 → full value
5901234123457 - Export
- PNG, 300 DPI, 1200 × 450 px (4″ × 1.5″)
Check digit calculation steps
| Position (L→R) | Digit | Multiplier (1 or 3) | Product |
|---|---|---|---|
| 1 | 5 | 1 | 5 |
| 2 | 9 | 3 | 27 |
| 3 | 0 | 1 | 0 |
| 4 | 1 | 3 | 3 |
| 5 | 2 | 1 | 2 |
| 6 | 3 | 3 | 9 |
| 7 | 4 | 1 | 4 |
| 8 | 1 | 3 | 3 |
| 9 | 2 | 1 | 2 |
| 10 | 3 | 3 | 9 |
| 11 | 4 | 1 | 4 |
| 12 | 5 | 3 | 15 |
| Sum | 43 | ||
| Check digit = 10 − (43 mod 10) | 7 | ||
Expected output: EAN-13 barcode image with auto-appended check digit 7, final value 5901234123457, rendered as a 300 DPI PNG at 1200 × 450 pixels (4″ × 1.5″), with correctly sized quiet zones and OCR-B human-readable digits below the bars.
Supported Barcode Formats: Code 128, EAN-13, UPC-A, Code 39
| Format | Character Set | Max Practical Length | Check Digit | Primary Use Case | Standard |
|---|---|---|---|---|---|
| Code 128 | Full ASCII (128 chars) | ~48 chars printable; up to ~2,000 theoretical | Mandatory (mod 103) | Shipping, logistics, GS1-128 | ISO/IEC 15417 |
| EAN-13 | Numeric (0–9) | 13 digits (fixed) | Mandatory (mod 10) | Retail products worldwide | ISO/IEC 15420 |
| UPC-A | Numeric (0–9) | 12 digits (fixed) | Mandatory (mod 10) | North American retail | ISO/IEC 15420 |
| Code 39 | A–Z, 0–9, 7 special chars | ~20 chars practical | Optional (mod 43) | US DoD, healthcare, assets | ISO/IEC 16388 |
Code 128
Code 128 (ISO/IEC 15417) is the workhorse of shipping and logistics. It encodes the complete 128-character ASCII set — uppercase, lowercase, digits, punctuation, and control characters — across three interchangeable sub-sets: Subset A (control characters and uppercase), Subset B (printable ASCII including lowercase), and Subset C (numeric-only pairs for maximum density). The tool defaults to Code 128B, switching automatically to Subset C for all-numeric segments. Each symbol is 11 modules wide. GS1-128 (formerly UCC/EAN-128) is a Code 128 variant that places an FNC1 function character first, enabling Application Identifier (AI) prefixes like (01) for GTIN-14 or (00) for SSCC-18 shipping labels.
EAN-13
EAN-13 (ISO/IEC 15420) carries a fixed 13-digit numeric payload: a GS1 company prefix, an item reference, and a mandatory check digit in the final position. The first two or three digits typically indicate the country of GS1 registration — prefix 590 maps to Poland in the GS1 prefix table; 978–979 indicate ISBN-13. For retail sale through major supermarket and wholesale chains worldwide, EAN-13 numbers must be registered with GS1 via a licensed GS1 member organisation. Self-assigned prefixes will not be recognised at retail scanners.
UPC-A
UPC-A is structurally a subset of EAN-13: prepend a zero to any UPC-A number and you have a valid EAN-13. The 12-digit symbol dominates North American retail scanning infrastructure, where every POS system that reads EAN-13 also reads UPC-A. Like EAN-13, the final digit is a GS1 modulo-10 check digit. If you need to interoperate with international trading partners, generating EAN-13 (with a leading zero) is the safer long-term choice.
Code 39
Code 39 (ISO/IEC 16388), developed in 1974, encodes uppercase A–Z, digits 0–9, and seven special characters (space, -, ., $, /, +, %). Its self-checking property — each character includes a built-in parity mechanism — made it attractive before computing resources were cheap enough to calculate external check characters. The trade-off is density: Code 39 encodes fewer characters per unit of label width than Code 128, putting a practical limit of roughly 20 characters before the barcode becomes too wide for reliable scanning at standard label sizes. Use Code 128 for anything longer, or for any data that includes lowercase letters.
Understanding Check Digits and Validation
What is a check digit?
A check digit is a single computed digit appended to a barcode payload. When a scanner reads the barcode, it re-runs the same arithmetic on the data digits and compares the result against the check digit. A mismatch means either the bars were misread (damaged label, smeared ink) or someone manually typed the wrong number. Without a check digit, a single transposed digit in a 12-digit UPC would silently route a shipment to the wrong address or decrement the wrong SKU in a warehouse system. The GS1 modulo-10 algorithm used for EAN-13 and UPC-A is specified in the GS1 General Specifications and ISO/IEC 15420.
EAN-13 check digit calculation walkthrough
Given the 12-digit base number 590123412345, the GS1 algorithm multiplies each digit by alternating factors of 1 (odd positions, counting from the left) and 3 (even positions). Summing all 12 products: 5 + 27 + 0 + 3 + 2 + 9 + 4 + 3 + 2 + 9 + 4 + 15 = 43. The check digit is then 10 − (43 mod 10) = 10 − 3 = 7. When the sum is already a multiple of 10, the check digit is 0. The full 13-digit code is therefore 5901234123457. The same algorithm applies to UPC-A, over 11 positions instead of 12.
How the tool validates your input
If you enter all 13 digits for EAN-13 (or all 12 for UPC-A) and the final digit does not match the computed check digit, the status bar turns red and displays an error before any image is produced. Entering only 12 digits for EAN-13 (or 11 for UPC-A) causes the tool to auto-append the correct check digit — the input field updates to show the complete validated string. This two-path approach means you can paste raw manufacturer codes or GS1 prefixes and always receive scannable, standards-compliant output.
PNG vs SVG Export: When to Use Each
| DPI | Pixels per mm | Min X-dim pixels (0.264 mm) | Scan reliability |
|---|---|---|---|
| 72 | 2.83 | 0.75 | Unreliable — sub-pixel bar width |
| 96 | 3.78 | 1.00 | Unreliable — 1-px bars smear in print |
| 150 | 5.91 | 1.56 | Marginal — only for large-format print |
| 203 | 7.99 | 2.11 | Acceptable — thermal printer minimum |
| 300 | 11.81 | 3.12 | Recommended — retail and shipping labels |
When to choose PNG
PNG is the right choice whenever you're printing to a device with a fixed known resolution. Thermal label printers — Zebra ZPL, DYMO, and similar — operate at 203 or 300 DPI. At 300 DPI, one pixel equals approximately 0.085 mm, so a narrow bar module meeting the GS1 minimum X-dimension of 0.264 mm requires at least 3 pixels. Set the PNG width to match the physical label width in inches multiplied by your DPI (e.g., 4″ at 300 DPI = 1200 px). Exporting at 72 or 96 DPI for physical labels will collapse bar widths below the GS1 minimum — scan failure rates increase sharply.
When to choose SVG
SVG is the correct format for any context where the final rendered size is unknown at generation time: desktop publishing applications, CSS-resizable HTML embeds, laser engravers, or digital signage. Because SVG describes bar geometry as vector paths, it scales without pixelation at any size. For HTML and CSS, embedding the SVG inline or via an <img> tag and constraining width with CSS gives crisp barcodes at every viewport size. One caveat: always verify that your final printed X-dimension still meets the 0.264 mm GS1 minimum — scaling an SVG too small on a printed page produces the same scan failures as a low-DPI PNG.
| Use Case | PNG | SVG | Notes |
|---|---|---|---|
| Thermal label printing | ✅ Recommended | ⚠️ Possible with care | Use 203 or 300 DPI PNG; verify X-dimension if using SVG |
| Laser engraving | ❌ Not recommended | ✅ Recommended | Vector paths engrave cleanly; raster can alias |
| HTML / web embed | ⚠️ Fixed size only | ✅ Recommended | SVG scales with CSS without resampling blur |
| Desktop publishing (InDesign, etc.) | ⚠️ High-res PNG only | ✅ Recommended | SVG imports as resolution-independent object |
| Screen display only | ✅ Acceptable | ✅ Preferred | 96 DPI PNG acceptable if never printed |
Bulk Generation and Batch Processing
Uploading a CSV of values
Switch to Bulk Mode to generate multiple barcodes from a single import. Paste a newline-delimited list of values directly into the data field, or upload a CSV file. For CSV files, select which column contains the barcode data using the column-mapping dropdown — the header row is detected automatically, so a column named SKU or barcode will appear by name. If your product data lives in a spreadsheet with multiple joined fields, run it through the CSV-to-JSON Converter first to isolate and clean the barcode column before import. The format and DPI settings you configured in single mode carry over uniformly to every row.
Download as ZIP
After clicking Generate All, the tool iterates each row, renders the barcode, and packages every image as a sequentially named file (barcode_001.png, barcode_002.png, and so on) inside a single downloadable ZIP archive. Bulk mode supports up to 500 entries per session to keep browser memory consumption manageable. For catalogues exceeding 500 SKUs, split your input into batches of 500 and run sequential sessions — each produces a separate ZIP you can merge on disk. The UUID Generator can pre-generate unique identifiers before you import them as barcode values.
Common Barcode Mistakes and How to Avoid Them
Barcode print failures rarely stem from the generator itself — they come from configuration errors made before or after generation. These six patterns account for the majority of scan rejections in retail and warehouse deployments.
Manually entering a wrong check digit for EAN-13 or UPC-A. If you type all 13 digits and the last one is wrong, every scanner that verifies the check digit will reject the read. Enter only 12 digits and let the tool append the correct 13th automatically.
Using Code 39 for strings longer than 20 characters. Code 39 encodes roughly 15 mm of label width per character at standard scale. A 30-character Code 39 barcode at that density is too wide for a standard 4″ label at readable scale. Code 128 achieves approximately twice the density for the same character count.
Exporting PNG at 72 or 96 DPI for thermal printing. Screen resolution is irrelevant on a thermal printer. The printer reads raw pixel dimensions and maps them to its own DPI. A 400 × 200 px barcode tagged at 72 DPI prints as a postage-stamp-sized smear on a 300 DPI printer. Set DPI to match the printer.
Omitting quiet zones. The GS1 specification requires a blank margin of at least 10× the module width on both the left and right sides of the barcode symbol, and a minimum of 10 modules on top and bottom. The tool includes quiet zones by default; do not crop the output image or set padding to zero in your label template.
Encoding lowercase letters in Code 39. Code 39 supports only uppercase A–Z. Feeding it lowercase input either throws a validation error or silently upcases the string. If your SKUs or asset tags include lowercase letters or special characters beyond Code 39's 43-character set, use Code 128B instead.
Scaling SVG output below the GS1 minimum X-dimension. An SVG exported at a generous size and then scaled to 50% in a layout application may produce bars narrower than 0.264 mm (7.5 mil). Measure the narrowest bar in your print proof before committing to a press run.
Behind the Scenes: Barcode Encoding Standards
Code 128 encoding mechanics
Each Code 128 character is represented by three bars and three spaces (six elements total), each 1–4 modules wide, for a total symbol width of 11 modules. The encoding begins with a start character that declares which sub-set (A, B, or C) is active; FNC codes in the symbol stream allow switching between sub-sets mid-symbol to maximise density. Per ISO/IEC 15417 §5, the check character is calculated as: (start_value + Σ(position × symbol_value)) mod 103, where position counts from 1 for the first data character. The tool uses Code 128B (start value 104) as the default, covering all printable ASCII characters including lowercase — the most broadly useful choice for developer and logistics payloads. GS1-128 mode prepends an FNC1 character (value 102 in Code 128B), signalling that the payload contains GS1 Application Identifiers. This tool supports GS1-128 AI mode for SSCC-18 and GTIN-14 labels.
EAN/UPC encoding mechanics
EAN-13 encodes 12 data digits plus one check digit using a three-region structure. The left half carries six digits encoded in one of two parity patterns (L-odd or L-even) determined by the first digit of the number — which is itself not directly encoded as a bar pattern but implied by the parity sequence. This is how 13 digits are conveyed in a symbol that ostensibly has 12 data positions. Guard bars at start (101), centre (01010), and stop (101) are fixed bit patterns that frame the data and give the scanner its orientation. Right-side digits always use R-parity (the complement of L-odd). UPC-A uses only L-odd on the left and R on the right, because the implicitly encoded digit is always zero. These parity tables are defined in full in ISO/IEC 15420, which also governs EAN-8, EAN-2, and EAN-5 add-on symbols. The Base64 Encoder/Decoder and JSON Formatter can be useful for preprocessing product data payloads before feeding barcode values into this tool.
| DPI | Pixels per 1 mm | Min X-dim (px) | Min EAN-13 width (px) | Recommended use |
|---|---|---|---|---|
| 72 | 2.83 | 0.75 | ≈ 78 | Screen only — do not print |
| 96 | 3.78 | 1.00 | ≈ 104 | Screen only — do not print |
| 150 | 5.91 | 1.56 | ≈ 163 | Large-format display print only |
| 203 | 7.99 | 2.11 | ≈ 219 | Thermal label printer minimum |
| 300 | 11.81 | 3.12 | ≈ 324 | Retail labels, shipping labels |