Free Barcode Generator
EAN-13, UPC-A, EAN-8, UPC-E, Code 128, Code 39 and ITF-14, with check digits done for you. Drawn in your browser by our own open-source encoder.
Barcode type
Retail products worldwide. Only valid in shops with a number from a GS1 company prefix.
12 digits (13 with check digit). Showing an example until you type. Check digit 1 calculated and added.
Size
The quiet zone the specification requires — 11 modules on the left, 7 on the right — is always included. This adds space beyond it.
Colours
EAN-13 · 4006381333931 · 95 modules
Printed at 300 dpi
- 39.6 × 18.5 mm
- bar0.339 mm
- 103%of nominal 0.33 mm
Table of contents
How to make a barcode
- 1
Pick the barcode type
EAN-13 or UPC-A for a retail product, ITF-14 for the carton it ships in, Code 128 for anything internal. The note under the menu says what each one is for.
- 2
Type the number or text
The preview redraws as you type. For EAN, UPC and ITF-14, leave the check digit off and it is calculated for you; type it and it is checked, with the right digit shown if yours is wrong.
- 3
Set the size for where it will be printed
Bar width and PNG scale together decide the printed size. The line under the scale tells you the size at 300 dpi and, for retail codes, whether that falls inside the range GS1 allows.
- 4
Download and test-scan
SVG for print and design software — it stays sharp at any size. PNG for documents and label printers. Scan the printed result with the scanner that will actually read it before printing thousands.
Which barcode to use
Selling in shops: EAN-13 or UPC-A, with a GS1 number. These are the barcodes on almost every retail product — EAN-13 everywhere, UPC-A as the 12-digit form still common in the US and Canada, and the two are read interchangeably by checkouts. The honest part: the barcode is only half of it. The number has to begin with a company prefix that GS1, the not-for-profit that runs the system, has licensed to your business. This tool will draw a flawless barcode for any number, but a number you invented belongs to nobody, and a retailer or marketplace that checks it against GS1's register will reject it.
Small packs: EAN-8 or UPC-E. EAN-8 is for packs too small for an EAN-13, and GS1 issues those numbers individually, on request. UPC-E is a UPC-A with its zeros squeezed out — it only exists for UPC-A numbers with a run of zeros in the right place. Paste a full UPC-A into UPC-E here and it is shortened if that is possible, or you are told why it is not.
Cartons and cases: ITF-14. The 14-digit GTIN on an outer box, encoded in Interleaved 2 of 5, a symbology with wide, forgiving bars that survive printing on corrugated board. The heavy bearer bars along the top and bottom are there for a reason: they stop a scanner that clips the edge from reading a shorter number that happens to be valid.
Everything internal: Code 128. Stock numbers, asset tags, order and parcel references, library cards, document tracking. It encodes any plain ASCII text, it is the most compact general-purpose linear barcode, every scanner reads it, and nobody's permission is needed to use it within your own business.
Legacy systems: Code 39. Older, wider, and limited to capitals, digits and a handful of symbols — but still specified by some industries and still the only thing some older readers accept. Use it when the system on the other end asks for it, and Code 128 otherwise.
Printing barcodes that scan
Leave the quiet zone alone. The blank margin either side of the bars is part of the barcode — it is how the scanner finds the edges. Every download here includes exactly the margin the specification asks for, and the extra-margin slider only ever adds to it. When the barcode goes into a label or a piece of packaging artwork, keep text, borders and edges of the label out of that space.
Print at a sensible size. A retail barcode at 100% has bar modules of 0.33 mm and GS1 allows 80% to 200%. Under the PNG scale the tool shows the printed size at 300 dpi and warns when it falls outside that range. For crisp edges, use whole-number scales and let the printer print at its native resolution rather than resizing the image in a document — a barcode stretched by 7% gets uneven bars. The SVG avoids the problem entirely, which is why designers and print shops prefer it.
Keep it tall, and keep it dark on light. Shortening an EAN's bars to fit the pack stops checkout scanners reading it at an angle. Scanners see colour roughly as a red light would, so dark blue, green or black bars are fine while red, orange and yellow bars vanish; light bars on a dark background fail on many readers. Matt surfaces beat glossy ones. On a narrow bottle or tube, turn the barcode so the bars wrap around the curve: the scan line then runs along the flat length instead of disappearing round the side.
Then test-scan the printed one. Not the preview on your screen — the real print, on the real material, with the scanner or app that will read it day to day. It is the only test that counts, and it is far cheaper before a print run than after.
How the encoder works
Every symbology here is implemented from its specification in dependency-free TypeScript. An EAN-13 is 95 modules: three guard patterns and twelve digits of seven modules each. Its thirteenth digit is never drawn — it is carried by which of the left six digits use odd and which even parity, which is why the first digit sits outside the bars on a real label. UPC-A is the same barcode with a leading zero, and the digits here are placed exactly as on a real label, with the guard bars running down between them.
Code 128 is where the interesting choice lives. Its three code sets hold upper case and control characters, upper and lower case, and pairs of digits. Rather than switch by a rule of thumb, the encoder runs a shortest-path search over every position and code set, so the result uses the fewest symbols that can represent the input — then appends the mod-103 check symbol and the stop pattern.
The proof is in the tests. Each symbology is checked against published examples, such as EAN-13 4006381333931 and UPC-A 036000291452, and then round-tripped through a separate decoder written only for testing, which reads bar widths the way a scanner does: thousands of random numbers and strings, every Code 128 result also checked against a second, differently built search for the minimum. A further test renders the SVG with an independent engine, reads a row of pixels and decodes that — confirming the quiet zones down to the pixel.
Frequently asked questions
Only if the number is yours to use. The barcode is just a drawing of a number; what makes an EAN or UPC valid at a checkout is that the number starts with a GS1 company prefix licensed to your business, so the retailer's system can tell your product from everyone else's. We generate a perfectly correct barcode for any number you type, but we cannot give you a number — that comes from GS1 in your country. Made-up numbers and numbers bought cheaply from resellers are often rejected by large retailers and marketplaces.
It is the last digit of an EAN, UPC or ITF-14, calculated from the others so a scanner can catch a misread. You do not need to type it: enter 12 digits for an EAN-13 and the thirteenth is worked out for you. If you do type it, it is verified, and if it is wrong you are told the correct one. A wrong check digit is never quietly replaced, because it usually means a typo earlier in the number.
Code 128. It encodes any plain ASCII text — letters in both cases, digits and punctuation — and it is the most compact general-purpose linear barcode, so it stays readable on small labels. Every handheld and phone scanner reads it. You do not need anyone's permission or prefix to use it inside your own business.
Code 128 has three code sets, and set C packs two digits into one symbol. Many generators switch between them with a rule of thumb; this one searches for the sequence with the fewest symbols, so long digit runs are packed, an odd digit is placed where it costs least, and a single control character is borrowed with SHIFT rather than switching sets twice. Fewer symbols means a narrower barcode at the same bar width.
When the system reading it was built for Code 39 — older warehouse and library systems, some ID badges, and industries such as automotive and defence that specified it decades ago. It only holds capitals, digits, space and - . $ / + %, and it is roughly half again as wide as Code 128 for the same data. For anything new, Code 128 is the better choice.
Only if the system reading it expects one. The mod-43 check character is optional in Code 39, and a scanner set up without it will read it as part of your data — an extra character at the end. If you are not sure, leave it off and test-scan.
It is the blank margin either side of the bars, and the scanner uses it to find where the barcode starts and ends. EAN-13 needs 11 modules on the left and 7 on the right; Code 128, Code 39 and ITF-14 need ten times the narrowest bar each side. Every download includes it. Printing text, a border or artwork into that margin is the most common reason a printed barcode will not scan.
For EAN and UPC, the nominal size has 0.33 mm bar modules, making an EAN-13 about 37 mm wide including its margins, and GS1 allows 80% to 200% of that. The tool shows the module size and percentage at 300 dpi as you change the settings. Keep the bars tall too: shortening them ("truncating") stops checkout scanners reading at an angle. ITF-14 on cartons is normally printed much larger, with modules of 0.5 to 1 mm.
Carefully. Most scanners shine red light and see colours roughly by their red channel, so red, orange and yellow bars all but disappear, while dark blue, dark green and black read well. Always put dark bars on a light background — inverted barcodes fail on many scanners. The tool warns when a colour pair is likely to fail.
Not from this page. The barcode is drawn in your browser by our own encoder, and nothing you type is uploaded — you can load the page and go offline. The optional API does receive what you send it, because that is how an API works, and it does not store it.
QR codes have their own generator on this site. GS1-128 (Code 128 with FNC1 and application identifiers, used on shipping labels), DataMatrix, PDF417 and the 2- and 5-digit EAN add-ons for magazines and books are not supported yet. We would rather say so than draw something that looks right and scans wrong.
API — same encoder, no key required
The encoder behind this page also runs behind a free REST endpoint, returning SVG. No API key, no sign-up, honest rate limits. Check digits behave exactly as they do here: added when missing, verified when given, and a wrong one is a 400 with the right digit in the message.
# SVG, straight into an <img src> or a file
curl 'https://zeal.tools/api/v1/barcode?type=ean13&data=400638133393' -o ean13.svg
# Code 128, wider bars, no text
curl 'https://zeal.tools/api/v1/barcode?type=code128&data=ZEAL-42&w=3&h=120&text=false'
# POST with options; format "json" also returns what was encoded
curl -X POST https://zeal.tools/api/v1/barcode \
-H 'content-type: application/json' \
-d '{"type": "itf14", "data": "1540014128876", "format": "json"}' MCP clients can call the same core: add https://zeal.tools/mcp to your client and use the generate_barcode tool.
The Zeal Promise
Non-negotiable, on every tool we ship.
- No sign-up — ever
- No watermarks on any output
- No ads near the download button
- Works fully on mobile
- Privacy-first: processing stays in your browser
- Open source (MIT) — audit it, contribute, self-host
- Zero runtime dependencies in tool logic