ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel
  • »
  • Technology»
  • Computers & Software»
  • Computer Software»
  • Office Software Suites»
  • Microsoft Office

DISPLAYBARCODE and MERGEBARCODE: How to Insert or Mail Merge Barcodes (Bar Codes) Word 2013, 2016, Microsoft Word 365

Updated on June 8, 2018

Before you start

The Word feature this Hub uses is only in Word 2013, 2016 and Word 365. If you have an earlier version of Word or if Word's bare-bones features don't meet your needs, you'll need a third-party solution; see the Alternatives and workarounds section below for some advice.

If you already have image files containing barcodes and want to mail merge those instead of generating new ones, see my Hub about IncludePicture.

Free barcode generator in Microsoft Word

Need some barcodes? Microsoft very quietly brought barcodes back in Word 2013 and 2016 after dropping them back in 2007. There's very little information available about using the DISPLAYBARCODE field, so I'm here to fix that.

DISPLAYBARCODE is free and very basic. Yes, it does generate barcodes, but it's missing many of the options and features that you may need. Also, we're going to have to get our hands dirty with some manual Word field coding.


Don't use MERGEBARCODE even though the name sounds right. Use DISPLAYBARCODE instead.

You may see some references to MERGEBARCODE on the web. Well... the documentation for that feature seems to be wrong. It doesn't create barcodes! I suspect it's supposed to be a variant of the MERGEFIELD field for use within DISPLAYBARCODE, but MERGEFIELD works just fine and is conveniently supported by Mailings, Insert Merge Field on the Ribbon Bar.

Please leave a comment if you have better info about MERGEBARCODE.

Barcodes step by step

We're going to do some manual field coding, and let's say it as it is: field coding is right up there with doing your own taxes. It's painstaking work and Microsoft Word doesn't help you at all. So, block out some uninterrupted time and please try to follow these instructions exactly as written. Always enter spaces if and only if instructed.

Also, you must not copy & paste the examples shown, and you must not type in the { and }'s nor the .'s (i.e. not the curly braces or periods) shown below. It won't work. Use the procedures described below to make Word show those characters.

  1. Make sure you're using Word 2013, 2016 or 365 (not earlier) and that your Word document is in the newer (.docx) format. The old .doc format doesn't support these barcodes.
  2. (Skip this step if you're just inserting a barcode based on hard-coded data--not mail-merged data.) Make sure your Word Mail Merge datasource is selected: Mailings, Select Recipients, Use an Existing List.
  3. Locate where you want the barcode and place Word's cursor there.
  4. Press Ctrl-F9 (i.e. press the F9 key while first holding down the Ctrl key). You'll see {.|.} Those periods are Word's way of displaying spaces within field codes; the vertical bar is your cursor. If you don't see them, press Ctrl-Shift-8 (i.e. while holding down both the Ctrl and Shift keys, press the "normal" 8 key -- not the one on the numeric keypad) to show them. Pressing again hides them.
  5. Without moving the cursor, type DISPLAYBARCODE You'll see {.DISPLAYBARCODE|.}
  6. Press the Spacebar once, then the " (double-quote) key. You'll see {.DISPLAYBARCODE "|.}
  7. Now for the data to barcode. If it's hard-coded, type the data. If you want to use a mail-merge field: Mailings, Insert Merge Field, <select from dropdown list>. You can insert several fields, and you can intersperse hard-coded text and fields. For example, you might see:
  8. Press the " (double quote) key followed by the Spacebar to close out the data. For example:
  9. You must now type a code which selects the type of barcode you want. The full list is in Microsoft's DISPLAYBARCODE article, but here these are the most common:
    For example:
    {.DISPLAYBARCODE."{.MERGEFIELD.First_Name.} {.MERGEFIELD.Last_Name.}".CODE128|.}
  10. There are several option flags that you may enter. If you enter options, you must enter a space before the option, and between each option if you enter more that one. Again, the full list is on Microsoft's DISPLAYBARCODE article, but these are noteworthy:
    \t shows the human-readable text below the bars
    \h followed by a space and a number (in twips, which are 1/1440 ths of an inch) to set the height. Height includes any human-readable text.
    For example:
    {.DISPLAYBARCODE."{.MERGEFIELD.First_Name.} {.MERGEFIELD.Last_Name.}".CODE128.\t.\h.1440|.}
  11. Press Alt-F9 (the F9 key while holding down the Alt key) once or twice until you see your barcode.

Result of DISPLAYBARCODE for the example above
Result of DISPLAYBARCODE for the example above

Limitations and problems

On the plus side, there's nothing extra to buy or download to use DISPLAYBARCODES, and it's officially supported by Microsoft.

On the minus side

  • You must have the Word 2013, 2016 or 365, and must use the docx format
  • Manual field coding is required. Grrrrr!
  • You can send documents containing DISPLAYBARCODE to others, but they must have Word 2013, 2016 or Word 365. Other Word versions display nonsense text instead of barcodes
  • Merge to Email (Send Email Messages option of Finish & Merge) does not work. The barcodes don't appear in the sent emails.
  • DISPLAYBARCODE generates a limited range of barcode types
  • Some types of barcodes require checksum digits as the last character. These must be computed based on the rest of the data but, unlike many add-ins, Word doesn't generate them for all barcodes. In those cases, you must compute the checksums using Excel formulas or other software before creating the barcodes
  • If you need to put Tab or Enter (aka "control characters) in the barcode's data to separate multiple fields: unfortunately DISPLAYBARCODE doesn't let you input them. Note that only a few barcodes types like QR and Code 128 theoretically could support control characters, even if DISPLAYBARCODE did.
  • Yet other types of information requires special internal formatting which Word doesn't do. See the later sections for a few notable ones.

Alternatives and workarounds

If DISPLAYBARCODES can't do the job for you or--be honest--is just too much of a hassle to set up, there are third-party solutions. Virtually all of them work will all Word versions and are available for most barcode types.

These break down into two main categories: traditional barcode fonts, and the modern barcode add-ins. I personally find add-ins much more convenient.

Barcode fonts

  • My own favorites are from ID Automation because they have the widest selection, though I'll admit they're pricey. Word's interface for using them is familiar since it's the same as regular text faces.
  • Set them up by inserting one or more regular text mail-merge fields, then selecting the barcode font for that text. You will need to use some Excel formulas to generate checksums or other characters for most barcode types; ID Automation, for one, ships Excel formulas with many of its fonts.
  • Each different barcode type and size requires its own particular font.
  • 2D barcode fonts (QR Code, Datamatrix, PDF417, etc.) are available, but are much too hard for non-IT-professionals to use.
  • Internal pre-formatting of data for vCard, advanced GS1-128, etc. needs to be done with Excel formulas.
  • If you send a Word document that uses barcode fonts to another computer, that computer needs to have exactly the same fonts, too. Typically, you must purchase a copy of the font for every computer.
  • Similarly, barcode fonts don't work with Merge to Email (Send Email Messages option of Finish & Merge) unless the recipient also has exactly the same fonts installed.

Barcode add-ins

  • My personal favorite is OnMerge Barcodes (limited free version available) because it's the easiest to use and has so many options.
  • Typically well integrated with Word, work with a pop-up dialog that lets you point and click to set up the data and choose options from a menu.
  • Take care of generating whatever checksums or other required data processing, meaning no Excel formulas. You can use any type of datasource supported by Word.
  • Typically have an "escape" mode that allows you to enter control characters like Tab and Enter (for barcode types where that's possible).
  • A few of them automatically generate vCard and advanced GS1-128.
  • When you mail merge to Edit Individual Documents (i.e. merge to a new document), the resulting document can be sent to any Word user even if they don't have a barcode add-in or font.
  • Likewise, these typically do work with Merge to Email (Send Email Messages option of Finish & Merge).
  • Shop around. Features, convenience and supported barcode types vary considerably.

QR Code
QR Code

vCard and MECARD contact information

Contact information is often placed in QR Codes so that smartphones can scan a barcode and automatically enter it in the contact list.To make this happen, the information must be formatted into the vCard or MECARD format before being made into a QR Code.

For example, the vCard data for somebody's name, job title, phone number and email might look like this:
ORG:The Company

DISPLAYBARCODE does generate QR Codes, but does not format data into the vCard format. You can generate this using an Excel formula, but there are no good resources I can link to. It seems that generating vCards is a trial-and-error process because the various smartphones do not really conform to standards -- they accept varying bits and pieces of the various vCard standards.

You can generate some vCard QR Codes on many sites on the Internet. Be sure to use foreign characters in your tests if your project requires them. If they work for a representative sample of phones you're targeting (please don't just test with your own phone!), you can reverse-engineer the vCard format they're emitting.

If you see digits in parentheses, it's GS1-128 -- not Code 128
If you see digits in parentheses, it's GS1-128 -- not Code 128

GS1-128 barcodes

If you see a few digits in parentheses at the beginning of the data for a 1-dimensional barcode, for example (00), this is actually a GS1-128, also known as UCC EAN 128. Such barcodes are commonly used for labelling and logistics.

DISPLAYBARCODES simply cannot generate this. It is a variant of Code 128 but has a magic invisible marker called FNC1 inside the barcode. See Alternatives and workarounds, above.


What's your preferred barcode solution for Microsoft Word?

See results

© 2014 Mister Word


    0 of 8192 characters used
    Post Comment

    • wordnut profile image

      Mister Word 2 weeks ago from Californiaaah

      @Leuh Tab and Enter are special characters called "control characters." No way of entering control characters in DISPLAYBARODE that I know of. I should add that fact to the Limitations & Problems section of the article.

      Mind you: only a few barcode types like QR & Code 128 are designed to theoretically support those kinds of characters, whether in Word or anywhere else.

      Some addins have a "data escaping" mode that lets you write something like ~d009 for Tab and ~d013 for Enter. Of course, that's only for the barcode types that do support control characters.

    • profile image

      Leuh 2 weeks ago

      Is there a way to code [tab] or [enter] in this?

    • wordnut profile image

      Mister Word 3 months ago from Californiaaah

      @Robert Thanks for that info! I'm sure your comment will help quite a few people.

    • profile image

      Robert Delage 3 months ago

      ERROR with \q switch:

      When using DISPLAYBARCODEs or MERGEBARCODES in Word 2016 (not sure on previous version) the \q switch does not work with [0..3] but rather with [L, M, Q, H]. If you use a [0..3] digit it always produce a QR code with Q level error correction.

    • wordnut profile image

      Mister Word 5 months ago from Californiaaah

      @MSK DisplayBarcodes doesn't work with email merges as mentioned in the Limitations and Problems section of the article. See the Alternatives and Workarounds section for just that.

    • profile image

      MSK 5 months ago

      This is working well for word. But later word is not getting emailed. It is getting failed with error message " Too long line was received. Transmission aborted."

      Can anyone help me on this ?

    • profile image

      Paul Licari 6 months ago

      Thanks for the information.

      I will give it a try and see how it works

    • profile image

      Roger 8 months ago

      When using MERGEBARCODE the barcode will also be displayed in an email (HTML). This isn't the case when using DISPLAYBARCODE as you mentioned already.

    • profile image

      Grateful 10 months ago

      Thank you. This worked for me today. Gratitude for sharing. But you are right... Follow instructions exactly.

      As my grandmother would have said, "You have earned another jewel in your heavenly crown."

    • wordnut profile image

      Mister Word 12 months ago from Californiaaah

      @Christen I'm not sure what's going on since I can't see your screen, but are you using Mailings + Insert Merge Field, or are you manually inserting the field code? It's very easy to mess up field codes if even a single space is wrong, which is why I recommend Insert Merge Field.

      Make sure you have "double quotes" around the merge field.

      Also, certain types of bar codes expect number-only data, so any commas, dollar signs, spaces, etc. in the data might get you an error. As a test, I'd try merging the same field into your document as plain text to see what it's about.

    • profile image

      Christen 12 months ago

      You're right - I can't find ANYTHING else on this topic online... frustrating!! I'm having an issue in step 7, when I go to insert a merge field it gives the error "Required parameters are missing or incorrect". Any idea why I'd get that error? Also, it worked fine if I just entered "1001" for example - but then all of the barcodes reflect "1001". If I go this route, any way to get a sequence of numbers vs. a repeat of the same number?


    • wordnut profile image

      Mister Word 14 months ago from Californiaaah

      @waldirs Thanks! I would never have guessed that in 1000 years.

    • profile image

      Waldirs 14 months ago

      Answering to "Please leave a comment if you have better info about MERGEBARCODE":

      If you just add Japanese as an editing language (no need to download anything), you'll see the "Insert Barcode Field" button under the "Mailings" tab. It's very easy to use and it inserts a MERGEBARCODE field that works.

    • wordnut profile image

      Mister Word 19 months ago from Californiaaah

      @toonerty - Data is "encoded" (a crude form of data compression) into the pattern of bits in the bar code. QR supports several different encoding schemes intended for different purposes, e.g. all-numbers, capital letters and numbers, or full character set. Different encoding schemes compress different kinds of data better or worse. Using the wrong encoder for a given piece of data will result in less-efficient encoding, i.e. bigger bar code, but it will still scan.

      It's up to the bar code generator to automatically choose the best encoding for your particular data. There's a surprising amount of work involved. Or, the encoder can just punt and always use the same encoding scheme no matter what, which is obviously less work for the person writing the bar code software. I don't have any inside knowledge, but that would be my guess.

      BTW, the QR specification requires all QR scanners/decoders to support all encoding schemes, so always generating a single encoding wouldn't buy better compatibility with more scanners. Matter of fact, bigger bar codes make it slower and harder for scanners to "lock in" to them.

    • profile image

      toonerty 20 months ago

      Thanks for the explanation. Very precise, and now I've got VBA code creating a print catalogue with QR codes to link to our company's website.

      However, I've noticed that for the same URL, an online QR Generator creates a 29x29 QR, and Word creates a 33x33 QR. That's 1089 vs 841 pixels, an overhead of about 30%.

      Any ideas on how to get Word to create smaller QRs? Also, I've tried the 4 different \q settings and it creates exactly the same QR each time - I think....

    • profile image

      decimal639 2 years ago

      I have a work project that does mail merge programmatically from a database. My boss now wants to add a QR code onto the letters I am creating. I tried your example for doing a mail merge into the item but the merge has been placing the value outside the DISPLAYBARCODE container instead of between the quotes. Anyone have any idea why this is happening and/or suggestions how to 0correct this? This isn't affecting any of the other merge fields, just the one inside the DISPLAYBARCODE container.

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @FallingMan Turns out the \h option doesn't work for 2D bar codes. You can kinda use the \s xxx option instead, where xxx is the *percentage* of the bar code's original size, e.g. \s 200 is 200% of original size.

      However, the overall size will vary depending on the data you encode in the QR. You cannot get Word to use a specific size for the overall bar code. The \s option scales the natural size up or down, but the catch is the "natural size." By default, Word makes the original bar code with each cell (dot) 1x1 mm square. That means that the overall size of the bar code will vary depending on how many cells are in the bar code, which in turn depends on the information is encoded in the QR.

      You'd think that you could nail down the natural size of the QR code by always encoding the same number of characters of data, which you'd expect would result in QR codes having the same number of cells and consequently the same size. Unfortunately the number of cells depends on both the number of characters and on the characters themselves. Certain data patterns pack into a QR code more "tightly." This means that different data of the same length can produce different-sized QR codes.

      So, it isn't a perfect solution, but \s may be work for you depending on how exactly you need to control the overall size. Otherwise, you can always fall back on 3rd-party solutions.

    • profile image

      FallingMan 2 years ago

      "@Jaroslav Check out the /h option in step 10 of the procedure in the article."

      I can get the /h to work for code128 etc but not QR codes, are you sure that syntax works for QR codes?

    • profile image

      cory 2 years ago

      This article is a gem, thank you.

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @Paul I know nothing about Publisher. If anyone reading this has an answer, please feel free to jump in.

    • Paul Southcott profile image

      Paul Southcott 2 years ago

      I have this working in word with no problem

      I would like it to work in Publisher - I have tried using same settings as word but doesn't work.

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @Suresh I've revised the article to show the spaces/periods exactly as Word displays them.

    • profile image

      suresh 2 years ago


      I did read that, but i do get to see the other two periods that are coming by default.

      For e.g. the below is the text from your instructions


      But when i enter data and press the space bar once i get this


      Notice the additional period after E.

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @Suresh See my answer to @Willie immediately above.

    • profile image

      Suresh 2 years ago


      Thx for the wonderful writing. But i am facing a problem, in Step 6 after pressing the space bar i get one additional "period" and not a space. How to over come this

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @Willie To make those "periods" appear, press Ctrl-Shift-8 i.e. while holding down both the Ctrl and Shift keys, press 8 (the one on the regular keyboard, not the 8 on the numeric pad). Doing the same thing again hides them.

    • profile image

      Willie 2 years ago

      When I press the Ctrl-F9 key the periods do not appear in the brackets just the cursor does. I tried manually putting in the periods and the rest of the information and the bar code never appears. I am using Word 2013 and the docx file extension.

    • profile image

      Django Lohn 2 years ago

      Dear wordnut,

      Because I found your post by accident and it helped me with a problem you might not even know that exists, I thought my input may be of assistance for future "googlers" =D

      I found that the MERGEBARCODE option is working fine but you probably would prefer 1 code column in the Excel source that combines other data into one column so just 1 reference is needed in Word.

      One interesting fact is that de QR code generated by MERGEBARCODE in the final finished merged document, creates a picture replacing the code and this picture contains very fine white lines between blocks within the QR code. Smartphones usually have no problem with this, but sometimes scanning software can have trouble with these lines.

      Trying to prevent these wite lines your post got me trying one last desparate move: use the DISPLAYBARCODE with the MERGEFIELD and what do you know... the final finished merged documents have a perfect white-line-less QR code (instead of the picture)!

    • wordnut profile image

      Mister Word 2 years ago from Californiaaah

      @Jaroslav Check out the /h option in step 10 of the procedure in the article.

    • profile image

      Jaroslav 2 years ago

      It´s possible to set up fix height of QR code? When I generated an QR code their height is different for each data set.

    • wordnut profile image

      Mister Word 3 years ago from Californiaaah

      @Owen The examples in the article explicitly give detailed instructions and show examples for what you're requesting. They've been tested and are known to work.

      I'm not exaggerating in the article when I say that manual field coding is painful and painstaking. Fields won't work if you so much as look at them the wrong way. In my my experience editing my other hub about using the IncludePicture field, several users complained that the instructions didn't work. In every single case, it turned out they weren't following the instructions 101% exactly as written.

      This article does have a section that explores your options for alternative workarounds.

    • profile image

      Owen 3 years ago

      What code do I need to load the BARcode data from a field on the document or multiple fields. Everything I have tried doesn't work.

    • wordnut profile image

      Mister Word 3 years ago from Californiaaah

      @Walter Thanks for pointing out the omission. Merge to Email doesn't work with DISPLAYBARCODE. I've updated the Limitations and Problems section of the article to explain this.

    • profile image

      Walter 3 years ago

      Hi I tried this and works well in word, but as soon as I send it as an email the codebar does not appear. Is there any way to fix this?

      Im sending my clients invoice each month and I need for them to see the codebar in order to print and pay it.

      Thank you

    • wordnut profile image

      Mister Word 3 years ago from Californiaaah

      @Miles Sorry, only Word 2013 or later. There are no updates or Service Packs for older versions that make DISPLAYBARCODE available.

    • profile image

      Miles 3 years ago

      I have Word 2010. Will this work for me?


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: ""

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)