Online Barcode Generator: Code 128, EAN-13, UPC-A, Modulo Checksums & Vector SVG Export
⚡How to Generate Standard Barcodes in Your Browser
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).
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.
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.
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.
Complementary Tools in this Workflow
Chain these client-side utilities together for high-performance creative workflows.
Dummy Placeholder Maker
Generate custom dimension placeholder graphics with label texts.
QR Code Generator (PNG & SVG)
Create high-resolution, print-ready QR codes as PNG or vector SVG for links, text, Wi-Fi and contact cards.
Compress Image
Reduce JPG, PNG, and WebP file weight without losing visible clarity. Fast, 100% private in-browser compression.
Resize Image
Scale exact pixel dimensions or percentages with locked proportions and format conversion.