Barcodes are the quiet infrastructure of retail, warehousing, libraries, and logistics. A printed pattern of bars and spaces, scanned in a fraction of a second, identifies a product, a book, or a parcel more reliably than any typed number. The Barcode Generator on FreeToolZones creates barcodes in your browser in four widely used formats, with control over height and label display, and lets you download the result as a scalable SVG image.
This guide explains the four formats, the validation rules for each, and how to choose the right format for your use. You will find step-by-step instructions, practical examples from retail labeling to inventory tracking, and honest notes about check digits, print quality, and scanner compatibility. If you need a barcode that scans correctly the first time, this page shows you how to produce one.
What Is the Barcode Generator?
The Barcode Generator is a free online tool that converts a value, such as a product number or an identifier, into a barcode image. A barcode encodes data as bars and spaces of varying widths that an optical scanner reads and converts back into the original value. Unlike QR codes, which store data in two dimensions, the formats offered here are one-dimensional: the data runs along a single line of bars, and the height of the bars exists only to make scanning easier.
Four formats are available. CODE128 encodes text and numbers with a dense, flexible alphabet and is the general-purpose choice. EAN-13 encodes 13 digits and is the standard retail barcode in most of the world outside North America. UPC-A encodes 12 digits and is the standard retail barcode in North America. CODE39 encodes uppercase letters, numbers, and a small set of symbols, and remains common in industrial, military, and library labeling. Each format has strict rules about which characters and lengths it accepts, and the tool validates your value before generating, with a specific error message when a rule is broken.
Generation uses a barcode library loaded from a content delivery network when you click Generate. The barcode is drawn as an SVG image with black bars on a white background, an optional human-readable value printed beneath the bars, and a small margin around the symbol. The result shows the format and the character count. Downloading saves the SVG, a vector format that scales to any print size without losing sharpness, which is exactly what barcode printing needs. The value you encode is not uploaded; generation happens in your browser.
- Four formats: CODE128, EAN-13, UPC-A, and CODE39, each with its own rules.
- Format validation: digit counts and character sets are checked before generation.
- Automatic check digits: EAN-13 and UPC-A check digits are added when you enter the shorter form.
- Height choices: 60, 80, 100, or 120 pixels tall, with 80 as the default.
- Optional value label: show the encoded value under the bars, enabled by default.
- SVG download: download a scalable vector image for crisp printing at any size.
How to Use the Barcode Generator
The widget has a value field, two selectors, a label checkbox, and three buttons. Follow these steps to create and download a barcode.
- Enter the value to encode. Type or paste the value in the field labeled Value to encode. The placeholder shows a 13-digit example number. Enter only the characters your chosen format allows. Leading and trailing spaces are trimmed before validation, so accidental spaces around the value will not cause an error.
- Choose a barcode format. Use the Barcode format dropdown to select CODE128, EAN-13, UPC-A, or CODE39. CODE128 is the safe default for mixed text and numbers. Choose EAN-13 or UPC-A only when you have a proper retail number in the required digit count. Choose CODE39 for uppercase identifiers in industrial or library settings.
- Choose a height. Use the Height dropdown to select 60, 80, 100, or 120 pixels. Taller bars scan more easily, especially with handheld scanners and at awkward angles. The default of 80 pixels suits labels and documents. Choose 100 or 120 pixels for warehouse labels, shelf tags, and other uses where scanning distance or speed matters.
- Decide whether to show the value. The checkbox labeled Show the value under the barcode is ticked by default. Leave it ticked when people need to read or type the number if scanning fails. Untick it only when the label must be minimal or the value is printed separately elsewhere on the label.
- Click Generate barcode. Press the Generate barcode button. If the value is empty, the tool asks you to enter one. If the value breaks a format rule, a specific error message explains the rule. Otherwise, the library loads if needed, the barcode is drawn, and a preview appears with the format and character count. If the library cannot load, a connection error is shown.
- Download the SVG. Click Download SVG to save the image as barcode.svg. If you try to download before generating, the tool reminds you to generate first. Test the printed barcode with a real scanner before producing labels in quantity. Click Clear to empty the value field and remove the preview before the next barcode.
Always verify the printed barcode with the scanner that will read it in production. A barcode that looks correct on screen can fail in print if the printer resolution is low, the label is glossy, or the bars are scaled unevenly. Print a test label, scan it, and confirm the decoded value matches exactly.
Key Features of the Barcode Generator
The generator enforces each format rules before drawing, so invalid values fail fast with a helpful message instead of producing a barcode that encodes the wrong data or fails to scan. The features below describe the validation and rendering behavior.
- CODE128 flexibility. CODE128 accepts text and numbers, including lowercase letters and punctuation, through its three code sets, which the library selects automatically. No character validation beyond non-emptiness is applied in the widget for CODE128, so it is the right choice for general identifiers, serial numbers, and mixed content that other formats cannot represent.
- EAN-13 digit rules and check digit. EAN-13 requires 12 or 13 digits. Enter 12 digits and the check digit is calculated and added automatically by the library. Enter 13 digits including the check digit and it is used as given. Any other length or any non-digit character produces an error explaining the requirement. The check digit protects against misreads and typing errors.
- UPC-A digit rules and check digit. UPC-A requires 11 or 12 digits, with the same check-digit behavior: 11 digits get a calculated check digit, 12 digits are used as given. The widget error message states the rule plainly. Use UPC-A for North American retail products that carry a UPC number, and EAN-13 elsewhere, following the numbering authority for your products.
- CODE39 character set. CODE39 accepts uppercase letters, digits, and the characters hyphen, dot, space, dollar, slash, plus, and percent. Lowercase letters and other symbols are rejected with an error listing the allowed set. Convert identifiers to uppercase before entering them, and replace unsupported characters with an allowed alternative.
- Fixed bar width and clean rendering. Bars are drawn with a fixed width of two units, black bars on a white background, with a margin of ten units around the symbol. The fixed geometry keeps the symbol scannable and consistent. The SVG output preserves this geometry exactly at any print size, unlike a raster image that blurs when enlarged.
- Height control. The height selector changes the bar height without changing the encoded data or the bar widths. Taller bars give scanners more vertical tolerance, which helps when labels are scanned quickly or at an angle. The displayed value label, when enabled, sits below the bars and does not affect scanning.
- Library loading with clear errors. The barcode library loads on demand from a public content delivery network. Connection failures and startup failures produce distinct messages, so you can tell a network problem from a value problem. Encoding errors from the library itself are shown with the format name and the library message.
Practical Use Cases for the Barcode Generator
Barcodes earn their keep wherever items must be identified quickly and accurately, repeatedly, by people and machines. The examples below cover the main settings.
Retail product labeling
Retail products carry EAN-13 or UPC-A barcodes that point-of-sale scanners read at checkout. The number encoded must be a properly assigned product number from the relevant numbering authority, with a correct check digit. This tool adds the check digit when you enter the shorter form, but it cannot assign a legitimate product number: obtain numbers through the proper channel for your market, then generate the symbol here for labels and packaging proofs.
Inventory and warehouse tracking
Warehouses label bins, pallets, and items with CODE128 or CODE39 barcodes carrying internal identifiers. Scanning replaces manual entry, cutting errors and speeding up receiving, picking, and stock counts. Use tall bars and the value label for warehouse labels, which are scanned at varying distances and angles, often in poor light. Test labels on the actual shelving and with the actual scanners before a full rollout.
Library and asset labeling
Libraries label books and media with barcodes for checkout and inventory, and organizations label equipment, laptops, and furniture for asset tracking. CODE39 suits short uppercase asset codes, while CODE128 handles longer mixed identifiers. The human-readable value under the bars lets staff type the code when a scanner is unavailable or a label is damaged.
Event tickets and passes
Events print barcodes on tickets and passes for entry scanning. Each ticket carries a unique identifier, and scanning at the gate validates it against the attendee list. CODE128 works well for alphanumeric ticket codes. Print test tickets and scan them with the event scanning setup, including phone screens if digital tickets will be scanned from displays.
Documents and forms processing
Forms, worksheets, and documents carry barcodes that link the paper copy to a digital record. Scanning the form on return identifies it instantly, without manual matching. Keep the encoded value short and stable, print at a size that office scanners read reliably, and include the value label so staff can identify a form whose barcode is damaged.
Small business and craft labeling
Small producers label handmade goods, food products, and craft items with barcodes for markets, stock control, and simple point-of-sale use. For internal tracking, any consistent numbering scheme works with CODE128. For retail sale through third-party stores, proper EAN or UPC numbers are required, so confirm the retailer requirements before printing retail packaging.
Tips and Best Practices
- Use the right format for the reader. Confirm which formats your scanners and retail partners accept before generating. A CODE128 label is useless at a checkout that expects EAN-13, and a CODE39 label may not be supported by a basic retail scanner. Match the format to the ecosystem, not to personal preference.
- Never invent retail numbers. EAN and UPC numbers are assigned through numbering authorities and carry company prefixes. Generating a symbol for a made-up number produces a barcode that may collide with another product or be rejected by retailers. Obtain legitimate numbers, then use this tool to render the symbols.
- Print at high resolution on matte stock when possible. Sharp bar edges scan reliably; blurred edges and glare cause misreads. Use a printer with adequate resolution, avoid glossy labels where glare is a problem, and never stretch a barcode unevenly when resizing, because distorted bar widths change the encoded data as the scanner sees it.
- Keep quiet space around the symbol. Scanners need clear space on both sides of the bars to recognize where the symbol begins and ends. The generated SVG includes a margin; preserve it when placing the barcode in a label design, and do not crowd it with text, borders, or graphics.
- Test every label design. Print the final label on the final stock with the final printer, and scan it with the final scanner. Test at different angles and distances, and test several copies, because print variation can make one copy scan while another fails. A test scan takes seconds; a failed rollout costs far more.
- Keep the value label visible. Leave the value display enabled unless you have a strong reason to hide it. The printed value is the fallback when scanning fails, and it lets staff verify at a glance that the label matches the item.
- Use SVG for print, and scale proportionally. The SVG download scales without loss. When resizing in a design program, scale width and height together to preserve bar proportions. Changing only the width distorts the code and can make it unscannable.
Limitations of the Barcode Generator
The tool generates symbols for the four listed formats only. It does not produce QR codes, Data Matrix codes, ISBN-specific layouts, or other symbologies, and it does not assign or validate product numbers beyond digit counts and character sets. An EAN-13 value with a wrong check digit entered as 13 digits will be rendered as given, because the tool validates length and digits, not the check digit itself, when the full length is supplied. Verify check digits against your numbering records when entering full-length values.
The barcode library loads from a content delivery network, so generation requires an internet connection for the first load. The output is SVG only; there is no PNG or PDF download in this widget, so convert the SVG in another program if a raster format is required. The tool generates barcodes; it does not scan them, verify print quality, or guarantee that a particular scanner will read a particular print. Testing with real hardware remains essential. Finally, bar width and colors are fixed at black bars on white, which is the most reliable combination; there are no styling options, and custom colors should be avoided because low contrast harms scanning.
Frequently Asked Questions
Which barcode format should I choose?
Choose CODE128 for general identifiers with mixed text and numbers. Choose EAN-13 for retail products outside North America and UPC-A for retail products in North America, using properly assigned numbers. Choose CODE39 for short uppercase identifiers in industrial, library, or asset settings.
How many digits do EAN-13 and UPC-A need?
EAN-13 needs 12 digits, with the check digit added automatically, or 13 digits including the check digit. UPC-A needs 11 digits, with the check digit added automatically, or 12 digits including the check digit. Other lengths produce an error.
Why does CODE39 reject my value?
CODE39 accepts only uppercase letters, digits, and the characters hyphen, dot, space, dollar, slash, plus, and percent. Lowercase letters and other symbols are not allowed. Convert the value to uppercase and remove or replace unsupported characters, then generate again.
Why is SVG the download format?
SVG is a vector format that scales to any size without blurring, which keeps bar edges sharp in print. Raster images blur when enlarged, and blurred bars scan poorly. Scale the SVG proportionally in your label design to preserve bar widths.
Will my barcode scan on any scanner?
Most scanners read these common formats, but compatibility depends on the scanner configuration, print quality, label size, and lighting. Always test the printed label with the actual scanner that will be used. If a scanner fails to read a valid symbol, check print resolution, contrast, quiet space, and size.
Is my value uploaded when I generate a barcode?
No. The barcode is generated in your browser after the library loads. Your value is not sent to a server. The library itself loads from a public content delivery network, but your data stays local.
Related Tools
These related tools create QR codes, encode values, and support labeling workflows. Browse the full collection from the FreeToolZones home page.
- QR Code Generator – create two-dimensional QR codes for links and text.
- UUID Generator – generate unique identifiers to encode as barcodes.
- Base64 Encoder – encode values for transport when a barcode is not needed.
- URL Encoder – encode URLs correctly for printed and digital use.
- Text Difference Checker – compare identifier lists when preparing label batches.