How to create barcode in Excel

This is a step-by-step guide on how to create a barcode in Excel. Generating barcodes takes only a few steps, but you will need to download and install a free barcode font. The alternative would be to use Excel barcode add-ins.

You can download the Excel spreadsheet I’ve used when making this tutorial.

How to generate barcodes in Excel

If you want to create a barcode in Excel that any barcode scanner can recognize, follow the steps described below.

Step 1: Download and install the barcode font Libre Barcode 39.

If you prefer a two-row barcode, you can use Libre Barcode 39 Text (this also includes the text under the barcode). If you haven’t installed fonts before, read this tutorial from Microsoft.

Note: Other barcode fonts are available online, but I prefer to use Google Fonts. Feel free to do your research and choose the one that best fits your project.

Step 2: Launch Excel and create a blank spreadsheet.

Step 3: Create two columns named Code and Barcode.

Create two columns named Code and Barcode.

The Code column will store the alphanumeric data, which is used to generate the barcode. The Barcode column will contain the actual barcodes.

Step 4: Format the cells in the Code column as Text.

Right-click on any selected cells and choose Format Cells.

To convert cell format to Text, select the Code column, right-click on it, and select Format Cells.

Change the format to Text to properly generate the barcodes.

From the Format Cells dialog box, select the Text format, and click OK.

Note: This step is needed to prevent Excel from removing leading zeros from your codes.

Step 5: Enter the formula ="*"&B3&"*" in the first empty cell from the Barcode column.

Copy the formula downwards to as many cells as needed. The asterisk (*) symbol indicates the beginning and the end of the sequence.

Note: If your data is stored in other columns, adjust the formula accordingly.

Step 6: Select the cells from your Barcode column (except for the header row) and change the font to Libre Barcode 39.

Change the font to Libre Barcode 39.

Navigate to the Home tab with the cells selected and choose Libre Barcode 39 from the Font menu. Also, increase the font size to match your needs. I have used a font size of 26.

Step 7: Enter alphanumeric data into the Code column to generate the barcodes.

Create barcode in Excel using a custom font and a simple formula.

How to generate random barcodes

You can use the RANDBETWEEN function to generate random numbers. The RANDBETWEEN function uses two arguments (bottom, top) to generate a random number. Using the bottom and top arguments, you can control the range of potential random numbers.

Using the same process described in the previous section, you can also create a barcode that is randomly generated.

Random Excel barcode generator.

I have created a random barcode generator using the following formula:



  • cell B3 is the bottom limit for the barcode generator
  • cell C3 is the top limit for the barcode generator

I have included the Excel spreadsheet I’ve used to create random barcodes. Download it and use it as you please. Just make sure to install the barcode font or change it to the one you have installed.

Create barcodes in Excel using add-in

If you don’t want to create barcodes manually, you can use an Excel add-in. I have included a list with some of the most popular add-ins to create barcodes:

What to do next?

After reading this tutorial, I hope that you are better equipped to create barcodes in Excel. If you struggle to replicate the process shown in this article, drop me a comment below, and I’ll help you out as soon as possible.

About me

My name is Radu Meghes, and I'm the owner of Over the past 15+ years, I have been using Microsoft Excel in my day-to-day job. I’ve worked as an investment and business analyst, and Excel has always been my most powerful weapon. Its flexibility and complexity make it a highly demanded skill for finance employees. I launched back in 2017, and it has become a trusted source for Excel tutorials for hundreds of thousands of people each year.

If you'd like to get in touch, you can contact me on LinkedIn.

Thousands of people have benefited from my free Excel lessons. My only question is, will you be next?