How to Put a Line Over a Letter in Word

A line over a letter shows up in statistics (x̄ for the mean), in logic and engineering (Ā for “not A”), in repeating decimals, and in languages that use macrons, like ā in Māori or Latin. Word doesn’t have an “overline” button like it does for underline, but there are several reliable ways to add one. This guide covers the equation editor, special characters, Unicode codes, and a field code for longer text.

Quick answer

The easiest method is the equation editor: press Alt + =, type the letter followed by \bar (for example, x\bar), and press the spacebar. Word displays x̄. For several characters, use \overline instead.

Method 1: Use the equation editor

This works best for math and statistics.

  1. Click where you want the symbol and press Alt + =, or go to Insert > Equation.
  2. Type the letter, then \bar, and press the spacebar. For example, x\bar becomes x̄.
  3. To put a line over more than one character, type \overline(AB) and press the spacebar.
  4. Click outside the equation box to return to regular text.

You can also use the ribbon: on the Equation tab, click Accent and pick the Bar or Overbar option, then type inside the dotted box.

Equations use a math font, so they may look slightly different from the surrounding text.

Method 2: Add a combining overline with Alt + X

To keep the letter in your normal font, add a combining character after it:

  1. Type the letter, such as A.
  2. Immediately type 0305 (combining overline) or 0304 (combining macron).
  3. Press Alt + X. The code turns into a line above the letter.

Some fonts display combining marks better than others. If the line looks misaligned, try a font like Cambria, Calibri, or Segoe UI.

Method 3: Insert a letter that already has a macron

Vowels with macrons exist as their own characters, which look the cleanest in any font:

Letter Unicode code (type, then Alt + X)
ā / Ā 0101 / 0100
ē / Ē 0113 / 0112
ī / Ī 012B / 012A
ō / Ō 014D / 014C
ū / Ū 016B / 016A

You can also find them under Insert > Symbol > More Symbols, in the Latin Extended-A subset. If you type macrons often for te reo Māori, see how to insert Māori macrons in Word.

Method 4: Use an EQ field code

For a line over a whole word or a few letters in regular text:

  1. Press Ctrl + F9 to insert field braces { }.
  2. Inside them, type EQ \x \to(ABC), replacing ABC with your text.
  3. Press F9 to update the field. The text appears with a line over it.

Press Alt + F9 to switch between the code and the result if you need to edit it. Field codes are an older feature, so the equation editor is usually easier.

Which method should you use?

  • Statistics or math: Equation editor.
  • A single letter in normal text: Combining overline with Alt + X.
  • Vowels in languages like Māori, Latin, or Hawaiian: Precomposed macron characters.
  • Several letters in a sentence: EQ field code or \overline in an equation.

Examples by subject

Statistics

The sample mean is written x̄ (read “x-bar”). Use the equation editor or the combining overline so the symbol stays attached to the letter when text reflows. For a sample proportion, p̂ uses a hat instead: type p\hat in the equation editor and press the spacebar.

Logic and digital electronics

A bar over a variable or expression means NOT, such as Ā or a bar over A + B. For a bar across a whole expression, use \overline(A+B) in the equation editor so one continuous line covers every character.

Repeating decimals

To show that digits repeat, as in 0.3̅ or 0.142857 with a bar over the repeating part, use \overline in an equation around just the repeating digits.

On a Mac

Word for Mac supports the equation editor (Insert > Equation) and Insert > Advanced Symbol. Alt + X isn’t available, but you can type macron vowels with Option + A, then the vowel, when using the ABC Extended keyboard input source.

Related: How to insert symbols and special characters in Word.

Frequently asked questions

How do I type x-bar in Word?

Press Alt + =, type x\bar, and press the spacebar.

Is there an overline font effect?

No. Word has underline and strikethrough effects but no built-in overline effect, which is why these workarounds are needed.

Can I do this in Google Docs?

Yes. Google Docs has an equation editor under Insert > Equation that supports \bar and \overline, and you can insert macron letters from Insert > Special characters.

Will the line print correctly?

Yes. All of these methods print and export to PDF the same way they appear on screen.