How to Generate Barcodes
To generate a barcode, pick the symbology (Code 128 for general use, EAN-13/UPC-A for retail), enter your data, let the tool compute the check digit, and export a high-resolution image. Do it now with our free barcode generator; the five steps are below.
Step 1–2: pick the symbology and validate your data
Step 1: choose the symbology based on the use case. General internal labeling — inventory, assets, serial numbers — → Code 128 (alphanumeric, dense, universally readable). Retail products → UPC-A (12 digits, North America) or EAN-13 (13 digits, international), with numbers licensed from GS1 — generating the image is free, but the number itself must be legitimately assigned or it will collide at checkout. Small packaging → EAN-8 or UPC-E. Data-rich codes for phones → QR. Step 2: validate your input data against the symbology's rules before generating. UPC-A needs exactly 12 digits (the tool computes the 12th check digit from the first 11, or validates all 12). EAN-13 needs exactly 13 digits. Code 128 accepts letters, digits, and symbols but watch length: a 40-character string in Code 128 renders about 4 inches wide at standard density — fine for a shipping label, unusable on a jewelry tag. The most common generation failure is a wrong-length input: 11 digits into a UPC-A field, or letters into a numeric-only format. Good generators validate and tell you what is wrong; if yours silently produces a symbol from bad input, switch tools — an unscannable barcode printed on 5,000 labels is an expensive lesson. For retail specifically, confirm your GS1 prefix is active before generating anything.
Step 3: the check digit (worked EAN-13 example)
Every major retail symbology ends with a check digit — a final digit computed from the others that lets scanners detect misreads. You should never compute it by hand in production, but understanding it explains why one wrong digit breaks everything. EAN-13 check digit algorithm: take the first 12 digits, sum the digits in odd positions × 1 plus digits in even positions × 3, then the check digit is (10 − (sum mod 10)) mod 10. Worked example with 400638133393: odd positions (1st, 3rd, 5th...): 4 + 0 + 3 + 1 + 3 + 9 = 20; even positions: 0 + 6 + 8 + 3 + 3 + 3 = 23; weighted sum = 20 + (23 × 3) = 89; 89 mod 10 = 9; check digit = (10 − 9) mod 10 = 1. Full code: 4006381333931. Change any single input digit and the check digit changes — that is the point: a scanner that misreads one bar gets a check-digit mismatch and rejects the scan instead of ringing up the wrong product. Code 128 uses a modulo-103 checksum over symbol values rather than digits, and UPC-A uses the same odd/even weighting as EAN-13. Every reputable barcode generator computes these automatically — the step is listed here so you can verify a generator's output, not so you do it manually.
Step 4: export in the right format
Step 4: export the symbol correctly. Format choice depends on destination. SVG (vector) is the best default for print: infinitely scalable, razor-sharp bars at any size, tiny file size. Use it whenever the printer accepts vector — label software, professional print shops. PNG at 300+ DPI is the fallback for systems that need raster: export at the exact physical size you will print (a 2-inch-wide barcode at 300 DPI = 600 pixels wide), because scaling a raster barcode in the printer driver blurs bar edges and kills scannability. PDF suits batch jobs — hundreds of sequential serial numbers in one print run. What not to do: screenshot a barcode from a webpage (typically 96 DPI, one-third the needed resolution), export as JPG (compression artifacts blur the narrow bars), or copy-paste into Word and drag to resize (non-uniform scaling distorts the bar widths the scanner measures). Include the quiet zone — the blank margin on both sides, minimum 10× the narrowest bar width — in the export; a barcode cropped tight to its bars will not scan. Most generators add it automatically, but verify visually: there should be clear white space, roughly the width of 2–3 digits, on each side. For QR codes bound for phones, our business-card QR guide covers the export settings that matter on small prints.
Step 5: print and verify before the big run
Step 5: print one, scan it, then print thousands. The verification pass catches the four killers: resolution (print at 300 DPI minimum; thermal label printers at 203 DPI are fine for Code 128 but marginal for dense symbols), contrast (black bars on white — never red bars, never dark backgrounds; scanners read the absence of reflected light), size (EAN-13 must be 80–200% of nominal 37.29mm width — below 80% most retail scanners fail), and distortion (never stretch a barcode non-uniformly to fit a label; scale proportionally or regenerate at the right size). Test with the actual scanner that will read them in production — a phone camera reading a QR code proves nothing about a warehouse laser gun reading Code 128. Print on the actual label stock: glossy labels create specular reflection that blinds scanners, and recycled matte stock can bleed ink into the quiet zone. The professional standard is a barcode verifier (graded A–F per ISO 15416), but for small runs, scanning with the production device from three distances (close, normal, far) catches 95% of problems. Generate a test batch of 5–10 sequential codes, print, scan every one, and only then commit to the full run. One verified test sheet costs pennies; 5,000 unscannable labels cost the reprint plus the downtime. Batch workflows that stamp serial numbers from epoch times can decode them with our unix timestamp converter, keep the human-readable text under labels concise with our word counter, and our email QR guide covers the 2D counterpart.