Barcode Generator - EAN-13, UPC-A and EAN-8 Codes

    Build and check EAN-13, UPC-A and EAN-8 numbers with the GS1 check digit worked out term by term. The bars are drawn here as an inline SVG rather than fetched from an outside service, and the prefix is looked up so you know which GS1 office issued it.

    Parameters

    Enter data for calculations

    Decides the digit count and the encoding

    Generate from scratch, from a prefix, or check an existing code

    The leading digits to keep fixed

    An existing barcode number to check

    Form progress0 / 2 fields

    💡 Fill in all required fields to unlock the calculate button

    The problem: a barcode is not a picture of some numbers

    Type thirteen digits, draw thirteen sets of bars, done. Except the last digit is not yours to choose. It is computed from the other twelve, and a scanner recalculates it every single time it reads the label. Get it wrong and the beep never comes. That is the whole reason a generator exists: not to draw lines, but to work out the digit that makes the lines mean something.

    Three formats, one arithmetic. EAN-13 for retail almost everywhere, UPC-A for the United States and Canada, EAN-8 for packaging too small to fit the other two. This tool builds all three from scratch, checks numbers you already have, and tells you which GS1 member organisation issued the prefix.

    The solution, and its one honest limit

    The check digit is computed, not guessed. Every code that comes out of here validates, and the output shows the arithmetic term by term so you can follow it rather than trust it.
    The bars are drawn here, not fetched. The image is an inline SVG built in your browser session. Nothing is sent to a third-party barcode service, which also means the picture cannot break when somebody else's server does.
    The prefix is looked up. Enter 978 and it tells you the number belongs to the ISBN range for books, not to a country.
    The limit, stated plainly. A generated number is structurally valid and completely unregistered. Real retail codes are issued to you by GS1 against a company prefix you licence, and putting an invented one on a product for sale collides with somebody else's article sooner or later. Use these for mockups, test fixtures, label templates and teaching. For a product that will cross a till, buy the prefix.

    Which format do you actually need

    If you are Pick Digits Because
    Selling retail in Europe, Asia, Australia EAN-13 13 The default GTIN everywhere outside North America
    Selling retail in the US or Canada UPC-A 12 What North American tills expect on the shelf
    Labelling something too small for 13 digits EAN-8 8 Half the width, and GS1 issues it only when space forces it
    Publishing a book EAN-13 13 An ISBN barcode is an EAN-13 starting 978 or 979
    Numbering stock that never leaves your shop EAN-13 13 Use prefix 20 to 29, reserved so it can never clash outside your walls

    Working the tool, in order

    1. Symbology - decide from the table above. It also sets how many digits everything else expects, so change it first rather than last.
    2. Mode - Random for a throwaway that scans. From a GS1 prefix when the first few digits have to be a particular range. Validate when you already have a number and want to know if it survives a scanner.
    3. GS1 prefix - digits only, and shorter than the base. An EAN-13 base is 12 digits, so the prefix can run to 11, though in practice you enter the two to seven you were issued.
    4. Code to validate - paste it with spaces or hyphens if that is how you have it; everything but the digits is stripped before checking.
    5. Read the arithmetic - the details output prints each digit with the weight it was multiplied by, the running total, and how that total becomes the check digit. If a supplier disputes your number, that is the paragraph to send them.

    Five situations this settles

    A product page mockup that has to look real. Random EAN-13. You get something like 4006381333931, which validates, renders and photographs correctly on a dummy pack shot. Nobody reviewing the design will notice it is not registered, and the label template gets tested at the right width.
    One code in a supplier spreadsheet does not scan. Validate mode. If the check digit is wrong the output names the digit it should have been and rebuilds the correct number, which usually reveals a transposed pair in the middle rather than a wrong final digit.
    Test fixtures for a point-of-sale integration. Prefix mode with your real company prefix gives you a hundred distinct codes that all share the right head and all pass validation, which is exactly what an import routine needs to be tested against.
    Packaging where the barcode will not fit. EAN-8 is 67 modules wide against 95 for EAN-13, so at the same module width it takes about 30 percent less room. Generate one and drop it into the artwork before committing to the smaller box.
    A shelf label for stock you weigh yourself. Prefix mode, prefix 20. That range is reserved for restricted circulation, meaning the number is guaranteed never to collide with a manufacturer's article anywhere in the world, because it is not supposed to leave your premises.

    Quick reference

    Format Total digits Base Modules Quiet zone First weight
    EAN-13 13 12 95 11 left, 7 right 1
    UPC-A 12 11 95 9 each side 3
    EAN-8 8 7 67 7 each side 3

    That last column is where most home-made check digit routines go wrong. The weights alternate 3 and 1 counting from the check digit backwards, not from the left. A 12-digit base therefore starts on 1 and a 7-digit or 11-digit base starts on 3. Write the loop from the left with a fixed starting weight and it will be right for EAN-13 and wrong for the other two, which is a pleasant kind of bug because it passes your first test and fails in production.

    Prefix Issued by Prefix Issued by
    000-019, 030-039, 060-139 United States 590 Poland
    020-029, 040-049, 200-299 Restricted circulation (050-059 is coupons) 690-699 China
    300-379 France and Monaco 754-755 Canada
    400-440 Germany 840-849 Spain
    500-509 United Kingdom 977 Serial publications, ISSN
    520-521 Greece 978-979 Books, ISBN and ISMN

    The tool knows a wider list than this and reports it for any code you generate or check. What no tool can tell you is where a thing was manufactured: a prefix records which GS1 office sold the number to which company. A German company can licence a 400 prefix and have the goods made anywhere in the world.

    What people get stuck on

    Can I put a code from here on something I sell?
    No. It will scan, and it is not yours. Retail numbers come from GS1 with a company prefix you licence. Anything generated here is for mockups, tests, teaching and label artwork.
    Is UPC-A really just EAN-13 with a zero?
    Yes, and not as a metaphor. Put a zero in front of a 12-digit UPC-A and encode it as EAN-13 and you get the identical pattern of bars, because the parity rule for a leading zero happens to be six left-hand codes in a row. That is literally how this tool draws UPC-A.
    Why does my code fail validation when I am sure it is right?
    Check the length first, because the tool compares against the symbology you picked and an EAN-13 pasted while EAN-8 is selected fails on digit count alone. After that, look at the rebuilt number in the output. If it differs from yours in the middle rather than at the end, you have a transposition, not a bad check digit.
    Does the check digit catch every mistake?
    Every single wrong digit, yes, always. Swapped neighbours, almost always: the only pair it misses is two adjacent digits that differ by exactly 5, such as 27 becoming 72, because swapping them shifts the weighted sum by a multiple of ten and the remainder does not move.
    The bars look narrow. Will they scan when printed?
    The SVG scales without loss, so print it at whatever width the artwork needs and the proportions hold. What ruins scanning is not size but the white space: the empty margin either side is part of the symbol, and cropping it tight to the bars is the single most common reason a printed label refuses to read.
    Why is the first digit printed outside the bars?
    Because on EAN-13 it is not drawn as bars at all. Only twelve digits are encoded; the thirteenth is carried by the pattern of odd and even codes used in the left half. The scanner reads that pattern and recovers the digit, which is why it sits in the margin rather than under a block of its own.
    What happened to Code 128 and Code 39?
    They are not here on purpose. This tool covers the three GS1 retail symbologies that share one encoding family and one check digit rule, and encodes them properly rather than handing the drawing to somebody else's server. Adding Code 128 means a 107-pattern table and character-set switching, which deserves its own tool rather than a fourth entry in a dropdown.

    Related tools

    Lorem Ipsum Generator

    The product copy for the same mockup this barcode is going on - Open the generator

    Palindrome Generator

    Also checks a string against a rule, except the rule there is symmetry rather than a weighted sum - Open the generator

    Anagram Generator

    Counts how many orderings a set of letters allows - Open the generator

    Random Number Generator

    Draws the digits, without wrapping them in a check digit - Open the generator

    Password Generator

    For the staging login on the shop you are mocking up - Open the generator

    Similar calculators from this section