About the Barcode Generator
Type a number or some text, choose CODE128, EAN-13, UPC-A, Code 39, ITF, MSI or Pharmacode, and the barcode is drawn straight away. Save it as a PNG for a product, a stock label, a shipping box or a school project, then print it or add it to your artwork.
Bar width, height, margin and colours are all adjustable, and the number under the bars can be shown or hidden. The drawing happens on your own device, and the value you enter never goes to a server.
How it works
A barcode stores characters as a pattern of black bars and white spaces measured in modules, the thinnest bar width. Each format has its own alphabet: CODE128 encodes any standard keyboard character and packs pairs of digits together, EAN-13 encodes exactly 13 digits for retail products (UPC-A, its 12-digit US version, works the same way), and Code 39 uses a smaller set of capital letters, digits and a few symbols. The tool checks your input against the format's rules and shows an error instead of a barcode that wouldn't scan.
For EAN-13 and UPC-A the last digit is a check digit that lets a scanner spot a misread. Enter 12 digits for EAN-13 (or 11 for UPC-A) and it's calculated for you; enter the full number and the barcode is drawn only if the check digit is right. The image size follows directly from your settings:
image width = modules × line width + 2 × margin (wider only if the text is wider than the bars) image height = line height + (20 + 2 if the text is shown) + 2 × margin EAN-13 check digit: from the left, multiply digits 1-12 by 1, 3, 1, 3, ... add them up, and the check digit is the amount needed to reach the next multiple of 10.
Assumptions and limits
- EAN-13 needs 12 digits (the 13th is added) or 13 digits with a correct check digit. A real retail barcode number must come from GS1 or your marketplace; making the image doesn't register the number.
- UPC-A needs 11 digits (the 12th is added) or 12 digits with a correct check digit. The same number typed into EAN-13 with a 0 in front gives identical bars, so either option scans the same.
- Code 39 turns lowercase letters into capitals and accepts only A-Z, 0-9, space and - . $ / + %. ITF needs an even number of digits, MSI digits only, and Pharmacode a whole number from 3 to 131070.
- CODE128 takes standard ASCII characters only, so accented letters, Urdu or emoji won't encode.
- Dark bars on a light background scan best. Light bars on dark, or two similar colours, may look fine on screen and still fail at the till.
Worked examples
An EAN-13 barcode with the check digit added
Choose EAN-13 (Retail) and type the 12 digits 590123412345. The tool works out the check digit and draws 5901234123457, with the digits grouped under the bars the way they appear on supermarket packaging.
5×1 + 9×3 + 0×1 + 1×3 + 2×1 + 3×3 + 4×1 + 1×3 + 2×1 + 3×3 + 4×1 + 5×3 = 83 next multiple of 10 is 90, so the check digit is 90 - 83 = 7 → 5901234123457
A CODE128 stock label for an SKU
SKU-4471-BLK mixes letters, digits and hyphens, which CODE128 handles directly. With the default line width of 2 px and margin of 10 px it's 167 modules, so the PNG is 354 px wide; a 12-digit number like 123456789012 is only 101 modules (222 px wide) because CODE128 stores digits in pairs.
ITF for a carton number
ITF encodes digits in pairs, so 12345678 works but 1234567 shows an error. Add a leading zero (01234567) to make the count even. ITF is common on outer cartons because its wide bars survive printing on cardboard.
Which barcode format to use
| Format | What it accepts | Typical use |
|---|---|---|
| CODE128 | Any ASCII letters, digits and symbols | Shipping labels, SKUs, inventory, asset tags |
| EAN-13 | 12 digits (check digit added) or 13 with a valid check digit | Retail products worldwide |
| UPC-A | 11 digits (check digit added) or 12 with a valid check digit | Retail products in the US and Canada |
| Code 39 | A-Z, 0-9, space and - . $ / + % | Industrial parts, ID badges, older systems |
| ITF | An even number of digits | Outer cartons and cases |
| MSI | Digits only | Shelf labels and warehouse bins |
| Pharmacode | A whole number from 3 to 131070 | Pharmaceutical packaging control |
How to use the Barcode Generator
- Enter the value. Type the number or text under Barcode Value / Data and pick the format from the list.
- Adjust the look. Set line width, line height and margin, choose the colours, and tick or untick Show text value.
- Download the PNG. Check the live preview, then press Download Barcode; the file is named after the format and value.
Frequently asked questions
How do I make a barcode for my product?
If you'll sell in shops or on marketplaces that need a GTIN, first get a number from GS1 (or the marketplace), then choose EAN-13 here and type it. For your own stock, shelves or shipping, CODE128 is the easiest choice because it takes letters, digits and dashes of any length.
Can I create a UPC barcode?
Yes. Choose UPC-A (US Retail) and type the 12-digit number, such as 036000291452, or just the first 11 digits and the check digit is added for you. Typing the same number into EAN-13 with a 0 in front (0036000291452) gives identical bars, because UPC-A is a subset of EAN-13.
Why does it say my input is invalid?
The value doesn't fit the format's rules, and the line under the value box says what the chosen format accepts: EAN-13 wants 12 or 13 digits and UPC-A 11 or 12, with a correct check digit, ITF an even number of digits, Code 39 only capitals, digits and its few symbols, and Pharmacode a number between 3 and 131070. Switch to CODE128 if your value has letters or an odd length.
What size should I print a barcode?
Whatever size you print, keep the bars crisp. Download with line width 2 or more and scale the image down rather than up, so bars stay sharp. Leave the white margin around it, called the quiet zone, and test it with a phone scanner before you print a full batch of labels.
Can I change the barcode colour?
Yes, both the bars and the background. Scanners need strong contrast, so dark bars on a white or pale background are safest. Red bars often don't scan, because many scanners use red light and see red as white.
Is my barcode data sent anywhere?
No. The barcode is drawn on a canvas in your browser and saved straight to your device as a PNG, so product numbers and internal codes stay on your computer. You can make as many barcodes as you like.
Sources
This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.