Barcode Generator
Generate Code 128, EAN-13, UPC-A, or Code 39 barcodes in your browser.
Written by Golam Rabbani, Founder & Lead Engineer
How to use this barcode generator
- Select a barcode format from the "Symbology" dropdown: Code 128, EAN-13, UPC-A, or Code 39.
- Enter the data string in the "Barcode Data" field; the hint shows a valid example for the chosen format.
- Set the bar height using the "Height (10–200 mm)" field.
- Toggle "Show human-readable text below barcode" on or off as needed.
- Press "Generate" to render the barcode, then click "Download PNG" to save the image.
About this barcode generator
A barcode generator creates machine-readable linear barcodes from a text string, rendering the result instantly in your browser without any server upload. This tool supports four widely used symbologies: Code 128 (alphanumeric, used in shipping and logistics), EAN-13 (13-digit retail product codes), UPC-A (12-digit North American retail codes), and Code 39 (alphanumeric, common in manufacturing and healthcare).
Rendering is handled by the bwip-js library running locally. You choose a symbology, supply the data string, set the bar height between 10 and 200 mm, and optionally show the human-readable text beneath the bars. The library encodes your string according to the symbology's character set rules and draws the result onto an HTML canvas at 3× scale for sharp output. If the data string is invalid for the selected format — for example, a non-numeric character in an EAN-13 value — the tool surfaces an error message rather than producing a corrupted code.
As a worked example, selecting EAN-13 and entering the string 5901234123457 at a height of 60 mm produces a standard 13-bar retail barcode with the digit string printed below. Switching to Code 128 and entering Hello-World at the same height produces a compact alphanumeric barcode suitable for a shipping label.
The tool suits developers testing label layouts, small retailers generating product barcodes, and warehouse teams needing quick label prototypes.
FAQ
- What symbologies does the barcode generator support?
- The tool supports Code 128, EAN-13, UPC-A, and Code 39. Code 128 handles any printable ASCII character; EAN-13 and UPC-A require strictly numeric strings of a fixed length; Code 39 supports uppercase letters, digits, and a small set of symbols.
- What format does the barcode generator use for EAN-13 and UPC-A input?
- EAN-13 expects a 13-digit numeric string (including the check digit), for example 5901234123457. UPC-A expects a 12-digit numeric string, for example 012345678905. Entering a string with the wrong length or non-numeric characters will produce an error.
- How accurate is the generated barcode?
- Barcodes are rendered by bwip-js, a library that implements the official symbology specifications. The output is suitable for testing and prototyping. For production labelling on retail packaging, validate the final code with a hardware verifier against the relevant ISO standard.
- What happens if I enter invalid data for the selected symbology?
- The tool displays an inline error message explaining the problem and does not produce a barcode. Common causes are non-numeric characters for EAN-13 or UPC-A, and characters outside the Code 39 alphabet.
- Does this tool store or transmit my barcode data?
- No. The barcode generator runs entirely in your browser using a local JavaScript library. Nothing you enter is sent to a server, logged, or stored anywhere.
- Is the barcode generator free to use?
- Yes, it is completely free with no account or signup required.