How to make a barcode in Word
Word for Windows draws barcodes with a field code called DisplayBarcode, with no add-in and no font. Press Ctrl + F9, type the field, and toggle it to see the bars. Microsoft lists 10 types, including UPC-A, EAN-13, Code 39, Code 128, ITF-14 and QR, in Word 2016 and later.
By the UPC Generator team. Taken from Microsoft's support pages for the DisplayBarcode and MergeBarcode fields and for barcode labels. The field syntax and examples are copied exactly as Microsoft prints them. Nothing was run in Word. Last updated 4 November 2026. How UPC Generator pages are made.
Inserting one barcode
Microsoft says Word no longer has a built-in barcode tool but that you can still make barcodes with the DisplayBarcode and MergeBarcode field codes. The steps, in Microsoft's order:
- Click where you want the barcode.
- Press Ctrl + F9. Typing the curly brackets yourself does not work.
- Inside the brackets, type DisplayBarcode, then the data in quotes, then the barcode type and any switches.
- Right-click the field and choose Toggle Field Codes to see the bars.
Microsoft's own examples are these, copied exactly:
DisplayBarcode "http://www.microsoft.com" QR \q 3DisplayBarcode "490123456789" EAN13 \tDisplayBarcode "2345678" CODE39 \d \tDisplayBarcode "490123456789" CODE128 \tDisplayBarcode "012345678901" UPCA \t \xDisplayBarcode "123456" UPCE \t \x
Field codes and barcode types are not case sensitive. Microsoft warns that each type has its own data rules, and that data which does not meet them may stop the barcode rendering. Its UPC-A example is a case in point: 012345678901 has the wrong last digit, and the \x switch in that example is what fixes it. The check digit calculator shows that the correct number is 012345678905.
The 10 types and the switches
| Type | What it draws |
|---|---|
| QR | A QR code, with \q setting error correction from 0 to 3 |
| CODE128 | Code 128, letters and digits |
| CODE39 | Code 39; add \d for the start and stop characters |
| UPCA and UPCE | Retail UPC, with UPCE the compressed form |
| EAN13 and EAN8 | Retail EAN; JAN13 and JAN8 are aliases |
| ITF14 | The carton code; CASE is an alias |
| NW7 | Codabar, used on some library and blood bank labels |
| JPPOST | The Japanese postal barcode |
| Switch | What it does |
|---|---|
| \t | Prints the data as text with the bars |
| \h | Sets the height in twips, where 1440 twips are one inch |
| \s | Scales the symbol, from 10 to 1000 percent |
| \x | Fixes the check digit if it is invalid |
| \d | Adds the start and stop characters for CODE39 and NW7 |
| \p | Sets a retail style for UPC and EAN: STD, SUP2, SUP5 or CASE |
| \c | Sets the ITF-14 case code style: STD, EXT or ADD |
| \r | Rotates the barcode, 0 to 3 |
| \f and \b | Set the bar and background colors as RGB values |
One caution from a Microsoft MVP in February 2026: the sizing switches are reported not to be working. That is a community report, not Microsoft documentation, so check the printed size with a ruler before a run.
A sheet of labels from an Excel list
For a label per row of a spreadsheet, Microsoft uses the mail merge with a DisplayBarcode field wrapped around merge fields. Its steps, with its menu names:
- In Excel, prepare the worksheet and name the range. Codes with leading zeros, such as a UPC beginning 0, must be formatted as Text or the zeros are dropped in the merge.
- In Word, go to Mailings, Start Mail Merge, then Labels, and choose the label vendor and product. Select New Label if yours is not listed.
- Go to Mailings, Select Recipients, then Use Existing List, and pick the Excel file. Select the worksheet or named range and keep the first row as column headers.
- Click in the first label and insert an AddressBlock, or whatever text the label needs.
- Press Ctrl + F9 and type DisplayBarcode and a quote. Press Ctrl + F9 again and type MergeField FirstName. Move the cursor outside the inner brace and repeat for each merge field.
- Type a space and a closing quote, then the type and switches, then a vertical bar.
- Select Mailings, Update Labels, then Preview Results.
Microsoft's finished field is:
{ DisplayBarcode "{ MergeField FirstName } { MergeField LastName } { MergeField City }" CODE128 \t \h 1440| }
It produces a Code 128 barcode under each name and address. For a sheet of stock labels, the merge fields would be your SKU and description columns instead. The SKU generator can build that column as a CSV.
MergeBarcode is the same idea in one field. It takes a merge field name and a type, as in MergeBarcode URL QR \q 3, and generates the DisplayBarcode for each record.
Fonts and add-ins instead of the field
A Code 39 font works in Word as it does anywhere: wrap the text in asterisks, or use the field's \d switch. Keep to capitals, digits, space and the hyphen, period, dollar, slash, plus and percent signs. A Code 128 font needs start, stop and a computed check character, so it needs the vendor's encoder, which is why the field is easier. ActiveX barcode objects from older guides are disabled by default in Microsoft 365 and Office 2024, and Microsoft encourages leaving them off. The free ConnectCode add-in in Microsoft's marketplace encodes for fonts you install separately.
What Word does not check
Word draws what you give it. It does not know whether a UPC number is licensed through GS1. It also does not know whether the symbol is within the GS1 size range or whether the printer will keep the bar widths. For a retail barcode, draw it in the UPC generator or the EAN-13 generator. They show the true size in millimeters and warn about colors and printer dots. Then insert the SVG or PNG into Word as a picture. Print at 100 percent scale and scan a sample before a batch.
For a list of codes rather than one, start in Excel and merge into Word. For a label designed in Canva, the barcode goes in as a picture too. The routes side by side, with the number that comes first, are in how to make a barcode. What the scanner needs from the bars it reads is in how barcodes work. To skip the field codes, the Code 128 generator and the Code 39 generator make a PNG or SVG to insert as a picture. The barcode generator covers the other formats.
More about barcodes in Word
Which versions of Word can make barcodes?
Microsoft lists Word for Microsoft 365, Word 2024, 2021, 2019 and 2016, and says the field works in Word for Windows on the desktop. It says the steps may differ in Word for Mac and Word for the web.
Why does my field just show text?
Fields show their code until you toggle them. Right-click the field and choose Toggle Field Codes. If the bars still do not appear, Microsoft says data that does not meet the barcode type's rules may not render.
Can Word make a UPC I can sell with?
It can draw one. The number inside must still be licensed through GS1 for a retailer to accept it, and Word does not check that or the size. The UPC generator here shows the GS1 size and warns about risks before you print.
Does Word still make postal barcodes?
Not the old kind. Microsoft says the Postnet barcode was discontinued in January 2013 and replaced by the Intelligent Mail barcode. It points to the US Postal Service for those.
8 source documents
- Microsoft Marketplace: ConnectCode Barcode Fonts Encoder add-in, fetched 2 November 2026
- Microsoft: Field codes: DisplayBarcode field, fetched 2 November 2026
- Microsoft: Field codes: MergeBarcode field, fetched 2 November 2026
- Microsoft: Add barcodes to labels, fetched 2 November 2026
- Microsoft: Prepare your Excel data source for a Word mail merge, fetched 2 November 2026
- Microsoft: ActiveX controls are disabled by default in Microsoft 365 and Office 2024, fetched 2 November 2026
- Microsoft Q&A: How to add barcodes in Word, fetched 2 November 2026
- Libre Barcode: Code 39 and Code 128 font manuals, fetched 2 November 2026