Barcode Generator - Create EAN-13, UPC-A, Code 128 Barcodes Online
Generate 1D barcodes in EAN-13, UPC-A, Code 128, Code 39, ITF-14, and more formats. Customize colors, size, and download as SVG or PNG — 100% client-side, no data sent to server.
Frequently Asked Questions
What is a barcode?
A barcode is a machine-readable representation of data using parallel lines (bars) and spaces of varying widths. First commercially used in 1974, barcodes are now ubiquitous in retail, logistics, healthcare, and inventory management. 1D (linear) barcodes encode data in the widths of bars and spaces, read by laser or image-based scanners. Different barcode formats (symbologies) serve different purposes — EAN/UPC for retail products, Code 128 for general logistics, ITF-14 for shipping containers.
How do I use this barcode generator?
1. Select the barcode format from the dropdown (e.g., EAN-13, Code 128, Code 39). 2. Enter the value you want to encode in the input field. 3. The barcode generates automatically in real-time as you type. 4. Optionally customize the appearance: bar color, background, width, height, and text display. 5. Download as SVG (vector/print quality) or PNG (3x upscaled for crisp output), or copy to clipboard.
Is my data safe? Does it get sent to a server?
Your data is 100% safe and never leaves your browser. All barcode generation is performed client-side using the JsBarcode library, which renders barcodes directly to SVG elements in your browser. No barcode values, product numbers, or any input data is transmitted to any server. This makes the tool safe for encoding sensitive internal tracking numbers, pre-release product codes, or any confidential data.
Which barcode format should I use?
EAN-13 is the global standard for retail product identification (required by most retailers worldwide). UPC-A is the US/Canadian retail standard. Code 128 is the most versatile format for general-purpose use — it supports all ASCII characters and is widely used in shipping labels, logistics, and internal tracking. Code 39 is common in government, military, and healthcare. ITF-14 is specifically designed for shipping containers and outer packaging. Codabar is used in libraries and blood banks. Pharmacode is used exclusively in pharmaceutical packaging.
What is a check digit and how is it calculated?
A check digit is an extra digit appended to a barcode value to detect errors in data entry or scanning. It is calculated using a mathematical algorithm based on the other digits. For EAN-13, odd-positioned digits are multiplied by 1 and even-positioned digits by 3, then the result is subtracted from the next multiple of 10. This tool automatically calculates and validates check digits for EAN-13, EAN-8, UPC-A, and ITF-14 formats. If you enter 12 digits for EAN-13, the 13th check digit is auto-appended.
What is the difference between SVG and PNG download?
SVG (Scalable Vector Graphics) is a vector format that can be scaled to any size without losing quality — ideal for print materials, labels, and packaging. PNG is a raster (pixel-based) format suitable for screen display, documents, and web use. This tool provides PNG downloads with 3x upscaling for crisp output even at larger display sizes. Use SVG for printing and professional label production; use PNG for digital documents, presentations, and web use.
Can I scan the generated barcodes with a real barcode scanner?
Yes, all barcodes generated by this tool follow official ISO specifications and GS1 standards. They are fully compatible with laser scanners, camera-based scanners, and smartphone barcode scanning apps. For best scanning results, ensure adequate contrast between bar and background colors (black on white is ideal), maintain proper quiet zones (margins), and print at a sufficient size for the scanner's resolution.
Code Examples
// Generate barcodes in the browser using JsBarcode
import JsBarcode from 'jsbarcode';
// Basic Code 128 barcode
JsBarcode('#barcode', 'Hello World', {
format: 'CODE128',
width: 2,
height: 100,
displayValue: true,
fontSize: 18,
font: 'monospace',
lineColor: '#000000',
background: '#ffffff',
margin: 10,
});
// EAN-13 barcode with auto check digit
JsBarcode('#ean13', '590123412345', {
format: 'EAN13',
width: 2,
height: 80,
fontSize: 16,
});
// Calculate EAN-13 check digit
function calculateEAN13CheckDigit(digits) {
const d = digits.slice(0, 12).split('').map(Number);
const sum = d.reduce((acc, val, i) =>
acc + val * (i % 2 === 0 ? 1 : 3), 0);
return (10 - (sum % 10)) % 10;
}
console.log(calculateEAN13CheckDigit('590123412345')); // 7
// Download barcode as SVG
function downloadSVG(svgElement, filename) {
const svgString = new XMLSerializer()
.serializeToString(svgElement);
const blob = new Blob([svgString],
{ type: 'image/svg+xml;charset=utf-8' });
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
link.download = `${filename}.svg`;
link.click();
URL.revokeObjectURL(url);
}