Free Barcode Size Calculator

A linear barcode’s width is not a design choice — it falls out of the symbology, your data and the width of the narrowest bar. Enter those three and this page gives you the printed width to the hundredth of a millimetre, quiet zones included, and tells you whether it fits the space you have.

Nothing you type leaves your device. The geometry is plain arithmetic running in your own browser. Your data is measured, never uploaded — which matters when you are sizing labels for part numbers or batch codes that are not public yet.

Type the exact value you will encode. For the retail formats the width is fixed, so this is only checked for length.

The space on the label or artwork. Fill it in and the result says whether the symbol fits and how small the bars would have to go.

How the calculation works

A linear barcode is a grammar of narrow and wide elements. Count the elements and you know the symbol's width in multiples of X, the width of the narrowest bar. Multiply by the X-dimension you will actually print at, add the quiet zones, and that is the number your label has to accommodate. There is no estimation anywhere in it.

Code 128 and GS1-128

The width is [11 × (C + 2) + 2] × X plus a quiet zone each side, where C is the number of symbol characters including the mod-103 check character. Each symbol character is 11 modules; the stop pattern is 13, which is the stray + 2.

Finding C is the interesting part, and it is where other calculators give up. Code 128 has three code sets, and set C encodes two digits per symbol character while sets A and B encode one character each. Switching sets costs a symbol character of its own, so the cheapest encoding is not always the obvious one. This page searches every combination rather than applying the usual "switch to set C on four or more digits" rule of thumb, so the character count is the true minimum a good label printer would produce. GS1-128 adds one character for the FNC1 that follows the start pattern.

Code 39

(C + 2) × (3N + 6) × X + (C + 1) × X, where C is your character count, the + 2 is the start and stop, N is the wide-to-narrow ratio, and the second term is the narrow gap between characters. Every Code 39 character is nine elements — three wide and six narrow — which is why it is the widest of the common symbologies per character encoded.

ITF and ITF-14

Digits are encoded in interleaved pairs: ten elements per pair, four wide and six narrow. Add four narrow elements for the start pattern and one wide plus two narrow for the stop, and 14 digits come to exactly 48 narrow and 29 wide — which is the 48X + 29X × ratio formula GS1 publishes for ITF-14, arrived at from first principles. Because digits go in pairs, an odd-length number is padded with a leading zero.

EAN-13, UPC-A, EAN-8 and UPC-E

These are fixed-width: the module count never changes, so the only lever is the X-dimension, usually expressed as a magnification percentage against a nominal X of 0.330 mm. The quiet zones are asymmetric and differ between the four — a detail most sizing guides flatten into a single "10X each side" that does not reconcile with GS1's own published widths. These do:

Symbology Modules Quiet zones Bars only Total at 100% Height
EAN-13 95X 11X + 7X 31.35 mm 37.29 mm 22.85 mm
UPC-A 95X 9X + 9X 31.35 mm 37.29 mm 22.85 mm
EAN-8 67X 7X + 7X 22.11 mm 26.73 mm 18.23 mm
UPC-E 51X 9X + 7X 16.83 mm 22.11 mm 22.85 mm

Every figure in that table is computed by the same code that runs the calculator, at the nominal X-dimension of 0.330 mm. They match the nominal symbol dimensions GS1 publishes exactly, which is the check that the module counts above are right.

Quiet zones

The blank margin either side is part of the symbol, not packaging around it. Code 128, Code 39 and ITF ask for the greater of 10X or 2.54 mm, so at small X-dimensions the fixed 2.54 mm floor is what binds — a detail that quietly adds several millimetres to a dense label and is the most common reason a symbol that measured fine in artwork fails on press.

Height

For the variable-length symbologies the general rule is 5 mm or 15% of the symbol length, whichever is greater — tall enough that a scanner sweeping at an angle still crosses every bar. EAN/UPC and ITF-14 have their own fixed heights instead, which scale with magnification.

Twelve characters, four widths

Each row below is exactly twelve characters in Code 128 at an X-dimension of 0.254 mm. The widths differ by more than 50% because code set C packs two digits into one symbol character and each set switch costs one. This is why "how many characters" is not enough information to size a Code 128 label.

Data Symbol chars Modules Total width Why
123456789012 6 101X 30.73 mm All digits — one run of code set C
AB1234567890 8 123X 36.32 mm Two letters, then a long numeric run
1234ABCD5678 10 145X 41.91 mm Letters in the middle — two set switches
ABCDEFGHIJKL 12 167X 47.50 mm All letters — set C never applies

When you need this

The barcode is wider than the label

Put your label width in and the calculator gives the largest X-dimension that still fits, then tells you whether that X is below the symbology's floor. If it is, no amount of shrinking will help and the data has to get shorter.

Choosing between symbologies

Run the same value through Code 128 and Code 39. A 17-character VIN is 55.88 mm in Code 128 and 74.80 mm in Code 39 at 0.254 mm — the same information, a third more label.

Checking artwork before plates are cut

Retail barcodes are specified as a magnification of a nominal size. Enter the X-dimension from the artwork and the result reports the magnification, flagging anything outside the 80%–200% that point-of-sale scanning allows.

Specifying a label stock

Work backwards: pick the X-dimension your printer can hold, read off the width, and order label stock that leaves room for the quiet zones rather than discovering the problem on the first roll.

Related tools and guides

Frequently Asked Questions

What is the X-dimension of a barcode?

It is the width of the narrowest bar or space in the symbol, and it is the unit everything else is measured in. A symbology fixes how many of those narrow widths — "modules" — its bars, spaces and quiet zones span, so once you choose an X-dimension the printed width is arithmetic. It is also the number your printer has to be able to hold: a 203 dpi thermal printer lays down roughly 0.125 mm per dot, so an X-dimension of 0.254 mm is two dots and anything finer starts rounding unpredictably.

How do I make a barcode narrower?

In order of how much they help and how little they cost: shorten the data, because width scales directly with it; reduce the X-dimension, down to the symbology’s floor and no further; switch to a denser symbology, since Code 128 is typically a third narrower than Code 39 for the same value; for Code 39 and ITF, reduce the wide-to-narrow ratio towards 2.0; and only then consider a 2D symbol such as Data Matrix, which holds the same data in a fraction of the footprint but needs an imaging scanner rather than a laser.

Why is my Code 128 barcode wider than another one with the same number of characters?

Because Code 128 has three code sets and set C encodes two digits in a single symbol character, while sets A and B encode one character each. Twelve digits therefore cost six symbol characters, but twelve letters cost twelve. Switching between sets costs a symbol character of its own, so letters scattered through a number are the worst case: the same twelve-character field can vary by more than 50% in width depending on what is in it. The calculator above shows the set-by-set breakdown so you can see where the characters went.

What is the smallest a barcode can be printed?

It depends on the symbology and on who is scanning it. The AIM Uniform Symbology Specifications set 0.0075 inch (0.191 mm) as the minimum standard X-dimension for Code 128 and Code 39. GS1 asks for 0.495 mm as the floor for GS1-128 and ITF-14 in general distribution, where codes are read by fixed scanners on a conveyor. The EAN/UPC family is specified as a magnification instead, from 80% to 200% of a 0.330 mm nominal, which puts its floor at 0.264 mm. Print below the relevant floor and the symbol may still scan on your desk and fail in the environment it was made for.

Does the quiet zone count towards the width?

Yes, and leaving it out is the most common sizing mistake. The blank margin either side is part of the symbol — a scanner uses it to find where the bars begin. Code 128, Code 39 and ITF ask for the greater of 10 times the X-dimension or 2.54 mm, so at small X-dimensions the fixed 2.54 mm takes over and adds a little over 5 mm to the total on its own. EAN and UPC specify theirs asymmetrically: EAN-13 wants 11 modules on the left and 7 on the right, while UPC-A wants 9 on both.

How tall does a barcode need to be?

For the variable-length symbologies the general rule is 5 mm or 15% of the symbol length, whichever is greater. The reason is aiming rather than data: a scanner sweeping across the label at a slight angle has to cross every bar in one pass, and a short wide symbol makes that hard. EAN, UPC and ITF-14 have fixed heights of their own instead — 22.85 mm for EAN-13 at 100% magnification, 32 mm for ITF-14 in automated distribution — and truncating them to fit artwork is a common cause of codes that scan at the desk and fail at the till.

Why do different sites give different widths for the same EAN-13?

Usually because they flatten the quiet zones into a single "10 modules each side" for every symbology. That is a reasonable average and it is wrong for EAN and UPC. The check is easy: EAN-13 is 95 modules of bars and spaces, and GS1 publishes its nominal width as 37.29 mm at an X-dimension of 0.330 mm. 95 + 11 + 7 = 113 modules, and 113 × 0.330 = 37.29. With 10 and 10 you get 115 modules and 37.95 mm, which matches nothing GS1 publishes. The same arithmetic reconciles exactly for UPC-A, EAN-8 and UPC-E, which is why this calculator uses the asymmetric figures.

Is the human-readable number under the bars part of the size?

Not of the width calculated here, and not of the bar height either — both measure the bars and spaces plus the quiet zones. But the digits still need somewhere to sit, and on EAN and UPC the left quiet zone exists partly so the leading digit can be printed outside the bars without encroaching. Allow for the text as extra height in your layout rather than taking it out of the symbol.

Is my data sent anywhere?

No. The symbol-character planning, the geometry and the fit check are all plain JavaScript running inside this page. Nothing is uploaded, nothing is logged, and you can load the page, go offline and it will still work. That is deliberate: part numbers, batch codes and unreleased GTINs are exactly the kind of thing that should not pass through someone else’s server to answer a question about millimetres.

Print It, Then Prove It Scans

The width is arithmetic; whether your printer held the X-dimension is not. Print the label, scan it with Scan & Generate at the distance it will really be read from, and check the decoded value against what you typed — it reads Code 128, Code 39, ITF, EAN and UPC, and keeps the result in a history you can export.