Barcode Generator
Generate EAN-13, EAN-8, UPC-A, Code 39 and Code 128 barcodes with automatic check digits and PNG download, all processed locally in your browser.
How to use
- Pick a barcode type, then enter the matching digits or characters in the data field.
- EAN-13, EAN-8 and UPC-A take digits only; Code 39 uses upper case, digits and
- . space $ / + %; Code 128 covers ASCII 32 to 127. - Click "Generate barcode". The bars are drawn on a canvas with human readable text below.
- You never have to work out the check digit: 12 digits get the 13th one appended, and a full 13 digit entry is verified.
- Click "Download PNG" to save a white background image with black bars, ready to scale and print.
FAQ
How is the EAN-13 check digit calculated?
Why can I enter only 12 digits for EAN-13?
Can the generated barcode be printed and scanned?
Why does Code 128 only accept ASCII text?
How to use
- Pick type and data
Choose the barcode type at the top, then type the matching content. Numeric symbologies take digits only, while Code 39 and Code 128 also accept letters.
- Check the symbology
EAN-13 and UPC-A both use six left hand digits, but EAN-13 carries an extra leading digit. Picking the wrong type makes scans disagree with your records.
- Generate and compare
Click Generate barcode. The bars appear on a canvas with human readable text underneath, so you can compare it against the input digit by digit.
- Confirm the check digit
A 12 digit entry gets the 13th check digit appended. A full length entry is verified, and a mismatch reports the value that should be there.
- Download or adjust
Click Download PNG to save the image. Change the data and generate again whenever you need a different symbol.
About this tool
This tool builds five common linear barcodes in your browser. EAN-13 is the retail standard, and its six left hand digits use the L and G sets. A parity pattern chosen by the leading digit picks the sets, and that digit occupies no bars. EAN-8 fits small packages with a shorter symbol. UPC-A is the North American retail format and uses all twelve digits in the bars. Code 39 uses the standard 43 character table and suits asset or part labels. Code 128 uses Code128B, covering ASCII 32 to 127 at a high data density.
Everything runs in local JavaScript, so the data never leaves the page. EAN and UPC check digits follow the GS1 rule. Weight odd positions by three from the right, weight even positions by one, then take the complement to the next multiple of ten. Each Code 39 character has nine elements, five bars and four spaces. Every character carries exactly three wide elements, and this tool uses a three to one width ratio. Code 128 symbols hold six elements and eleven modules, and the check symbol is the weighted sum modulo 103.
How it works
A linear barcode turns data into bars and spaces of differing widths. A scanner measures the reflected light and recovers the width sequence, then looks up the characters. In the EAN family the left half has two encodings: L starts with a space, G starts with a bar, and they mirror each other. Which one is used depends on the leading digit, so a decoder can recover that digit from the parity pattern alone. The right half always uses R codes. With the start, centre and end guards, the whole symbol is 95 modules wide.
The check digit is not decoration. It lets the scanner judge whether a read is trustworthy. For EAN-13 the first twelve digits are weighted and summed. The total is then raised to the next multiple of ten, and the difference is the final digit. If any digit is misread, the recomputed value usually disagrees. The device then asks for another scan instead of passing a wrong number to the till. UPC-A and EAN-8 use the same rule with a different starting weight.
When to use it
- Retail proof
When a private label product needs artwork approval, a scannable EAN-13 proves the symbol fits the panel and keeps enough quiet zone. Testing it before the full print run starts avoids a costly packaging reprint later on the shelf.
- Warehouse asset labels
Shelf, tote and machine numbers often contain hyphens and prefixes. Code 39 encodes that content directly, works with most handheld scanners, and prints cleanly on simple thermal label stock. No special barcode fonts, extra software or middleware are needed at all.
- Ticket and coupon codes
Long serial numbers on tickets, coupons and pick up slips fit into Code 128 at a modest width. The check symbol cuts down on failed or mismatched scans when staff verify each code at the counter during a busy event.
Tips & tricks
- Enter only 12 digits for EAN-13 and let the tool append the check digit, which removes a common source of typos.
- Code 39 works in upper case only. Lower case input is converted automatically, so use Code 128 if the exact case matters.
- Scale the image up before printing and keep the quiet zones intact, or scanners may fail to find the symbol edges.
Things to watch
- Quiet zones trimmed
Both ends of a barcode need clear space, usually nine modules or more for EAN and UPC. Cropping the artwork too tightly hides the start and end guards from the scanner, so reads become unreliable and staff blame the hardware.
- Printed too small
Printing at one to one screen pixels makes the narrow elements too thin for an office laser printer. Scale the symbol up, prefer a higher resolution output path, and keep the printed bars crisp and free of toner spread on paper.
- Wrong symbology chosen
An EAN-13 and a UPC-A look nearly identical when the leading digit is zero. Encoding as UPC-A while the catalogue expects EAN-13 yields an extra zero on every scan. Always match the symbology registered in your own inventory or catalogue system.