Barcode Generator

Global tools

A barcode is a promise made to a scanner you will never meet. Get one bar width wrong and the till, the warehouse gun or the parcel sorter does not complain - it simply refuses the code, and you find out at the worst possible moment. Almost all of that risk is arithmetic: the check digit, the quiet zones, the wide-to-narrow ratio, and the parity pattern that spells the first digit of an EAN-13 without ever drawing it.

The type has to match what the scanner on the other end expects, and what the number is allowed to be.

Digits for the retail types, text for Code 39 and Code 128. Spaces and dashes in a number are ignored, and a missing check digit is added for you.

Every bar and space is a whole multiple of this. Two pixels is a good screen size; a printed label wants a little more.

Taller bars are easier to scan at an angle, which is why retail symbols are about 22 mm tall.

The human readable line, drawn in the SVG. The PNG holds bars only - a raster writer with no font cannot draw it.

The frame a carton label is normally printed inside. Every other type ignores this.

Automatic is shorter; some older scanners and label printers want a set pinned by hand. Every other type ignores this.

Results update as you type. Nothing leaves your device.

EAN-13 barcode

5901234123457

95 modules of bars, 11 + 7 modules of quiet zone, 226 x 82 px at 2 px per module.

Modules
95
Bars
30
Check
7
Printed size
226 x 82 px

Your barcode

EAN-13 barcode for 5901234123457

EAN-13, drawn at 2 px per module. The white space around the bars is the quiet zone a scanner needs to find the start of the code, so it is part of the picture rather than a margin.

Point a phone at the screen before you print: if the screen reads, the print will. The SVG download is the one to print from - it stays sharp at any size.

How this code was built

  1. The first digit, 5, is not written as bars: it selects the parity pattern LGGLLG for the six left digits, which is how 13 digits fit in a symbol with room for 12.
  2. Left guard 101, six digits in the L and G alphabets, center guard 01010, six digits in the R alphabet and a closing 101 - 95 modules in total.
  3. The check digit is 7: from the right of 590123412345, digits are weighted 3 and 1 in turn, and 7 takes that total to the next multiple of ten. Type the 12 digits without it and it is added for you.
  4. Quiet zones of 11 modules on the left and 7 on the right are part of the symbol, not decoration: a scanner needs that much white to find the start of the code.

Which symbology to use

SymbologyIt takesCheck characterWhere it is used
EAN-1312 digits (or 13 with the check digit)mod 10, weights 3 and 1Retail products worldwide
UPC-A11 digits (or 12 with the check digit)mod 10, weights 3 and 1Retail in the US and Canada
EAN-87 digits (or 8 with the check digit)mod 10, weights 3 and 1Small packages with no room for 13
ITF-1413 digits (or 14 with the check digit)mod 10, weights 3 and 1Shipping cartons and trade items
Code 39A-Z, 0-9 and - . space $ / + %none (self-checking)Asset tags, inventory labels
Code 128the 95 printable ASCII charactersmod 103, built into the symbolEverything else: labels and packaging

Numbers shorter or longer than a symbology allows are refused with a sentence saying what that symbology takes, rather than padded into something a scanner would misread.

Black on white, always: contrast is what a scanner reads, and inverted or colored bars are the commonest reason a code will not scan. Print at 100%, keep the quiet zone, and do not stretch the symbol sideways - the ratio between bar widths is what carries the data.

This page does that arithmetic from the published symbology specifications and draws the result in the tab. Choose the type, type the number or text, and you get the symbol on screen, an SVG to print from and a PNG for everything that will not take an SVG. Nothing is uploaded, and there is no account, no queue and no watermark.

About this barcode generator

Scanners are unforgiving readers: one wrong bar width and the till, the warehouse gun or the parcel sorter simply refuses the code, usually at the least convenient moment. This page draws EAN-13, UPC-A, EAN-8, ITF-14, Code 39 and Code 128 from the published symbology rules, with the check digit and the quiet zones worked out for you.

The symbology specifications set the bar ratios, the parity pattern that spells an EAN-13 leading digit without drawing it, and the quiet zone each type insists on, so a symbol that scans is not a matter of taste. Encoding, drawing and both downloads run client-side in your browser, and there is no endpoint behind the page that could accept your data.

This page makes a symbol, not a registration. It cannot issue a GTIN, cannot tell you whether a number is already assigned elsewhere, and cannot promise that a printer holds the narrow bars the way the screen does. What it does is turn a valid number into a compliant symbol you can scan and test yourself.

How this barcode generator works

Six symbologies, and how to choose between them

EAN-13 is the retail code on almost every product sold outside North America, UPC-A is its American and Canadian twin (an EAN-13 whose first digit is zero), and EAN-8 is the squeezed version for a lipstick or a packet of gum where thirteen digits will not fit. All three end in a check digit and start with a guard pattern, and all three are assigned through GS1, so the numbers themselves are not something you invent.

ITF-14 is the one you see on corrugated cartons. It carries a 14-digit GTIN, encodes its digits in pairs - the first of each pair in the bars, the second in the spaces between them - and is normally printed inside a frame of bearer bars, which is why that option is on the form. It is the least forgiving symbology here: a partial scan of an ITF symbol is the classic way a box reaches the wrong warehouse, so the bearer bars and the wide elements are both drawn the way the specification asks.

Code 39 is the oldest and simplest of the alphanumeric types: 43 characters, no check digit, and a start/stop asterisk that tells a scanner the code was read the right way round. It is wide and wasteful and still everywhere on asset tags and ID badges. Code 128 is what you use when it matters how much fits: every printable ASCII character, a mandatory check symbol, and two digits per symbol in code set C - which is why a numeric label in Code 128 is roughly half the width of the same text in Code 39.

The arithmetic that has to be right

Every retail number ends in a check digit: weights of 3 and 1 alternate from the right of the payload, and the check digit is whatever brings the total to a multiple of ten. Type the first twelve digits of an EAN-13 and the thirteenth is added for you; type all thirteen and the digit you supplied is verified. If it does not match, the page says which digit it should have been rather than quietly correcting a number that is probably a typo somewhere else.

EAN-13 has one genuinely clever piece of arithmetic. The symbol has room for twelve digits but the number has thirteen, so the first digit is never drawn. It chooses which of two alphabets - called L and G - each of the six left-hand digits is written in, and a scanner reads that pattern of alphabets back to recover it. Get the parity table wrong and the symbol still looks like a barcode; it just means a different number. It is one of the things we check hardest before release.

Code 128 checks itself differently: a weighted modulo-103 sum over the start symbol and every symbol in the code, transmitted as one more symbol before the stop pattern. A scanner recomputes it and throws the scan away if it disagrees, which is why Code 128 needs no printed check digit and can carry anything printable.

Modules, ratios and the white space around the bars

A barcode is measured in modules: the narrow bar is one module, every other bar and space is a whole multiple of it, and the narrow bar width in pixels decides the size of the whole symbol. Two pixels per module is what a screen wants; a print wants the specification's own units, where GS1 gives a retail symbol a nominal module width of 0.33 mm - so the module width setting here is really a print-size setting, not a zoom level.

The quiet zone is the white margin on each side, and it is part of the symbol rather than decoration: a scanner needs it to find where the code starts. EAN-13 wants 11 modules on the left (the leading digit is printed in that space) and 7 on the right, UPC-A 9 on each side, EAN-8 7, and ITF-14, Code 39 and Code 128 at least 10. Every image here includes those margins, so a barcode saved from this page cannot be cropped into something unscannable by accident - and stretching it sideways, which is easy to do once it is inside a word processor, is the other way to break a bar code. Scale it, do not stretch it.

Wide elements are ratios rather than absolute widths, so each is chosen inside the range its specification allows: 2:1 for Code 39 (the narrowest that is legal, and the shortest symbol) and 3:1 for ITF-14, where a fatter wide bar survives the ink spread of a carton print far better.

What this generator deliberately does not do

It does not hand out barcode numbers. An EAN or UPC prefix is allocated by GS1 as a membership, and a check digit is a typo detector rather than a security feature - a valid-looking code invented here will not scan as a product anywhere. What the page can do is encode a number you already hold, or an internal code for your own labeling.

It also does not do 2D codes. QR, Data Matrix, PDF417 and Aztec are a different family with different arithmetic, and a QR code generator is a separate tool; nothing here pretends to draw one. GS1-128 - the shipping label that carries a GTIN, a batch number and a date - needs FNC1 application identifiers, which are not generated here either: use ITF-14 for a carton's GTIN and a GS1-128 tool for the rest. Code 39 is generated without the optional mod-43 check digit and without its full-ASCII extension, and Code 128 is limited to code sets B and C, which is to say the printable ASCII characters.

Nothing here is AI-assisted and there is nothing to sign up for. The encoder is a table of bar widths taken from the published standards plus a checksum; its output is checked character by character against the published specifications for the same inputs, and then decoded back with an independent reader.

Worked examples

Each example below was run through the calculator on this page when the site was built, so the numbers match what you see when you enter the same inputs.

A retail product: EAN-13 without the check digit

Barcode type: EAN-13 - retail products (13 digits) · What to encode: 590123412345

EAN-13 barcode

5901234123457

95 modules of bars, 11 + 7 modules of quiet zone, 226 x 82 px at 2 px per module.

Modules: 95 · Bars: 30 · Check: 7 · Printed size: 226 x 82 px

Twelve digits are enough: the thirteenth is the check digit, and here it works out as 7. The symbol is 95 modules wide, which is fixed for every EAN-13 - only the bars inside change.

A shipping carton: ITF-14 with bearer bars

Barcode type: ITF-14 - shipping cartons (14 digits) · What to encode: 0012345678901 · Narrow bar width: 3 px

ITF-14 barcode

00123456789012

135 modules of bars, 10 + 10 modules of quiet zone, 475 x 103 px at 3 px per module.

Modules: 135 · Bars: 39 · Check: 2 · Printed size: 475 x 103 px

Thirteen digits plus the check digit make a GTIN-14, drawn at three pixels per module because a carton label is read from further away than a shelf label.

An asset tag: Code 39

Barcode type: Code 39 - asset tags, A-Z 0-9 and - . $ / + % · What to encode: DANFIO-001 · Bar height: 80 px

Code 39 barcode

*DANFIO-001*

155 modules of bars, 10 + 10 modules of quiet zone, 350 x 102 px at 2 px per module.

Modules: 155 · Bars: 60 · Check: none · Printed size: 350 x 102 px

Code 39 has no check digit and no lower case, so anything typed in lower case is upper-cased and the page says so rather than changing the data silently.

A mixed label: Code 128 in the shortest code set

Barcode type: Code 128 - anything printable, packed tightest · What to encode: ORDER-2026-0915

Code 128 barcode

ORDER-2026-0915

189 modules of bars, 10 + 10 modules of quiet zone, 418 x 82 px at 2 px per module.

Modules: 189 · Bars: 52 · Check: 39 · Printed size: 418 x 82 px

The two runs of digits are packed two per symbol in code set C and the rest goes through code set B, because a switch symbol only pays for itself when there are enough digits to save a symbol.

Frequently asked questions

How do I get a barcode number for my product?

The number comes from GS1, not from a generator: a company prefix is allocated with a membership, and the digits after it are yours to assign. The check digit at the end is arithmetic, not a license - a code made up here can be perfectly valid arithmetic and still mean nothing to any shop, because no database contains it. Use this page to encode a prefix you already hold, or an internal code for boxes and shelves in your own building.

Which symbology should I use?

Retail products: EAN-13 everywhere except the US and Canada, where it is UPC-A, and EAN-8 only when the package is tiny. Shipping cartons: ITF-14 with bearer bars. Asset tags, badges and anything an ordinary reader has to handle without a database: Code 39. Everything else - internal labels, order numbers, text mixed with digits, anything where width matters: Code 128.

Will the barcode actually scan?

Point a phone at the screen before you print: the code is drawn from the same arithmetic either way, so if the screen reads, the print will. Three things break a printed barcode: printing it too small (GS1 gives retail symbols a nominal module width of 0.33 mm, and shrinking far below that is what fails at the till), stretching it sideways in a word processor instead of scaling it, and printing on something glossy that throws the scanner's own light back at it.

Why did the tool add a digit to my number, or refuse one?

EAN, UPC, GTIN and ITF numbers all end in a check digit: alternating weights of 3 and 1 from the right of the payload, with the check digit taking the total to a multiple of ten. Type the payload without it and it is added. Type a full number whose last digit does not match that arithmetic and the page says which digit it should have been - a mismatch almost always means a digit earlier in the number is wrong, so quietly "fixing" it would hide the real problem.

Can I make a QR code here?

No. QR is a 2D matrix code: data in a grid, with Reed-Solomon error correction - a completely different piece of arithmetic from the bar-width tables used here, and a separate tool when it ships. If the scanner on the other end can read Code 128, that is the best 1D answer for a URL or an order number.

Can I put batch numbers and dates on a shipping label?

Not with an application identifier. GS1-128 is Code 128 plus FNC1 separators that tell the scanner "the next digits are a batch number" - that is what makes the label machine-readable. This page generates Code 128 without FNC codes, so the barcode carries exactly the text you typed and nothing more. ITF-14 is right for a carton's GTIN on its own; a full GS1-128 label needs a tool built for it.

Can I use a code from here on a product I sell?

For retail, the number itself must come from your GS1 membership - a prefix this page does not provide - and the printed code has to survive the surface and size a till will actually scan, which is a print job rather than something a generator can vouch for. The barcode carries exactly the text you type; this site does not review, approve or warrant the data you encode, and nothing here is legal or compliance advice.

Is anything uploaded, and is there a watermark?

Nothing leaves the browser. There is no upload step in the code, the encoding and drawing are plain arithmetic in the tab, and both downloads are created as blobs in your own browser. The SVG carries a title and a description naming the symbology and the code, which is metadata for whoever opens the file rather than anything drawn on the symbol.

Why does the PNG have no digits under the bars?

Because the PNG export here has no font. The human readable line is drawn as real text in the SVG - the file to use when the digits matter, for print or for a label - while the PNG holds the bars, any frame and the quiet zones at an exact pixel size, which is what an older printer or a spreadsheet wants. Both are the same symbol either way.

Why can I not choose a color or a transparent background?

Because contrast is the whole mechanism. A scanner sees black bars against white space, so inverted (white on black), colored or transparent barcodes are a common reason a code will not read - and a transparent quiet zone on a dark page is worse than none at all. Black on white is not a limitation of this page, it is what the formats expect.

Assumptions and sources

  • Each symbology follows its published standard: EAN-13, UPC-A and EAN-8 under ISO/IEC 15420, ITF-14 under ISO/IEC 16390, Code 39 under ISO/IEC 16388 and Code 128 under ISO/IEC 15417.
  • Check digits and quiet zones are part of every symbol and are never cropped; 2D codes, GS1 application identifiers and postal symbologies are not offered.
  • Encoding and drawing happen in your browser; nothing you type is uploaded.

Last reviewed 2026-09-15. Runs locally on your device; keep backups; no financial advice applies. Read the full disclaimer.

Where a figure on this page comes from an official agency — HUD, IRS, FICO or a state body — the site keeps a dated snapshot of the source page in its sources library, and a scheduled job re-checks that snapshot, so the number can be traced back to the document it came from.