Cellwise Start free

Excel guide · 5 min read

How to add borders in Excel

Quick answerSelect the cells, then go to Home > Borders (the arrow next to the border button in the Font group) and pick a style: All Borders draws every line, Outside Borders boxes the range and Thick Outside Borders gives a heavier box. Ctrl+Shift+& adds an outline border from the keyboard and Ctrl+Shift+_ removes it. For a custom color, thickness or diagonal line, choose More Borders.

Sample data

Every result on this page was calculated from this sheet by the same spreadsheet engine the Cellwise app uses.

RowABC
1MonthCategoryAmount
2JanRent2400
3JanUtilities315
4JanSupplies188
5FebRent2400
6FebUtilities342
7FebSoftware560
8MarRent2400
9MarUtilities298
10Total8903

Download this sheet as an Excel practice file (.xlsx)

Borders vs gridlines

The grey grid you see on screen is gridlines. They don't print by default and they vanish when you fill cells with a color. Borders are formatting you add on purpose: they print, they show over fills and they stay when gridlines are turned off. If you only want lines on a printout of a whole sheet, printing gridlines is quicker. If you want specific lines, such as a box around a table or a line above a total, use borders.

Method 1: the Borders menu

The sample is a list of office expenses. A typical finish: All Borders on the data, a heavier box around the whole table and an accounting-style line under the total.

  1. Select A1:C9 and choose Home > Borders arrow > All Borders.
  2. Select A1:C10 and choose Thick Outside Borders. It replaces only the outer edge.
  3. Select A10:C10 and choose Top and Double Bottom Border, the classic look for a total row.
  4. To remove lines, select the cells and choose No Border.

Why does clicking the Borders button add the wrong border?

The button itself repeats the last style you used; only the arrow opens the menu. Click the arrow, or use Alt+H, B on Windows to open the menu from the keyboard.

Method 2: custom color, thickness and diagonals

More Borders at the bottom of the menu opens the Border tab of Format Cells (Ctrl+1 gets you there too). The order matters: pick the line first, then say where it goes.

  1. Select the cells and choose Borders arrow > More Borders.
  2. Under Line, pick a Style (a thicker line for emphasis) and a Color.
  3. Click Outline, Inside or both under Presets, or click individual edges in the preview. The two diagonal buttons draw a line corner to corner, used to strike out an unused cell.
  4. Check the preview, then click OK. If an existing border should change width, re-click its button after choosing the new style.

Method 3: draw borders with the mouse

For irregular layouts, such as a form, drawing is faster than selecting. Under Borders arrow, pick Line Color and Line Style first, then Draw Border (outer edges of whatever you drag over) or Draw Border Grid (every line). The pointer turns into a pencil. Erase Border turns it into an eraser for removing lines. Press Esc, or click the same option again, when you're done.

Keyboard shortcuts

On Windows, Ctrl+Shift+& draws an outline around the selection and Ctrl+Shift+_ removes the outline. On a Mac, use Cmd+Option+0 and Cmd+Option+Hyphen, and Cmd+Option+arrow keys add a single edge. For anything else, Alt+H, B opens the Borders menu and the underlined letters pick a style. See the formatting shortcuts for the full list.

Add a line every time the month changes

In a long list sorted by month, a line between months makes groups easy to read. Drawing them by hand breaks as soon as rows are added. A conditional formatting rule draws them for you: the bottom border appears wherever the month in the next row is different.

  1. Select A2:C9.
  2. Go to Home > Conditional Formatting > New Rule > Use a formula to determine which cells to format.
  3. Type =$A2<>$A3. The $ locks the column so every cell in the row checks the month; the row stays relative.
  4. Click Format, go to the Border tab, pick a line and click the bottom edge, then OK twice.
=A4<>A5

Result: TRUE

TRUE: row 4 is the last Jan row and row 5 starts Feb, so row 4 gets the line. For row 2 (Jan above Jan) the same test is FALSE and no line is drawn.

Why can't I pick a thick line in the rule?

Conditional formatting only offers the thinner line styles. Use a darker color to make the line stand out.

Why borders disappear or end up in the wrong place

Borders belong to cells, so they travel with them. Sort the list and the line you drew under the last row moves to wherever that row lands. Paste a block over bordered cells and the pasted formatting replaces the borders; Paste Special > All except borders (Ctrl+Alt+V, then X) pastes everything else.

Neighbouring cells share an edge. Box B1:C5 and D1:D5 shows a left border, because it's the same line. If two styles meet on one edge, the last one applied wins. A right border on a range only goes on its outer right edge, not inside it.

Dotted borders print as solid lines by design, and a box split by a page break only closes on one page unless you add an inside border across the break. For tables that grow and get sorted, Insert > Table (Ctrl+T) is the maintenance-free option: the table style draws the lines and keeps them right as rows are added.

=SUM(C2:C9)

Result: 8903

8903: the total that sits above the double line. If you sort the data with the total inside the selection, both the total and its border move into the middle of the list, so leave the total row out when you sort.

Common mistakes

Clicking the Borders button instead of the arrow

The button repeats the last border used. Open the arrow to choose.

Drawing separator lines by hand in a list that gets sorted

Use a conditional formatting rule like =$A2<>$A3 so the lines follow the data.

Expecting gridlines to print like borders

Gridlines don't print unless you turn on Page Layout > Gridlines > Print. Add borders for specific lines.

Choosing the position before the line style in More Borders

Pick Style and Color first, then click the edges, or the old style is used.

FAQ

What is the shortcut for borders in Excel?

Ctrl+Shift+& adds an outline border and Ctrl+Shift+_ removes it on Windows. Alt+H, B opens the full Borders menu. On a Mac, Cmd+Option+0 adds an outline.

How do I add all borders in Excel?

Select the range, then Home > Borders arrow > All Borders. Every cell gets a line on all four sides.

How do I make borders thicker in Excel?

Choose Thick Outside Borders from the menu, or More Borders, pick a thicker style under Line and click the edges again.

How do I remove borders in Excel?

Select the cells and choose Home > Borders arrow > No Border, or press Ctrl+Shift+_ to remove the outline. Erase Border removes single lines with the mouse.

Why are my borders not printing?

Check you added borders, not just gridlines, and that the cells are inside the print area. Very light colors can also fade out on paper.

Functions used

Related guides

Updated