Barcode Generator
Developer Tools · Added
Enter a product number and get a scannable EAN-13, EAN-8 or UPC-A barcode as an SVG you can print at any size. The check digit is calculated if you leave it off and verified if you include it, the quiet zones are drawn as part of the symbol, and everything happens in your browser.
Result
- Complete number
- 5901234123457
- Check digit
- 7
- Symbol width
- 95 modules
- Prefix 590
- GS1 Poland
Verified against what you typed
Plus the quiet zones either side
The check digit is a modulo-10 checksum over the other digits, which is how a scanner rejects a misread rather than reporting the wrong product. The quiet zones — the blank margins either side — are part of the symbol, not padding: crop them off and many scanners will not read it. Print at 100% scale, on a matte white surface, with the bars dark and unbroken.
Before you use this commercially: generating a valid symbol is not the same as owning the number. Retail barcodes are allocated by GS1, and a number you invent may already belong to another company’s product. For a barcode that will cross a shop counter, get a company prefix from your national GS1 organisation. For internal use — a library, an asset register, your own stock system — any number you like is fine.
Which symbology to pick
- EAN-13 — 13 digits
- The standard retail barcode outside North America, and readable everywhere. The first two or three digits are the GS1 prefix for the country of the numbering organisation, not the country of manufacture.
- UPC-A — 12 digits
- The North American retail code. It is an EAN-13 with a leading zero, so the printed symbol is identical and any EAN scanner reads it.
- EAN-8 — 8 digits
- The short form, issued for packages too small to carry a full EAN-13. GS1 allocates EAN-8 numbers individually rather than from a company prefix.
This tool covers the GS1 retail family only. Code 128, Code 39 and ITF-14 are not included: an approximated symbol that scans as the wrong number would be worse than no symbol at all.
How to use the barcode generator
- 1Pick the symbology. EAN-13 is the international retail standard, UPC-A is its North American form, and EAN-8 is for packages too small for either.
- 2Type the number. Enter the data digits alone to have the check digit calculated, or the full number to have it verified.
- 3Choose a size and whether to print the digits beneath the bars, which is what a real retail label does.
- 4Copy the SVG markup or download the file. It is a vector, so it stays sharp at whatever size you print it.
- 5Print at 100% scale on matte white. Scaling down in a layout tool is the commonest reason a barcode will not scan.
Examples
EAN-13 with the check digit added
- Input
- 590123412345
- Result
- 5901234123457 — the seventh being calculated
The 590 prefix identifies GS1 Poland as the issuing organisation.
UPC-A
- Input
- 036000291452
- Result
- A 95-module symbol, identical in structure to an EAN-13 beginning with zero
A number with a typo
- Input
- 5901234123458
- Result
- Refused, with 5901234123457 offered as the correction
The check digit exists precisely so that a wrong number can be spotted.
An ISBN
- Input
- 9780306406157
- Result
- A valid EAN-13, with the 978 prefix identified as the book range
About the barcode generator
How the digits become bars
Each digit occupies seven modules, a module being the width of the narrowest bar. Those seven modules are drawn from one of three alphabets — L and G for the left half of the symbol, R for the right — and the guard patterns at the start, middle and end mark out where each half begins.
The three alphabets are related rather than independent: R is the bit-complement of L, and G is R written backwards. That relationship is what lets a scanner read the symbol from either end and work out which way round it was, and it is asserted in this project's verification suite so a mistyped pattern fails the build rather than shipping.
The thirteenth digit that is never drawn
An EAN-13 has thirteen digits but only twelve positions in the symbol. The first digit is not drawn at all. Instead it determines which of the six left-hand digits use the L alphabet and which use G, and a scanner recovers it by observing that parity pattern.
It is an elegant piece of backwards compatibility. UPC-A came first with twelve digits; EAN needed thirteen and could not afford to be wider or to break the installed base of scanners. Encoding the extra digit in the parity meant an EAN-13 is physically identical to a UPC-A, which is why every modern scanner reads both and why a UPC-A is simply an EAN-13 whose first digit is zero.
Printing one that works
GS1 specifies a nominal size and a permitted magnification range, roughly 80% to 200% of it. Below the bottom of that range the bar edges stop being reproducible by ordinary printing, and scanners start failing intermittently — which is worse than failing outright, because it passes testing and then breaks at a till.
Print at 100% scale, on matte rather than gloss, with genuinely dark bars on a genuinely light background. Keep the quiet zones. And test the printed label with a real scanner rather than a phone app: phone cameras are far more forgiving than laser scanners, and a symbol that reads on a phone may still fail at a checkout.
Frequently asked questions
What is the check digit for?
Can I make up a number and sell the product?
Does the prefix tell me where a product was made?
Why does my printed barcode fail to scan?
Which symbologies are supported?
Why SVG rather than an image file?
Related tools
QR Code Generator
Developer Tools
Create a QR code for a link, Wi-Fi network, contact card or any text, and download it as SVG.
UUID Generator
Developer Tools
Generate cryptographically random UUIDs in bulk, with formatting options.
Image to Base64
Image Tools
Turn an image into a Base64 data URI ready to paste into CSS or HTML.