Pular para o conteúdo principal

Gerar código de barras

Barcode Generator encodes a value as Code 128, EAN-13, EAN-8, UPC-A, Code 39 or ITF-14 and gives you an SVG or PNG. The encoders — check digits, Code 128's set switching, EAN's parity encoding of the thirteenth digit — all run in your browser, and the output carries the quiet zones and guard bars the standards require, which is what decides whether a scanner reads it.

Só local

A interface desta ferramenta está em inglês.

Symbology

Shipping labels, asset tags, GS1-128 logistics — the general-purpose choice.

Type a value or click Try Example to encode.

O guia abaixo está disponível apenas em inglês.

How does Barcode Generator work?

A barcode is a number written in the width of bars and spaces, and the encoding is specific to the symbology. The tool picks the right one for what you are making and refuses the combinations that cannot work — you cannot put letters in an EAN, and it says so rather than silently dropping them.

Code 128, and why it is the default

Code 128 encodes the whole of ASCII in three overlapping character sets, and switching between them mid-symbol is part of the encoding. Set C is the reason it is so efficient for numbers: it packs two digits into one symbol character, so a 20-digit value takes 10 characters instead of 20. This encoder switches into set C when a run of digits makes it worthwhile — six at the start of the value, four in the middle — which is the trade-off point where the switch character pays for itself.

The thirteenth digit of an EAN-13 is not a bar

EAN-13 has 95 modules and they encode twelve digits, not thirteen. The first digit is carried by the *parity pattern* of the six on the left: each of them is encoded as either odd or even parity, and which of the six possible patterns appears is what spells the leading digit. It is a genuinely clever piece of 1970s design — it made EAN-13 a superset of the existing 12-digit UPC-A without changing the width of the symbol — and it is the part a hand-rolled encoder almost always gets wrong.

Check digits

EAN, UPC and ITF-14 all use the same modulo-10 scheme: weight the digits alternately by 3 and 1, sum them, and the check digit is whatever brings the total to a multiple of ten. Type the twelve digits of an EAN-13 and the thirteenth is calculated and shown — if you already have it, the tool checks yours rather than replacing it, and tells you if it does not match. Code 128 has its own weighted checksum which is part of the symbol and never printed.

Quiet zones are not margin

The blank space either side of the bars is part of the symbol, and it is the most frequently destroyed part of it. A scanner uses it to find where the code begins; with a logo or a fold or a box edge inside it, read rates fall off sharply. The standards set it per symbology — 11 modules for EAN-13, 10 for Code 128 — and it is included in everything downloaded here, which is exactly why the file has “too much white space” around it. Do not crop it.

Why the output is SVG by default

Because a barcode is printed far more often than it is displayed, and a raster image at the wrong resolution is the other common reason a symbol fails. The bars land on fractional device pixels, the printer smears the edges, and the widths the scanner measures are no longer the widths you encoded. Vector output has no resolution to get wrong, and the downloaded SVG is sized in millimetres so a print pipeline reproduces it at the module width you chose.

A value and a symbology

EAN-13
590123412345

A scannable symbol

5901234123457
             ↑ check digit

quiet zone   11 modules each side
modules      95
width        30.1mm at X = 0.264mm

What options and edge cases does Barcode Generator support?

Symbologies, and what each is for
ParameterTypeDefaultBehaviour & edge cases
Code 128Any ASCII text, any length10 modulesShipping labels, asset tags, GS1-128 logistics — the general-purpose choice
EAN-1312 digits (the 13th is calculated)11 modulesRetail products outside North America
EAN-87 digits (the 8th is calculated)7 modulesSmall retail packages with no room for a full EAN-13
UPC-A11 digits (the 12th is calculated)9 modulesRetail products in the United States and Canada
Code 39A–Z, 0–9, space and - . $ / + %10 modulesDefence, automotive and health logistics; older scanners read nothing else
ITF-1413 digits (the 14th is calculated)10 modulesOuter cases and pallets — printed on corrugated board, where fine bars fail
Module width (X)mm0.33The width of the narrowest bar, and the number that sets everything else. Minimums: 0.264mm for retail EAN and UPC, 0.495mm for ITF-14 on corrugated board.
Quiet zonemodulesincludedBlank space that is part of the symbol rather than margin around it. Cropping it is the most common reason a printed code stops scanning.

Frequently asked questions

Which barcode type should I use?

Code 128 for anything internal — shipping labels, asset tags, warehouse locations — because it takes any ASCII text at any length and packs digits two to a character. EAN-13 for a retail product sold outside North America, UPC-A inside it, and both require a GS1 company prefix you have to buy; you cannot invent the number. ITF-14 for the outer case or pallet. Code 39 only when the scanner or the industry demands it: it is bulky and encodes a restricted character set, but very old readers handle nothing else.

Can I make my own EAN-13 for a product I sell?

You can generate a valid symbol here, but the number itself has to be allocated. An EAN-13 begins with a GS1 company prefix issued to your business, and retailers verify it against the GS1 registry — a made-up number will encode and scan and then fail at the point it matters. For internal stock control where nothing leaves your own system, Code 128 with your own scheme is the honest answer and costs nothing.

How is the check digit calculated?

For EAN, UPC and ITF-14 it is modulo 10: take the digits, weight them alternately by 3 and 1 from the right, add them up, and the check digit is the amount that brings the total up to the next multiple of ten. Type the twelve digits of an EAN-13 here and the thirteenth appears; paste all thirteen and this tool verifies yours instead of overwriting it. Code 128 has a different, weighted checksum that is encoded into the symbol and never printed underneath.

Why does my printed barcode not scan?

Three causes, in order of frequency. The quiet zone has been cropped or something has been placed inside it — that blank space is part of the symbol. The module width is below the minimum, so ink spread closes the spaces; retail EAN and UPC need 0.264mm and ITF-14 on corrugated board needs 0.495mm. Or it was printed from a low-resolution raster image, where the bar edges do not land on whole pixels. Download the SVG, keep the white space, and check the width in millimetres shown on this page.

Can a barcode hold a URL or a phone number?

Code 128 can hold any ASCII text, so a URL will encode — but a linear barcode is a poor carrier for one. It gets very wide very quickly, and the scanners that read a URL usefully are phone cameras, which read QR codes far better than they read 1D symbols. If the target is a phone, use the QR code generator on this site instead. Use a barcode when a dedicated scanner is reading it.

Is anything uploaded when I generate a barcode?

No. The encoders run in this tab, and the SVG and PNG are produced here too. That matters more than it sounds for this tool in particular: the values people encode are order numbers, serial numbers and internal asset tags, and sending those to a stranger's server to have some rectangles drawn is a poor trade. The site's Content-Security-Policy sets connect-src 'self', so the browser would block an upload even if something tried.