Skip to content
ToolBoxGeniehome

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.

Symbology

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.

12 digits, or 13 if you already have the check digit. Spaces and hyphens are ignored.

Size
Printed digits

Result

EAN-13 barcode for 5901234123457
Complete number
5901234123457
Check digit
7

Verified against what you typed

Symbol width
95 modules

Plus the quiet zones either side

Prefix 590
GS1 Poland

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-1313 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-A12 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-88 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

  1. 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.
  2. 2Type the number. Enter the data digits alone to have the check digit calculated, or the full number to have it verified.
  3. 3Choose a size and whether to print the digits beneath the bars, which is what a real retail label does.
  4. 4Copy the SVG markup or download the file. It is a vector, so it stays sharp at whatever size you print it.
  5. 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?
It is a modulo-10 checksum over the other digits, and it is what lets a scanner reject a misread instead of reporting the wrong product. Digits are weighted alternately by three and one from the right, summed, and the check digit is whatever brings that total to a multiple of ten. Change any single digit and the sum stops matching, which is exactly the error a smeared or partly obscured barcode produces.
Can I make up a number and sell the product?
No. Generating a valid symbol and owning the number are different things: retail numbers are allocated by GS1, and a number you invent may already be on another company's product. For anything that will cross a shop counter you need a company prefix from your national GS1 organisation. For internal use — a library, an asset register, your own stock system — any number that suits you is fine.
Does the prefix tell me where a product was made?
It does not, and this is the most widely repeated barcode myth there is. The first two or three digits identify the GS1 member organisation that issued the company prefix, which is usually where the company registered, not where the goods were manufactured. A product made in one country by a company registered in another carries the second country's prefix.
Why does my printed barcode fail to scan?
Four causes cover almost all of it. The quiet zones — the blank margins either side — have been cropped, and they are part of the symbol rather than padding. It has been printed too small, or scaled non-uniformly so the bar widths no longer hold their ratios. It is on a glossy or coloured surface that defeats the scanner's contrast. Or the bars have been printed in a colour other than a genuinely dark one: red in particular is invisible to many red-laser scanners.
Which symbologies are supported?
The GS1 retail family only: EAN-13, EAN-8 and UPC-A. Code 128, Code 39 and ITF-14 are not included, and that is a deliberate limit rather than an oversight. An approximated symbol that looks convincing and scans as a different number would be worse than no barcode, so the tool covers what it can encode correctly and says what it cannot.
Why SVG rather than an image file?
Because a barcode is printed, and a vector stays exact at any size. A bitmap has to be generated at a resolution chosen in advance, and any later scaling blurs the bar edges — which is precisely the property scanners depend on. The SVG here is self-contained with no external styles, so it can be dropped into a label template as it is.