Barcode Image Generator

Generate Code-128, EAN, and UPC barcode image graphics.

100% Client-Side • 100% Free

Barcode Image Generator

Generate high-resolution Code 128, EAN-13, EAN-8, UPC-A, and Code 39 barcode images instantly. Free, client-side, and private.

Valid Format

Accepts standard ASCII characters (alphanumeric, symbols, spaces).

Bar Width2px

Thickness of the narrowest barcode element.

Barcode Height100px

Vertical height of the bars in pixels.

Margin / Quiet Zone10px

Padding around the barcode to guarantee scanner readability.

Font Size14px

Scale of printed numbers

Display Value Below Bars
Render human-readable text code underneath the barcode.

Live Barcode Preview

288 × 142 px
2run-2026
Format: CODE1282run-2026
In-Depth Technical Guide•8 min read•2RUN Engineering Team
100% Client-Side • Zero Upload

Online Barcode Generator: Code 128, EAN-13, UPC-A, Modulo Checksums & Vector SVG Export

⚡How to Generate Standard Barcodes in Your Browser

1

Select Your Barcode Symbology

Choose from Code 128 (general asset tracking), EAN-13 (global retail), EAN-8 (small package retail), UPC-A (North American retail), or Code 39 (industrial/defense).

2

Enter Your Data String

Type or paste your alphanumeric string, SKU number, or GTIN code into the input field. The engine validates character legality and automatically computes check digits.

3

Customize Geometry and Display Options

Adjust bar height, module width, quiet zone margins, and toggle human-readable text labels with custom font sizing and alignment.

4

Export Vector SVG or High-DPI PNG

Click 'Download SVG' for resolution-independent packaging vector artwork, or 'Download PNG' for high-resolution 300 DPI label printing.

Linear barcodes represent the foundational backbone of global commerce, supply chain logistics, retail point-of-sale (POS) systems, warehouse inventory management, and pharmaceutical tracking. For over five decades, optical barcode symbologies have enabled laser scanners and digital camera imagers to capture alphanumeric data with near-zero error rates. However, generating production-grade barcodes requires strict adherence to international ISO/IEC standards, precise quiet zones, mathematical modulo check-digit algorithms, and pixel-perfect rendering to prevent scanning failures at the checkout counter or distribution depot.

Our browser-native Barcode Generator creates high-density, standards-compliant barcodes across all major 1D symbologies, including Code 128 (Sets A, B, and C with intelligent auto-switching), EAN-13, EAN-8, UPC-A, and Code 39. Whether you are packaging commercial retail goods for Amazon FBA, managing warehouse inventory bins, printing shipping labels, or creating asset management stickers, our tool delivers crisp vector SVG markup and high-resolution 300 DPI PNG downloads. Operating 100% locally in your browser with zero server communication, your proprietary SKU sequences, serial numbers, and confidential inventory identifiers remain completely private.

Read the full technical guide

Anatomy of Linear Barcodes: Modules, Quiet Zones & Optical Contrast

A linear (1D) barcode is not merely a collection of parallel lines; it is an optical spatial waveform governed by precise mathematical ratios. The fundamental building block of a barcode is the 'module'—the narrowest nominal bar or space in the symbol (denoted as the X-dimension). All wider bars and spaces in a symbology are integer multiples of this base module (e.g. 2X, 3X, or 4X wide).

Equally crucial to optical scanner readability is the 'quiet zone'—the mandatory blank margin flanking the left and right sides of the barcode. Optical laser scanners and camera-based vision sensors rely on this high-contrast quiet zone (typically at least 10 times the X-dimension or 0.25 inches) to establish baseline reflectance and synchronize their internal clock before decoding the binary data stream. If typography, border frames, or packaging art encroach upon the quiet zone, scanning equipment fails to detect the symbol start pattern. Our generator automatically calculates and enforces standard-compliant quiet zones across all exported files.

Code 128 Architecture: Three Character Sets & Dynamic Auto-Switching

Standardized under ISO/IEC 15417, Code 128 is widely regarded as the most versatile, high-density 1D alphanumeric barcode symbology in modern logistics, healthcare, and enterprise asset tracking. Every Code 128 character consists of 11 modules divided into three bars and three spaces (with the exception of the stop character, which spans 13 modules).

Code 128 achieves its remarkable data density through three distinct character sets: • Set A: Encodes all standard uppercase alphanumeric characters, punctuation, and ASCII control characters (such as NUL, LF, CR, and TAB), making it indispensable for automated terminal equipment. • Set B: Encodes all standard printable ASCII characters, including uppercase, lowercase, punctuation, and symbols. • Set C: Encodes pairs of numeric digits (00 through 99) using a single 11-module symbol character, effectively doubling numeric data density. Our generator implements intelligent character set auto-switching. When encoding mixed alphanumeric strings containing runs of numeric digits, the engine dynamically injects `CODE_C` or `CODE_B` shift and latch characters, minimizing the total physical length of the printed barcode while maximizing scanner read reliability.

Modulo Check-Digit Algorithms: Mathematical Integrity Verification

To guarantee data integrity and prevent optical misreads caused by ink bleed, paper creases, or scratched packaging, linear barcodes enforce strict mathematical checksum algorithms:

• Code 128 Modulo 103: The checksum is computed by taking the weighted sum of each character's value multiplied by its position index along the string (with the Start character weighted at 1), and calculating the remainder modulo 103: $\text{Check} = \left(\text{StartValue} + \sum_{i=1}^{N} (i \times \text{Value}_i)\right) \pmod{103}$. The resulting symbol is appended immediately before the Stop character. • EAN-13 & UPC-A Modulo 10 (Weight 3:1): Universal retail barcodes utilize an alternating 3:1 weighting scheme. Starting from the rightmost data digit (excluding the check digit), alternating digits are multiplied by 3 and 1, summed, and subtracted from the next higher multiple of 10: $\text{Check} = (10 - (\sum \text{weighted}) \pmod{10}) \pmod{10}$. Our generator automatically computes, verifies, and appends compliant check digits to your input strings.

Global Retail Standards: EAN-13 vs. UPC-A Symbology

For consumer goods sold through retail checkout registers, international trade requires GS1-administered Global Trade Item Numbers (GTINs):

• UPC-A (Universal Product Code): The standard 12-digit barcode dominant in the United States and Canada. It encodes a 1-digit numbering system, a 5-digit manufacturer code, a 5-digit product code, and a trailing modulo 10 check digit. • EAN-13 (International Article Number): The worldwide 13-digit standard utilized across Europe, Asia, Latin America, and Oceania. EAN-13 cleverly encodes its 13th digit without adding physical bars: the leading country code digit governs the variable parity sequence (Character Sets A and B) of the six left-hand digits, flanking central guard bars (`01010`) and outer guard bars (`101`). Because a 12-digit UPC-A is mathematically identical to an EAN-13 with a leading zero (`0UPC`), our engine ensures seamless cross-compatibility for global distribution.

Industrial & Defense Symbologies: Code 39 Architecture

In addition to modern retail and logistics codes, our tool supports specialized industrial symbologies such as Code 39. Standardized as ANSI/AIM BC1, Code 39 is heavily utilized by the US Department of Defense (MIL-STD-129), automotive manufacturers, and identification badge systems. Each character in Code 39 is represented by 9 elements (5 bars and 4 spaces), with exactly 3 elements being wide and the remaining 6 narrow, bounded by unique start/stop asterisk symbols (`*`). This discrete, self-checking symbology excels in manufacturing and internal inventory where uppercase alphanumeric coding is required without complex encodation tables.

Print Resolution, DPI Scaling & Bar Width Reduction (BWR)

When printing barcodes on industrial flexographic, thermal transfer, or direct thermal label printers, liquid ink or heated wax naturally bleeds into porous paper fibers. This physical phenomenon—known as 'press gain' or 'ink bleed'—causes printed black bars to expand and white spaces to narrow, which can render barcodes unreadable.

To counter this, professional packaging design requires Bar Width Reduction (BWR) and high-resolution vector rendering. Our generator exports clean, infinitely scalable SVG vector files where every bar is represented as a mathematical `<rect>` path. When raster PNG output is selected, the engine renders at 300 DPI or higher to prevent anti-aliasing interpolation blur, guaranteeing razor-sharp edges and 100% first-pass scan rates on commercial barcode verifiers.

100% Client-Side Privacy for Confidential SKU Sequences

Manufacturing companies, retail brands, and defense contractors routinely generate barcodes for unreleased consumer electronics, proprietary military components, and confidential warehouse asset tags. Generating these barcodes through cloud-hosted web utilities exposes sensitive SKU lists and internal serial numbers to third-party logging.

Our Barcode Generator operates 100% within your local web browser. Built entirely in client-side TypeScript and HTML5 Canvas/SVG APIs, all character set parsing, checksum calculations, and vector geometry construction take place inside your device's memory. No data is ever transmitted across an internet connection, ensuring total data security and complete compliance with corporate confidentiality standards.

💡Professional Best Practices for Barcode Printing

  • •Maintain high optical contrast: Always print black bars on a pure white background. Scanners use red light; never print red bars or print on red backgrounds, as red appears invisible to laser sensors.
  • •Preserve quiet zones: Never position text, borders, or graphics within the margin flanking the left and right ends of the barcode; encroaching on quiet zones causes immediate scan failures.
  • •Use SVG for packaging artwork: Always provide your packaging printer with vector SVG files rather than raster images to ensure sub-pixel edge sharpness on printing plates.
  • •Test on thermal printers: Direct thermal labels can experience print head burnout; orient barcodes so bars print parallel to the print head direction (ladder orientation) for best results.
  • •Verify with a physical scanner: Before printing thousands of product labels, scan a printed sample with a physical handheld barcode reader or smartphone camera app.
  • •Enforce Code 128 Set C for numbers: For long serial numbers composed strictly of digits, Code 128 Set C pairs digits together to cut barcode length in half.
  • •Check GTIN check digits: When generating EAN-13 or UPC-A codes, let our engine calculate the trailing check digit automatically to prevent retail register rejection.

🛡️Technical Specifications & Symbology Geometry

The browser-native barcode generation engine implements strict ISO/IEC symbology algorithms: 1. Input Validation & Auto-Switching: For Code 128, the input string is parsed using a lookahead cost function that evaluates whether Set A, B, or C produces the shortest binary symbol. Consecutive runs of 4 or more digits are automatically switched to Set C (`START_C = 105`). 2. Binary Module Mapping: The string is converted into a sequence of binary module patterns. In Code 128, each symbol maps to an 11-module string from `CODE128_BARS` (e.g. `'11011001100'`), terminated by the 13-module stop pattern `'1100011101011'` and quiet zone buffers. 3. Checksum Computation: Checksums are computed dynamically. In Code 128, the Modulo 103 weighted sum is derived. In EAN-13/UPC-A, the 3:1 alternating Modulo 10 sum calculates the parity bit, and guard patterns (`101` and `01010`) are synthesized. 4. Dual Rendering Architecture: The engine renders the binary waveform into two formats: - Scalable Vector Graphics (SVG): Generates an XML `<svg>` document containing clean, un-antialiased `<rect>` elements for each continuous bar run, with an optional `<text>` node for OCR-B human-readable characters. - Canvas / PNG Rasterizer: Renders to an OffscreenCanvas at 300 DPI with crisp pixel boundaries, exporting a lossless PNG binary Blob.

Stack: WebAssembly • Multi-threaded Web Workers • HTML5 Canvas API

Privacy: Files never leave your device or touch a cloud buffer; analytics run only with your consent.

Why choose client-side browser tools?

When you compress an image or merge a PDF on 2run tools, the code executes inside your browser tab using WebAssembly and Web Workers. We never stream your bytes to a remote cloud server. Your private financial reports, personal photos, and legal agreements never leave your device.

Total PrivacyIn-Browser
Instant ProcessingFast RAM
Truly UnlimitedZero Limits

Frequently Asked Questions

What is the difference between Code 128 and Code 39?▾

Code 128 is a modern, high-density symbology that supports the complete ASCII character set and uses dynamic character sets to achieve compact barcodes. Code 39 is an older, simpler standard with lower data density, primarily used in US government, military, and automotive applications.

Can I use these barcodes to sell products on Amazon or retail stores?▾

Yes! If you have purchased official GTIN numbers from GS1, you can enter your 12-digit UPC-A or 13-digit EAN-13 numbers into our tool to generate production-ready barcodes for Amazon FBA, retail packaging, and point-of-sale scanning.

Why does a barcode need a quiet zone?▾

The quiet zone is the blank margin on both sides of the barcode. Laser scanners and camera sensors use this blank space to measure background reflectance and identify where the barcode begins. Without adequate quiet zones, scanners will fail to read the code.

What is the best format for packaging design: SVG or PNG?▾

SVG is strongly recommended for commercial packaging and graphic design. As a vector format, SVG scales infinitely without pixelation or blur, ensuring that commercial printing plates maintain razor-sharp bar edges.

Can I print barcodes in different colors?▾

While you can customize bar colors, you must maintain high optical contrast. Barcode scanners use red laser or infrared light; therefore, bars must be very dark (black, dark blue, dark brown) and backgrounds must be very light (white, yellow). Never use red bars, as red appears white under red scanner lights.

Are check digits calculated automatically?▾

Yes. Our tool automatically computes and validates the standard check digits for all symbologies, including Modulo 103 for Code 128 and Modulo 10 for EAN-13 and UPC-A.

Is my SKU data uploaded to any server?▾

No. All barcode generation, checksum calculations, and SVG/PNG rendering execute 100% locally in your web browser. Your product codes, serial numbers, and inventory lists never leave your device.

Sites Loading Under 0.8s
100/100 Lighthouse web engineering
Audit
Dev Arm for Design Agencies
White-label • Bilateral NDA
Partner
Technical SEO by Code
Deep Schema • Zero waste
Scale SEO
Custom Web Apps & SaaS
100% code ownership • Edge scale
Build
Turn Traffic into Sales
+34% sales lift • Fix bottlenecks
Audit