Word: Adding a bar over a letter

July 2, 2010

I learnt a new word the other day: macron. So, what’s a macron? It’s a bar or line over the top of a word or letter, such as those used to indicate the mean in mathematical equations.

And why did I learn this word? Because Stephanie, one of my team’s authors, wanted a line over the top of her capital D. She could get the line using Microsoft Word’s equation editor, but as she had to define what the D with the overbar/overline/overscore meant, she wanted to insert it into the Terms list too. However, it wouldn’t copy properly. So she asked me.

Equations are one of the few areas in Word that I’ve never tackled, so, as I told Steph, it was all a new experience for me. I confirmed that copying the D with the overbar was problematic when I used the equation editor, so I figured there had to be another way to get a line on top of a letter. And there is. In fact, there are several ways and the method you choose should be the one that gives you the result you’re looking for, taking into account your circumstances (e.g. will you have to copy from one document to another? is the method easy for you to use/remember? do you have to create a lot of these? is the font important?).

I Googled the problem and after some hunting around I discovered some great resources (listed at the end of this post), and discovered that the line over the top of a letter is called a ‘macron’. Armed with that little piece of information, back to Google, where I found out more about this beastie.

Please note: Some letters already have a macron built-in. Check the Windows Character Map (Start > All Programs > Accessories > System Tools > Character Map on Vista)  or use a program such as BabelMap to see if there’s an existing character you can use — if there is, use that as it’s the quickest and simplest method. If your letter doesn’t have an existing character (D doesn’t), you’ll have to create it yourself, which is what the rest of this article is about.

The methods below show how to create your own letter with a macron (I’ll use D as the example). I’ve used Word 2007 in these instructions, but Word 2003 and later versions of Word is similar for the most part.

Easiest ever method!

September 2018: Anik8G, a commenter on this post, shared his solution and it’s super easy. You can probably ignore all other solutions and use his. He has a short YouTube video that describes what he does: https://www.youtube.com/watch?v=3_h7ukThU_4, but you’ll likely need a little more information for it to work.

His solution uses the built-in Math AutoCorrect feature, which you need to turn on if it’s not already on. It’s under File > Options > Proofing. Click the AutoCorrect Options button, then select the Math AutoCorrect tab and check the two check boxes.

Look at the Replace and With lists, and note down the Replace string you want to add over your letter (in this example, I needed \bar). Click OK and get back to your document. Now, type your letter, followed immediately by the Replace string, then a space. For my example, I typed D\bar<space> and that automatically added a bar over the top of the letter. Just brilliant!

Method 1: Use Word’s Equation Editor

Option 1: Use a built-in accent character

  1. Go to the Insert tab > Symbols group (far right), then click Equation.
  2. Select Insert New Equation from the bottom of the list.

    This opens the Equation Tools > Design tab and puts a Type equation here box into your document.
  3. Click Accent on the Design tab > Structures group.
  4. Scroll down past the Boxed Formulas section to the Overbars and Underbars section.
  5. Click the Overbar icon.

    You’ll see something like this in your document:
  6. Click in the dashed box, then type D.
  7. Click outside the equation box to hide it; you can show it again by clicking on the D with the macron.

Your character will look like this:

Option 2: Create your own

  1. Go to the Insert tab > Symbols group (far right), then click Equation.
  2. Select Insert New Equation from the bottom of the list. This opens the Equation Tools > Design tab and puts a Type equation here box into your document.
  3. Type D in the equation box, then select it.
  4. Click Accent on the Design tab > Structures group.
  5. Click the Bar icon.

    You’ll see something like this:
  6. Click in the dashed box, then type D.
  7. Click away from the equation box to hide it; you can show it again by clicking on the D with the macron.

Your character will look like this:

Note that the macron created using this option is slightly narrower than that created using the built-in accent (above), and is closer to the top of the letter.


  • Quick and easy
  • You get a properly formatted macron over the letter


  • You may not be able to change the font (I wasn’t able to change it from Cambria Math)
  • If you copy this equation from one Word document to another, you must remember to select Keep Source Formatting as soon as you paste it, otherwise the letter and its macron are treated as two separate characters.

Method 2: Use Word’s Equation field, with switches

To use this method, you need to know the character code to create a macron. If you have a numeric keypad, it’s Alt+0175; if you have a keyboard without a numeric keypad, it’s 00af (they are zeros) followed immediately by Alt+x. Test these key combinations in your document first to make sure you can create the macron successfully with the keyboard.

Option 1: Using the built-in field codes and switches

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Field Codes.
  5. Click Options.
  6. Select the \O() switch, then click Add to Field.
  7. In the Field codes: EQ Instructions box, type D,<macron_code> between the parentheses.
    The <macron_code> is the key combination you tested earlier to see if it worked — either Alt+0175 on the numeric keypad, or 00af followed by Alt+x. Make sure you also insert the comma between the D and the macron.
  8. Click OK to close the Field Options dialog box.
  9. Click OK again to close the Field dialog box.

Your letter with its macron should look like that below (I have field shading turned on); change the font if you don’t see the macron:

Option 2: Using the built-in field codes and Equation Editor

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Equation Editor.
  5. A text box is added to the document, along with a floating Equation toolbar.
  6. Click the Overbar icon, then the icon for the bar.
  7. Type the letter D in the text box.
  8. Close the Equation toolbar, then click away from the text box.

You should see something like this:

Option 3: Create your own field

  1. Press Ctrl+F9 to insert an empty field.
  2. Type EQ<space>\O (D,<macron_code>) between the curly brackets of the field.
  3. Right-click on the field, then select Toggle Field Codes to show the result:


  • Quick and relatively easy


  • Some fonts, such as Calibri (Body), do not display the macron. If you don’t see the macron over the letter, try changing the font — Arial, Times New Roman (TNR), Courier New all work; however, TNR puts the macron very close to the top of the D, making it hard to read. You’ll need to experiment with fonts.
  • You need to know how to create a macron using the keyboard.
  • You should have a basic understanding of field codes and switches.

Method 3: Create a box around the letter showing only the top border

  1. Go to the Insert tab > Text group, then click Quick Parts. (Word 2003: Insert > Field)
  2. Select Field.
  3. Scroll down the list of Field names and select Eq.
  4. Click Field Codes.
  5. Click Options.
  6. Select the \X() switch, then click Add to Field.
  7. In the Field codes: EQ Instructions box, type D between the parentheses.
  8. Next, type a space after the X followed by \to (for ‘top border’) then another space.
  9. Click OK to close the Field Options dialog box.
  10. Click OK again to close the Field dialog box.

Your letter with its macron should look like that below; change the font if you don’t see the macron:


  • Quick and relatively easy


  • You end up with a large space after the letter so if it’s to be part of a word, it will look strange
  • You get a longer line over the letter.
  • You should have a basic understanding of field codes and switches.

Method 4: Cheat!

Seriously. Sometimes we can overthink stuff, and if it’s a one-off and you’re limited for time, using a workaround may be your best option.

  1. Either create a graphic of what you want using graphics software, or take a screen capture of the full equation then crop it to show just what you want.
  2. Insert the graphic into the document.


  • Quick and easy if you know how to use graphics and/or screen capture software
  • Useful if you only have to do a few


  • Can’t be edited easily if you need to change the letter in the graphic — you may have to create a new graphic or screen shot

See also:

[Links last checked September 2018]


  1. Thanks so much… tutorial was very helpful.

  2. Thank you! Very helpful :-)

  3. Thank you very much. This tutorial has been very helpful to me. After looking for a solution for more than an hour, I finally got it hear. Big up!!

  4. Thanks so much! Yours was THE ONLY tutorial that helped me figure out how to type the x-bar for the “mean”. Thanks again!

  5. Using the combining overline is much easier:
    Insert > Symbol
    Go down to Unicode character code 0305 (in the “Combining Diacritical Marks” subset). Wherever you insert combining characters, it will combine with the previous character.


  6. Wow! Thanks for those links, JCB. I didn’t know you could do that — it’s what I wanted all along, but had to use other cludgy approaches to achieve.


  7. The first method about how to place a bar over a letter (a versal) is excellent, also in microsoft XP, when I use word. – However, when I change the document into html, both the bar and the letter under it will disappear. – Anyone who knows how to place a bar over a letter in thml, or how to retain a bar when a word document is changed into the html format?


  8. Hi Max

    That Wikipedia article on macrons has a list of the various HTML entities to use to create one (long, short, medium as well as over or under): http://en.wikipedia.org/wiki/Macron (it in the table near the bottom of the page).


  9. THANKS!

  10. Thanks a million – on my 2011 mac word – I finally found the equation option under “document elements” – after that it was just as you described.

  11. There is an even better way to get a bar over a letter! All you have to do is type in $\bar{D}$ to have it reproduce a D with a bar over it! Of course this can only be done in LaTeX editors, something that Microsoft Word could never hold a light to…

  12. Yes, this tip has helped me!

  13. thanks dude

  14. excellent 1000 times thank you

  15. I think I was the first who asked about how to make a bar above a letter, and in particular, a bar above a capital. – While the techniques I learned were perfect as long as I wrote in Word, in the same moment I posted my text (and it was transformed to html), both the bar and the letter totally disappeared. – I have understood that the only reasonable solution is to abstain from special symbols and instead write “not-A”.

  16. Hi Max

    Back in Sept 29, 2011, I answered your comment on this post re HTML by referring you to the Wikipedia article that tells you what HTML entity to use. Didn’t that work?


  17. I have used so much time for this problem, and what is more serious, I have had to waste as much time for two other people, and whatever recommendation I apply, the same error will return. Greetings. Max

  18. I searched this tutorial to further do some work, like have one equation and there is one bar below the equation. Now i want to add text below the bar. How to do that?

  19. I loved your method one. I tried the 2nd one first, because someone else had described it – after 2 days of searching – the second method seemed to keep the over bar too high. The first method was so easy and I could save it.

    You are a true blessing. I will direct others to this site as I saw many people looking to do this, especially nurses and therapists in the health field.

    Thanks so much again.

  20. The easiest method is to use the feature that defines the spacing between 2 characters (in font, under spacing). You can make any 2 characters (or more) overlap. So you can make a superscript bar overlap with any letter.

  21. There is a much easier way. In equation editor, type “D” followed by “\bar” and hit the space bar. Voila. There are many such shortcuts that make it easy and intuitive to enter equations. To see them, in Word go to File->options->proofing->auto correction options ->math autocorrect.

  22. To make there’s no confusion, enter “D\bar” and hit space bar twice. Also, you can get into equation editor easily by holding down Alt while pressing =

  23. Thanks, I struggled alot. You helped me

  24. It’s a very good suggestion. Thanks a lot for helping.

  25. Thank You mate!

  26. Many thanks

  27. Thanks so much ik who to do it now

  28. thanku sir it really helps so much

  29. “Method 1: Disadvantage: You may not be able to change the font (I wasn’t able to change it from Cambria Math)”

    I realized you could change the font after you select your “overbarred” letter and click on “Normal Text” in the “Equation Tools” tab.
    So that’s one less disadvantage for Method 1, and thanks for sharing this!

  30. Thanks, Quikson!

  31. great thanks very much

  32. Thank you very much!

  33. thank you!

  34. Thank you very much!

  35. Awesome! Thanks so much! You´re the guy!

  36. excellent help. Thanks

  37. thank you! it really helps.

  38. thanks.

  39. Hi,
    I knew about the insert equation. However, I need to add the bar accent on the heading 1 (on c letter) title of my thesis. Tried the equation but the letter with bar accent does not appear in my table of content. The field method suggested here however appeared. Many many many thanks.

  40. thanks!

  41. all of these ways are good but not so easy and clean! i Found a way that is usable without need to insert any block:
    there is a character with 0305 code. this character is upper line. you can use it by holding alt key down and type this code with num pad to insert this character.

  42. Correction: Code of upperline character is 773 in dec and 0305 is in hex mode!

  43. BRILLIANT!!!! Thank you so much! Just started a STATS class & this is so helpful when taking notes!!! So far that’s all I’ve needed it for but it may come in handy again so I’m bookmarking this page. THANK YOU!

  44. Type in a letter that you want to adorn with a bar. Say, for example, x.
    Next, go to Insert -> Symbol, drop down to “More Symbols”, and in the window that pops up, make sure you have selected “Arial Unicode MS” as the font. In the bottom right, you’ll see a text area and a drop down. To the right of the text area labeled “Character code:” type in 0305. That’s the code for a bar-on-top-of-a-letter. Going further right, there’s a drop down that says “from:” and you’ll want to make sure that you see “Unicode (hex)” selected in that box. Click “Insert”.

  45. Thanks, G Mathew!! Further note, select the Unicode (hex) option BEFORE you type the 0305 character code. If you don’t, the character code will change after you select Unicode (hex) and you’ll have to type it in again.

  46. Thanks. I’m writing a paper for linguisitics. I used Method 2, option 3. I was able to change the font size of the macron to TNR 14, while my letter remained TNR 12. No unwanted italics, Perfect spacing. Very easy to do and to remember for future papers–but I bookmarked this page just in case I need a refresher in the future.

  47. I found one more method. Type the desired letter, go to Insert -> Shapes – > Line -> Draw over desired letter.

    So easy isn’t it :)

  48. thanks, its very usefull,
    im looking for this in equation but i didn’t find that
    thank you so much

  49. Thanks for the newsletter and the comments. As unproductive as it is, I liked best the comment from Matthew Tiger (Nov. 2011), but as many, am doomed to MS Word at work. That’s why also I have use of the tips given here.

    But I use http://www.codecogs.com/latex/eqneditor.php for equation typesetting with 200 dpi and white background, then I copy the picture from the browser to word as bitmap, reduce to 50% and via VBA put the latex code as “Alt Text” under “Format Picture” – for later editing.

    This method is also possible, however not nice for inline equations and symbols. At least I never get the symbol nicely vertically aligned if inserted as a picture.

    My attitude: If it should look nice and be precise, use LaTeX. If you are obliged to use Word for technical text, don’t use much time on layout.

    Thanks again.

  50. I know this is old, but it still comes up on google. The easiest way is to press ctrl+= to bring up an equation, then type D\bar then press spacebar twice, then press the right arrow to leave the equation editor.

  51. Thank you for that ! I am dying to type phonetically and it kills to not be able to…

  52. Unicode 0305 method is very easy.

  53. Thank you for your research! You’re awesome!

  54. In MS Word, an alternative is to type the letter requiring a macron, e.g. “x”, then Insert → Symbol… Symbols tab; scroll down to the “Combining Diacritical Marks” portion, click on the box with the character “Combining Overline” (macron), click Insert, and Close. You’ll get this: “x̅”. The shortcut is Alt+0305 but I find that this is font-dependent and doesn’t always work. If you do find that it works in a font, sometimes using Cut & Paste will put it in your document the way you want it.

  55. Thank you Patrick! That worked well, but as you say it’s very font-dependent. It looks good in Arial, Cambria, and others, but not so good in Calibri, Verdana, etc., and looks horrid in Courier New. I couldn’t get it to work with the Alt+0305 shortcut — all that did was add a small pipe character after the letter (holding down the Alt key while pressing 0305 on the numeric keypad) or put my doc into Print Preview mode (pressing and releasing Alt then typing 0305 on the numeric keypad).


  56. You can also use Word’s ADVANCE field code for this sort of requirement.

    For the macron-D, type “D”, then Insert > Quick Parts > Field… and choose the Advance field. In the dialog, set an Offset text left amount (6.5 worked well for Candara 11pt, but adjust as needed) and an Offset text up amount (I used 6pt). Type a suitable bar (I used Alt-0150 to get an en dash), then add another Advance field code to reset the vertical position. If you reveal the field codes (Alt-F9), it will look something like this:
    D{ ADVANCE \l 6.5 \u 6 }–{ ADVANCE \d 6 }

    To make this more readily available as you type, select the completed combined character with the field codes, and use Insert > Quick Parts > AutoText > Save Selection to AutoText Gallery. If you give it a memorable name like “dmac”, a pop-up will appear when you type “dmac” to let you press Enter to insert it (you can also press F3).

    Note that like other methods, raising the baseline will cause the paragraph’s line spacing to increase if Format Paragraph > Line spacing is set to “single”. You can avoid the problem by setting specific line spacing for the paragraph style (i.e. “Exactly 12pt”).

  57. Thanks this article is great. However when I have lot of text to type with accent, I use math autocorrect option. It saves lot of time and are easy just type a\overbar and then space. This works really fast. For more detail please check https://www.youtube.com/watch?v=3_h7ukThU_4

  58. Hi Anik8G

    This is just BRILLIANT!!! I’ll add it to the body of the blog post. Thank you so much for sharing this trick.


  59. Method 1 worked great for showing a Bar over a number to indicate it repeats. Thanks

  60. Just change the language, for example convert English to Maori.

  61. In Office 365 you can simply draw it, and Word will convert it to text.

    Select Draw > Ink to Math

    If you need more space to write, drag one of the bottom corners down. If you need a larger preview window, drag one of the top corners up.

    Draw the letter(s) or number(s) you want with the bar over them. Select Insert.

    This is particularly useful for geometry line segments with two letters. The bar will go over both letters with no gap in between.

    (You can also get to the same feature through Insert > Symbols > Equation > Ink Equation. It’s just a longer method to get to the same place, but I included it here because some people may remember “draw” and others might remember “equation.”)

  62. Thanks for sharing, Trena! I had the Draw tab turned off because I don’t use a touch surface. However, after reading your solution I turned it back on (File > Options > Customize Ribbon) and tried it by drawing with the mouse, and it worked beautifully!


  63. Thanks a lot!

  64. Thank you!

  65. can you guys decode this Ⅎ̅ . its like letter E if you flip this

  66. There are some 145,000 Unicode characters, so it could be anything. Best place to start would be Wikipedia article that lists more than 1000: https://en.wikipedia.org/wiki/List_of_Unicode_characters

    If it’s not there, then check the references at the bottom of that Wikipedia page, and/or search the internet for a complete list of characters.


  67. You can change the font from Calibri math by selecting abc normal text in the tools section of the Design tab.

  68. Amazing stuff

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: