Skip to the content
UPC Generator

How to make a barcode in Excel

Excel has no barcode feature of its own, and Microsoft's only built-in barcode tool is a field code in Word. Every working route in Excel is a font, an add-in, a mail merge into Word, or a barcode image made elsewhere and inserted. Which one fits depends on the format you need.

By the UPC Generator team. Written from Microsoft's own support pages on field codes, mail merge, number precision and ActiveX, and from the manuals of the free Libre Barcode fonts. Nothing was run in Excel; the steps are Microsoft's. Last updated 4 November 2026. How UPC Generator pages are made.

What Excel can and cannot do

Microsoft documents no barcode feature for Excel. The Barcode command that once sat on the Insert tab belonged to a SharePoint 2007 document policy. Microsoft says barcodes were discontinued in SharePoint 2013 and later. The Microsoft Barcode Control, an ActiveX object some older guides describe, is no longer in Excel 2016 according to a Microsoft community answer. In Microsoft 365 and Office 2024, ActiveX controls are disabled by default. Microsoft encourages leaving them off.

That leaves five routes that work, and the right one depends on the barcode you need.

Route 1: a Code 39 font

Code 39 is the one common format a font can draw on its own. Install a Code 39 font, such as the free Libre Barcode 39 from Google Fonts, then put the text in a cell wrapped in asterisks. The asterisk is the start and stop character a scanner looks for. If the code sits in cell A2, the formula is:

="*"&A2&"*"

Set that cell to the barcode font and the bars appear. Plain Code 39 holds capital letters, digits, space and the hyphen, period, dollar, slash, plus and percent signs. Lowercase letters and an underscore will not encode. The font must be installed on every computer that opens or prints the sheet. One Microsoft community thread reports that Excel for the web printed plain digits where the desktop app printed bars. The Code 39 generator shows what the finished symbol should look like, including the asterisks. The barcode generator draws the other formats as files to insert.

Route 2: Code 128 needs an encoder

A Code 128 font cannot work from a plain formula. The Libre Barcode manual puts it directly: the fonts have to use an encoder. The encoder picks the shortest of three character sets and calculates the check character that must come before the stop symbol. The font vendor usually supplies that encoder as a macro or add-in, and the cell has to hold its output rather than your text.

If that is more than you want to set up, make the barcode as a picture instead. The Code 128 generator draws your text with the check character worked out. A PNG at your printer's resolution drops into a sheet as an ordinary image. For a list of stock codes, the SKU generator builds the codes and gives you a CSV to paste into Excel.

Route 3: UPC and EAN

Retail barcodes are harder still in Excel. The free Libre Barcode EAN-13 font needs an OpenType feature called contextual alternates to compose the bars. Its manual says Excel offers no OpenType features at all, so Excel users need the font's separate encoder. The simpler route is to draw the UPC or EAN-13 here at a GS1 size and insert the PNG. A barcode made in Excel is also not a registered number, so for goods you sell, how to get a UPC code comes first.

Route 4: a sheet of labels through Word

Microsoft's own route for barcode labels starts in Excel and finishes in Word, with your worksheet as the data source. Prepare the sheet and name the range. In Word, go to Mailings, Start Mail Merge, then Labels, and pick the label product. Go to Mailings, Select Recipients, Use Existing List, and choose the Excel file and its named range with the first row as column headers. In the first label, press Ctrl + F9 to open a field and build a DisplayBarcode field around merge fields. Microsoft's finished example reads:

{ DisplayBarcode "{ MergeField FirstName } { MergeField LastName } { MergeField City }" CODE128 \t \h 1440| }

Then choose Mailings, Update Labels, and Preview Results. The field supports 10 barcode types, including UPC-A, EAN-13, Code 39, Code 128, ITF-14 and QR. The syntax and every switch are in how to make a barcode in Word. Microsoft says the steps apply to Word for Windows and may differ on Mac or the web.

Route 5: the IMAGE function

Excel for Microsoft 365 and Excel 2024 have an IMAGE function that shows a picture from a web address. It is written =IMAGE(source), where source is an https address of a PNG, JPG or similar file. The address must not redirect, must not need a sign-in, and is limited to 255 characters. The catch is privacy: your barcode data sits in that address and goes to whichever service draws the picture. The generators here run entirely in your browser and have no such address, so they cannot feed IMAGE, and that is deliberate.

Keeping the numbers intact

Excel treats a column of digits as numbers, and Microsoft says it removes leading zeros and converts large numbers to scientific notation. Its precision is 15 digits, so for codes of 16 digits or more it says you must use a text format. A 12 digit UPC and a 14 digit GTIN fit, but an 18 digit SSCC does not. Format the column as Text before you type, or start each entry with an apostrophe. A custom format such as 00000 will not restore zeros that were already removed, though =TEXT(A1,"00000") can. For a mail merge, Microsoft says codes with leading zeros are dropped unless the column is formatted as text.

A scanner typing into Excel has the same problem. A Microsoft community thread fixed a scanner that produced decimals by formatting the input cell as Text. It also suggests setting the scanner to send a Tab rather than Enter, so the cursor moves across instead of down. The Code 128 generator can add either suffix to a label for exactly that reason.

Before you print a batch

Print at 100 percent scale, never fit to page, because scaling changes every bar width. A barcode drawn by a font is only as good as the printer's resolution, so check a sample with the scanner you will use. If the number is a UPC or EAN, test its last digit first. A font draws a wrong last digit as readily as a right one.

Designers working in Canva have the same choice between a font and a file, which barcodes in Canva covers. Which route suits which job, and the number that has to come first, is in how to make a barcode. Sellers keeping SKUs in a sheet can check where to find a SKU number for each platform's field.

More about barcodes in Excel

Does Excel have a built-in barcode generator?

No. Microsoft documents no barcode feature for Excel, and a Microsoft community answer confirms the old Barcode Control ActiveX is no longer in Excel 2016. Word's DisplayBarcode field is Microsoft's only built-in barcode tool.

Can I just change the font to make a barcode?

Only for Code 39, and only if the cell wraps the text in asterisks. Code 128 fonts need start, stop and a computed check character, so a plain font change gives bars that do not scan.

Why does Excel drop the zeros from my UPC?

Because it reads the cell as a number. Format the column as Text before you type, or start the entry with an apostrophe. Excel also keeps only 15 digits of precision, so an 18 digit SSCC must be text too.

Will the barcode show on another computer?

Only if that computer has the same font installed. A barcode inserted as a picture travels with the file, which is one reason to make a PNG rather than rely on a font.

9 source documents

  1. Microsoft: Field codes: DisplayBarcode field, fetched 2 November 2026
  2. Microsoft: Add barcodes to labels, fetched 2 November 2026
  3. Microsoft: Keeping leading zeros and large numbers, fetched 2 November 2026
  4. Microsoft: Excel specifications and limits, fetched 2 November 2026
  5. Microsoft: IMAGE function, fetched 2 November 2026
  6. Microsoft: ActiveX controls are disabled by default in Microsoft 365 and Office 2024, fetched 2 November 2026
  7. Microsoft Q&A: Microsoft barcode control 16.0 is not in Excel 2016, fetched 2 November 2026
  8. Libre Barcode: Code 39 and Code 128 font manuals, fetched 2 November 2026
  9. Libre Barcode: EAN-13 and UPC font manual, fetched 2 November 2026