Barcode Generator: Code 128, EAN-13, UPC-A and Code 39

Pick a barcode type and type what it should hold. The bars are drawn as you type, the check digit is worked out for you, and you can save the picture as SVG or PNG.

TechFreeNo sign-upWorks on phones
Barcode type
Type–
Data in the bars–
Code set–
Check digit–
Width–
Quiet zones–

Always scan a printed copy with the scanner or phone app you plan to use before you rely on it. This page draws the bars only: it does not issue product numbers.

This tool runs in your browser. Nothing you type is uploaded or saved, and there is nothing to install or sign up for.

What this barcode generator draws

A barcode is a row of dark bars and light gaps that a scanner turns back into characters. This page builds four common linear barcodes in your browser: Code 128 for general text, EAN-13 and UPC-A for 13-digit and 12-digit numbers, and Code 39 for short capital-letter labels. Nothing you type is sent anywhere. The picture is drawn on your own device, and you can save it as a vector SVG file or a PNG image.

It is handy for classroom library labels, equipment tags, storage boxes, event passes and practice sheets for a lesson on check digits. If you want a square code that holds a web link instead, use the QR code generator.

Making a barcode step by step

  1. Choose a Barcode type. The hint under the box tells you which characters that type accepts.
  2. Type your text or number in Text or number to encode. The preview redraws on every keystroke.
  3. For Code 39 only, tick the check character box if your scanner is set up to expect one.
  4. Read the detail lines to confirm the data and the check digit.
  5. Press Download SVG for print work or Download PNG for documents and slides. Copy details puts a one-line summary on your clipboard and Reset returns to the starting example.

Which type should you pick?

TypeWhat it holds hereCheck digit
Code 128Up to 60 keyboard characters: letters in both cases, digits, spaces, punctuationAlways, built in automatically
EAN-13Exactly 13 digits (type 12 and the last is added)Always, the 13th digit
UPC-AExactly 12 digits (type 11 and the last is added)Always, the 12th digit
Code 39Up to 40 characters: capitals, digits, space and – . $ / + %Optional

For your own labels, Code 128 is usually the easiest choice because it accepts almost anything you can type and stays compact. When the data is all digits, has an even length and is at least four digits long, the tool switches to the denser digit-pair mode (code set C) by itself. Otherwise it uses code set B, one symbol per character.

Worked example: CLASS-2468 in Code 128

The page opens with the text CLASS-2468. Code 128 gives every character a value: its position in the keyboard character table, counted from the space character as zero. The start symbol for set B has the value 104. The check symbol is a weighted sum: the start value, plus each character value multiplied by its position in the text.

PositionCharacterValuePosition × value
startStart B104104
1C3535
2L4488
3A3399
4S51204
5S51255
6–1378
7218126
8420160
9622198
10824240

The products add up to 1,587. Divide by 103 and the remainder is 42, so the check symbol carries the value 42. The finished barcode has 13 symbols: start, ten characters, check and stop. Each symbol is 11 modules wide except the 13-module stop, which gives 145 modules of bars and spaces, or 165 once the blank margin of 10 modules on each side is counted. Those are the figures the tool shows for this text.

How the EAN-13 and UPC-A check digit works

Both number barcodes end in a digit that lets a scanner catch a misread. Working from the right-hand end of the number without its check digit, multiply the digits by 3 and 1 in turn, add the results, and find what must be added to reach the next multiple of ten.

check digit = (10 - (weighted sum mod 10)) mod 10

Take 590123412345. The digits that get weight 3 are 5, 3, 1, 3, 1 and 9, which total 22 and contribute 66. The others, 4, 2, 4, 2, 0 and 5, total 17. The sum is 83, the next multiple of ten is 90, and the check digit is 7. The full number is 5901234123457. Type all 13 digits with a wrong last digit and the tool refuses to draw, telling you which digit it expected. The same rule turns the 11 digits 01234567890 into the UPC-A number 012345678905. You can check the remainder steps yourself with the modulo calculator.

The Code 39 check character

Code 39 gives each of its 43 characters a value from 0 to 42 in the order 0-9, A-Z, then – . space $ / + %. Add the values of your text, take the remainder after dividing by 43, and the character with that value is appended. For ROOM 12 the values 27, 24, 24, 22, 38, 1 and 2 add up to 138, the remainder is 9, and the label becomes ROOM 129 inside the asterisk start and stop marks. Only switch this on if the reading side is configured to check it, because otherwise the extra character simply appears as data.

Limits you should know about

  • Product numbers are not free to invent. The numbers on retail goods are licensed, not made up. GS1 describes itself as the only official provider of GS1 GTINs and EAN/UPC barcodes globally (GS1, read December 2026). This tool only draws the bars for a number you already have.
  • Not tested on every scanner. The patterns follow the published symbol tables and the check digits are verified, but print size, ink, paper and scanner settings all matter. Scan a test print before you make a hundred labels.
  • Keep the white margins. The blank space at each end is part of the barcode. Cropping it off is a classic reason a code will not read.
  • Do not stretch one direction only. Scale the image evenly. Squeezing the width changes the bar proportions.
  • No extended character sets. Accented letters and emoji are rejected rather than silently changed.

Practical tips for school and office labels

Use SVG when the label goes to a printer: it stays sharp at any size. Print dark bars on a plain light background, and leave the text line under the bars so a person can still type the code by hand if a scan fails.

Keep label data short. A ten-character asset tag scans more easily than a forty-character sentence, because every extra character makes the bars narrower at the same label width. If you need unique tag numbers for a set of items, the random number generator can produce them, and a UUID generator suits records in a database better than a printed label.

Teachers can turn the check digit into a short activity: hand out 12-digit numbers, let students work out the 13th by hand, then confirm each answer with the tool.

More generators and converters are in the tech and web tools group, and the complete list of free online tools covers math, text, time and classroom helpers too.

Frequently asked questions

How do I make a barcode for free?

Choose a type, type the text or number, and the barcode is drawn at once in your browser. Press Download SVG or Download PNG to save the picture. There is no sign-up and nothing is uploaded.

How is the EAN-13 check digit calculated?

Starting from the right of the first 12 digits, multiply the digits by 3 and 1 in turn, add them up, and take the amount needed to reach the next multiple of ten. For 590123412345 the sum is 83, so the check digit is 7.

What is the difference between UPC-A and EAN-13?

UPC-A holds 12 digits and EAN-13 holds 13. Both end in a check digit worked out with the same 3 and 1 weighting, and both encode digits only.

Can I use these barcodes on products I sell in stores?

The tool can draw the bars, but the number itself has to be one you are licensed to use. Retail product numbers come from GS1, so get the number there first and then draw it.

Why does my Code 39 barcode show asterisks?

Code 39 uses an asterisk pattern as its start and stop mark. The tool adds one at each end and shows them in the text line. They are not part of your data.

Should I download the barcode as SVG or PNG?

Use SVG for printing because it is a vector file that stays sharp at any size. Use PNG when you need to drop the image into a document, slide or chat message.

Related tools

Browse all free tools →