What is a barcode?
A barcode is a machine-readable representation of data, encoded as a pattern of parallel bars and spaces of varying width. The pattern is not a picture of the number — it is a defined sequence of light and dark elements that a scanner measures as it sweeps a beam across the symbol, converting the reflected light into a stream of widths and then decoding those widths back into characters using the rules of a particular symbology.
That word matters. "Barcode" is a category, not a format. EAN-13, CODE 128 and ITF-14 are all barcodes, but they encode different data, in different alphabets, at different densities, with different error checking. Choosing the wrong one is the most common reason a barcode workflow fails — not because the image is bad, but because the receiving system was expecting a different symbology entirely.
Nearly all traditional barcodes carry an identifier rather than the information itself. The barcode on a tin of soup does not encode "tomato soup, 400g, £1.20" — it encodes a 13-digit number that the retailer's database maps to those details. This is why the same physical product can change price without the label changing, and why a barcode is only ever as useful as the system behind it.
What is a barcode generator?
A barcode generator takes a value, applies the encoding rules of a chosen symbology, and renders the resulting pattern as an image. Three distinct things happen: validation, which confirms the value is representable in that symbology at all; encoding, which converts characters into the specific bar and space widths the standard defines, including any check digits; and rendering, which draws that pattern at a physical size with a quiet zone and, usually, a human-readable line beneath.
What a generator does not do is invent or register the number. This distinction trips up a lot of small businesses. A generator will happily encode any twelve digits into a perfectly valid, perfectly scannable UPC-A — but if those digits are not allocated to your company from a GS1 prefix, no retailer will accept the product, and the number may already belong to someone else. Encoding is a rendering problem; number allocation is a licensing one. This tool solves the first.
How to create a barcode online
- Choose the symbology first. Not the size, not the colours — the format, because it determines what data is even legal. If you are labelling for your own systems, CODE 128. If you are printing a retail product barcode, EAN-13 or UPC-A. If you are labelling a shipping carton, ITF-14.
- Enter your data. The tool validates it as you type against the character set and length rules of the selected format, and tells you specifically what is wrong rather than just refusing.
- Let the check digit calculate. For EAN, UPC and ITF-14, enter the payload without the final digit and it is computed for you. Paste a complete code and it is verified instead — a mismatch is reported with the digit it should have been.
- Set the size. Bar width and height matter more than anything cosmetic. If you have a specific label to fill, work backwards from its physical dimensions and the printer's resolution.
- Check the warnings. The scannability panel flags contrast, quiet zone, bar width and height problems before you commit them to a print run.
- Download. SVG for anything going to print or into label software; PNG at a print resolution preset for documents and screens.
How barcode generators work under the hood
Every 1D symbology reduces to the same pipeline. First the input is mapped to a sequence of symbol values — in CODE 128, for example, each character becomes a number from 0 to 105, with the mapping depending on which of three character subsets is currently active. Then a check character is computed across those values, usually a weighted modular sum. Then each value is looked up in a pattern table that gives the widths of its six or nine elements. Concatenating those patterns produces a string of modules — the narrowest unit of width in the symbol — where each module is either dark or light.
Only at the final step does anything become visual. The module string is multiplied by a chosen module width in pixels, runs of consecutive dark modules become rectangles, guard bars are extended downwards where the symbology calls for it, and text is placed underneath. This is why a well-built generator can output vector and raster from the same computation and have them agree exactly: the geometry is decided before either renderer runs.
This tool works that way deliberately. The encoders are pure functions with no knowledge of pixels, the layout step turns modules into geometry, and the SVG and canvas renderers both consume that same geometry. The consequence for you is that the preview on screen is not an approximation of the download — it is the download, rendered by the same code path.
CODE 128 explained
CODE 128 is the most capable of the linear symbologies still in general use, and the right default for anything that is not constrained by an external standard. It encodes all 128 ASCII characters through three interchangeable subsets: A covers control characters and uppercase, B covers uppercase and lowercase, and C encodes pairs of digits as a single symbol character. That last point is what makes it so compact — a 12-digit number occupies six symbol characters in subset C rather than twelve.
A well-implemented encoder switches between subsets automatically to minimise length, starting in C when the value opens with a run of digits, dropping to B for text, and using a one-character SHIFT rather than a full switch when a single out-of-subset character appears. Every CODE 128 symbol also carries a modulo 103 check character which is never printed in the human-readable line, so the text under the bars always matches exactly what you typed.
Use CODE 128 for shipping labels, warehouse locations, internal SKUs, asset tags, work orders and anything else where you control both the printing and the scanning. It is also the carrier for GS1-128, the standard used for logistics data like batch numbers and expiry dates.
CODE 39 explained
CODE 39 is the oldest alphanumeric symbology in widespread use, and its longevity is entirely down to compatibility. Every character is nine elements wide with exactly three of them wide, which makes it self-checking and extremely tolerant of poor print quality — at the cost of density. A CODE 39 barcode is roughly twice the width of the equivalent CODE 128.
Its character set is uppercase letters, digits, space, and the six symbols - . $ / + %. Lowercase is simply not representable, which is why this tool converts it automatically rather than rejecting it. Every symbol is wrapped in an asterisk start/stop character, which is why the human-readable line reads *VALUE*. A modulo 43 check character is optional and worth enabling when print quality is uncertain.
Choose CODE 39 when a standard or a piece of legacy equipment specifies it — US defence LOGMARS, automotive AIAG labelling, some healthcare and library systems. If nothing is forcing your hand, CODE 128 does the same job in half the space.
CODE 93 explained
CODE 93 was designed as a direct replacement for CODE 39: the same character set, about 25% narrower, and two mandatory check characters instead of one optional one. Each character is nine modules wide across six elements, and the symbol ends with an extra termination bar.
The two check characters, conventionally called C and K, are weighted modulo 47 sums — C over the data, K over the data plus C. Two independent checks make an undetected misread extremely unlikely, which is why CODE 93 turns up in postal and logistics applications where a wrong read is expensive. It is less widely supported by older scanners than CODE 39, so confirm your hardware reads it before standardising on it.
EAN-13 explained
EAN-13 is the barcode on almost every retail product sold outside North America, and it is worth understanding its structure because it explains several things that otherwise look arbitrary. Thirteen digits: a GS1 prefix identifying the numbering organisation, a company prefix licensed to the manufacturer, an item reference chosen by that manufacturer, and a final modulo 10 check digit.
The clever part is that only twelve digits are actually drawn as bars. The symbol has six digits on the left of the centre guard and six on the right, and the thirteenth — the first digit of the number — is encoded in the parity pattern of the left-hand six. Each left digit can be drawn in odd (L) or even (G) parity, and which of the ten defined L/G sequences is used tells the scanner what the leading digit is. That is why the first digit is printed to the left of the symbol rather than underneath it: there are no bars beneath it to sit under.
This is also why an EAN-13 can be read upside down. The left-hand parity patterns and the right-hand patterns are structurally distinguishable, so a decoder can tell which end it started from and reverse the result. The check digit uses weights of 3 and 1 alternating from the right; if you enter twelve digits here, that is the arithmetic being applied.
EAN-8 explained
EAN-8 exists for one reason: some packaging is too small to carry a full EAN-13 at a legible size. Eight digits — a GS1 prefix, a short item reference and a check digit — drawn as four digits either side of the centre guard, all in fixed parity, with no hidden thirteenth digit.
Because the number space is so much smaller, EAN-8 codes are allocated individually by GS1 member organisations rather than from a company prefix you control. Use it only where an EAN-13 genuinely will not fit at the minimum permitted size, since a shrunken EAN-13 scans better than most people expect.
UPC-A explained
UPC-A is the twelve-digit retail barcode used in the United States and Canada, and predates EAN by several years. Structurally it is an EAN-13 whose leading digit is zero, which is exactly how modern scanners treat it — the parity pattern for a leading zero is all-odd, which is precisely what a UPC-A uses for its left-hand digits.
The layout is slightly different from EAN-13 in one visible way: the first and last digits are printed outside the symbol at guard-bar height, and the middle five digits of each half sit under the bars. This tool follows that convention, because retail staff and equipment both expect it.
UPC-E explained
UPC-E compresses a UPC-A that contains runs of zeros into six data digits, taking roughly half the width. The compression is not arbitrary: the last of the six digits selects which of five expansion rules the scanner applies to reconstruct the full twelve-digit UPC-A. A trailing 0, 1 or 2 means the digit is inserted as the third character of the company prefix with four zeros following; a 3 means the prefix is three digits with five zeros; a 4 means four digits with five zeros; and 5 through 9 mean five prefix digits, four zeros, and the trailing digit as the item reference.
The check digit is computed from the expanded UPC-A, not from the six compressed digits — a detail that catches out a lot of implementations. Parity encoding is used again here, this time to carry the check digit: the six digits are drawn in one of ten L/G patterns selected by the check digit, and inverted if the number system digit is 1. This tool shows you the expansion when it validates, so you can confirm which UPC-A you are actually representing.
ITF and ITF-14 explained
Interleaved 2 of 5 gets its density from a genuinely elegant trick: digits are encoded in pairs, with the first digit's five-element pattern drawn as bars and the second digit's drawn as the spaces between them. Two digits therefore occupy the space of one character. The consequence is that ITF can only encode an even number of digits — an odd count cannot be interleaved, which is why a leading zero is often padded on.
ITF-14 is the GS1 application of this for shipping containers: exactly fourteen digits carrying a GTIN-14, which identifies a trade unit such as a case of twelve retail items. Two features make it robust enough to print directly onto corrugated cardboard. Wide bars are 2.25 to 3 times the narrow width, giving generous tolerance for ink spread; and the symbol is enclosed in bearer bars, a heavy frame whose purpose is to prevent a partial scan. Without it, a beam clipping the top or bottom of the symbol could read a shorter sequence of digit pairs as a complete, valid — and wrong — code. The frame makes that misread impossible.
Codabar, MSI and Pharmacode
Codabar encodes digits and six symbols, wrapped in one of four start/stop characters A, B, C or D. Those four characters can carry meaning in some applications — blood banking uses them to distinguish record types. It is self-checking by construction and remains standard in libraries, blood banks, photo processing and air waybills.
MSI, sometimes called Modified Plessey, is a numeric-only symbology where each digit becomes four bits and each bit becomes a wide or narrow bar. It is very low density and offers no check digit by default, so enable the optional modulo 10 if you use it. Its remaining niche is shelf-edge and warehouse racking labels.
Pharmacode is unlike everything else here. It does not encode characters at all — it encodes a single integer between 3 and 131070 as a binary sequence of thin and thick bars, read right to left. There is no check digit and no human-readable text, because it is not meant for humans: it is a packaging line control code, verified by a camera at high speed, and its deliberately restricted design makes it near-impossible to misread. Its robustness to printing variation is why it survives on pharmaceutical cartons and leaflets.
Barcode check digits and checksums
A check digit is a character computed from the others so that a single-character misread produces an arithmetically impossible code, which the scanner rejects rather than passing on. Different symbologies use different schemes, and knowing which applies to yours explains most "invalid barcode" messages.
- Mod 10 (GS1) — used by EAN-8, EAN-13, UPC-A, UPC-E and ITF-14. Multiply digits by 3 and 1 alternating from the right, sum, and the check digit is whatever makes the total a multiple of 10.
- Mod 10 (Luhn variant) — used optionally by ITF and MSI. Double every second digit from the right, subtracting 9 from any result above 9, then sum.
- Mod 43 — CODE 39's optional check character. Sum the character values and take the remainder modulo 43.
- Mod 47, twice — CODE 93's mandatory C and K characters, weighted sums with the weight cycling 1 to 20 and 1 to 15 respectively.
- Mod 103 — CODE 128's mandatory check character, a weighted sum over the symbol values including the start character. It is always present and never printed.
The practical rule: if you hold a complete code, paste it and let the tool verify the check digit. If you hold the payload, enter that and let the tool calculate. Never type a check digit you guessed — a barcode with a wrong check digit will encode and print perfectly and then fail at every scanner it meets.
Barcode vs QR code
A traditional barcode is one-dimensional: information lives entirely in the widths of vertical bars, read along a single axis. A QR code is two-dimensional, storing data across a square matrix of modules, which gives it vastly more capacity — thousands of characters against a linear barcode's dozens.
That difference drives everything else. Linear barcodes carry short identifiers that a database resolves, which is exactly what retail and logistics need: the code is small, prints on anything, and scans instantly with cheap laser hardware. QR codes carry the payload itself — a URL, Wi-Fi credentials, a vCard, a payment string — and are read by phone cameras at any rotation, with error correction that tolerates a damaged or partially covered symbol.
Neither replaces the other. A supermarket will not put a QR code on a tin of beans, because a laser scanner reads an EAN-13 faster and more cheaply than any camera reads a matrix. A restaurant will not put a CODE 128 on a table, because customers cannot scan one with a phone and it could not hold a URL anyway. Pick by what has to read it: dedicated scanning hardware and a short identifier means a linear barcode; a phone camera and self-contained data means QR. If QR is what you need, ToolAdda has a QR Code Generator and a Custom QR Code Maker.
1D vs 2D barcodes
Beyond QR, the 2D family includes Data Matrix, widely used for marking small electronic components and surgical instruments; PDF417, the stacked format on driving licences and boarding passes; and Aztec, common on rail tickets because it needs no quiet zone. All of them trade cheap linear scanning for capacity and damage tolerance.
1D symbologies remain dominant wherever the data is a short key and the scanning volume is high. They are cheaper to print, cheaper to scan, and far more forgiving of the low-resolution thermal printing that logistics runs on. This tool focuses on 1D deliberately — doing twelve linear symbologies accurately is more useful than doing many families adequately.
How to make a printable barcode
Print quality decides whether a barcode works, and almost every failure traces to the same handful of causes.
Start from vector. Download SVG and place it in your label or layout software. Vector output means the printer's own resolution decides the bar edges, rather than an upscaled bitmap. If your workflow demands raster, use the high-resolution preset — it renders at four times the on-screen geometry rather than enlarging a small image.
Print at actual size. Scaling in the print dialog reintroduces exactly the softness that vector output avoided. Set the physical size in your design tool and print at 100%.
Respect the narrow bar minimum. Below about 0.25 mm, ordinary printing tolerances start to matter more than the design. On thermal transfer at 203 DPI the practical minimum is closer to 0.33 mm, since one printer dot is about 0.125 mm and a narrow bar needs at least two or three of them.
Account for ink spread. Absorbent stock and inkjet printing thicken bars and narrow spaces, shifting every measured width in the same direction. Professional workflows compensate with bar width reduction; if you are printing on plain paper, simply keeping the bars generously wide has the same effect.
Keep the quiet zone inside the label. A barcode that runs to the edge of a die-cut label has no quiet zone on that side, whatever the artwork says.
Then test. Print one, scan it with the hardware that will actually be used, and only then commit to a run.
How to create a barcode for inventory
Internal inventory barcodes are the easiest case, because nothing external constrains you. Use CODE 128, and design a numbering scheme before you print anything.
Good internal schemes share a few properties. They are unique across the whole system, not just within a category. They are fixed length where possible, which makes validation trivial and stops a truncated scan looking valid. They avoid characters that are easy to confuse when someone has to read one aloud or type it in — 0 and O, 1 and I. And they encode a little structure, so that a human glancing at a label can tell what they are holding: WH2-A14-003921 tells you warehouse 2, aisle A14, item 3921 without a lookup.
The Batch tab exists exactly for this. Export your item list to CSV, import it, generate every barcode at once, and download a ZIP with an SVG and a PNG per item ready to drop into a label template.
How to create product barcodes
Retail is the one case where the number matters more than the image. To sell through mainstream retail you need a GTIN — a globally unique number allocated from a GS1 company prefix licensed to your business. You license the prefix, assign item references within it, and calculate the check digit. Only then do you generate the barcode.
Using an arbitrary number, or one from a "cheap barcode" reseller of prefixes originally issued to a defunct company, causes real problems: retailers verify GTINs against the GS1 registry, and a number that resolves to someone else's business will be rejected at onboarding. This tool will encode any twelve or thirteen digits you give it into a technically perfect EAN-13 — it simply cannot make those digits yours.
Once you do hold a GTIN, the rest is straightforward. Enter it here, keep the symbol at or near the nominal size (about 37 mm by 26 mm for a full EAN-13), print black on white with the quiet zones intact, and place it somewhere flat on the packaging.
PNG vs SVG vs JPG for barcodes
SVG is the correct default. It describes the barcode as geometry — one rectangle per bar — so it prints at whatever resolution the output device supports, scales without any loss, and can be recoloured or repositioned in a design tool. It is also small, and opens cleanly in Illustrator, Inkscape, Figma and most label software.
PNG is the right raster choice. It is lossless, so bar edges stay hard, and it goes anywhere an image is accepted — documents, spreadsheets, web pages, e-commerce listings. Choose the resolution before exporting rather than resizing afterwards.
JPG is the wrong format for barcodes and is offered only because some systems accept nothing else. JPEG compression works by discarding high-frequency detail, and a barcode is nothing but high-frequency detail — hard black-to-white transitions. The result is ringing artefacts along exactly the edges the scanner measures. If you must use JPG, generate at high resolution so the artefacts are small relative to the bars. If you have any choice at all, use PNG.
Working the other way — converting a barcode image into another format — the SVG to PNG converter handles it, and the image compressor can shrink a batch of PNG labels without touching their dimensions.
Common barcode generation problems
"EAN-13 requires 12 or 13 digits." You have entered the wrong number of digits, often because a leading zero was dropped by a spreadsheet. Format the column as text before exporting, or add the zero back manually.
"The check digit is wrong." The last digit does not match the arithmetic. Either enter the payload without it and let it be calculated, or correct it to the value shown in the error message.
"This value contains characters CODE 39 does not support." CODE 39 has no lowercase and only six symbols. Either switch to CODE 128 or restrict your scheme to the supported set.
"ITF needs an even number of digits." Interleaving works in pairs. Pad with a leading zero or enable the check digit, which adds one.
The barcode generates but nothing scans it. Almost always physical: quiet zone clipped, bars too narrow for the printer, contrast too low, or the image scaled up after export. Work through the scannability guide above.
The scanner reads a different number than expected. Check for a symbology mismatch — a UPC-A read by a scanner configured to expand to EAN-13 returns a leading zero, and a UPC-E returns its expanded UPC-A rather than the six digits you typed. Both are correct behaviour, not a fault.
Privacy and how this tool handles your data
Everything on this page runs in your browser. The encoder, the geometry, the SVG and canvas renderers and the ZIP builder are all JavaScript already loaded on the page, and generating a barcode makes no network request of any kind. There is no upload step because there is no server involved in generation at all.
That matters more here than on most tools, because of what people put in the field: internal SKUs, serial numbers, customer references, unreleased product codes, asset tags. None of it leaves your device. The page stores only interface preferences — your chosen symbology, sizes and colours — in local storage; the barcode data itself is never saved, so nothing lingers after you close the tab.