Excel Borders: How to Add, Change, and Remove Cell Lines

How-to basics · Updated November 21, 2026

To add a border in an Excel spreadsheet, select the cell or range, then choose Home > Borders in the Font group and pick a border style, such as All Borders or Outside Borders. Borders are formatting attached to cells, so they can be customized, copied, removed, and printed; they are different from the faint worksheet gridlines.

How to add a border to cells

In Excel for Microsoft 365 on Windows, select the cell or cells you want to format. On the Home tab, find the Font group and open the arrow beside the Borders button. Choose the edge or combination you need. The main button usually repeats the most recently used border, while its arrow opens the choices.

Common options include Bottom Border, Top Border, Left Border, Right Border, All Borders, Outside Borders, and Thick Outside Borders. Their names describe which cell edges Excel formats:

  • All Borders draws lines around every cell in the selection, including the internal lines between adjacent cells.
  • Outside Borders outlines the outside edge of the selected range without adding lines between its cells.
  • Bottom Border adds a line along the bottom edge of each selected cell. It is often used to underline a heading or mark the end of a section.
  • No Border removes borders from the selected cells.

For example, selecting A1:D8 and choosing All Borders creates a boxed grid of 32 cells. Choosing Outside Borders for the same selection instead outlines the four-cell-wide, eight-cell-tall range as one block. If you select only one cell, All Borders and Outside Borders may look much the same because there are no internal cell edges to show.

On Windows, you can open the Borders menu with the ribbon key sequence Alt, H, B: press the keys in order rather than all at once, then choose an option. Keyboard access can vary with ribbon configuration and localization. Excel for Mac has a similar Borders control on Home, but the Windows Alt key-tip sequence is not the Mac shortcut; use the ribbon or its Mac keyboard navigation instead.

Choose the right border type

The best border depends on what the worksheet needs to communicate. A border should clarify structure, not compete with the information. A light outline can distinguish a small input area, while a heavier bottom edge can signal a total. Using a dark line around every cell in a large data table may make the sheet harder to scan.

  • Use a thin bottom border below column headings to separate labels from the rows of data.
  • Use an outside border around a compact summary or form so readers can see its boundaries.
  • Use All Borders when individual cells need clear separation, such as in a small schedule or printable form.
  • Use a top or double bottom border to distinguish a total row, if that convention suits the workbook.

For a data range that will be sorted, filtered, or expanded, consider formatting it as an Excel table with Home > Format as Table. Table styles can apply consistent visual formatting and commonly include banded rows. A table is not the same thing as adding borders: its style controls a broader set of appearance options, and you can still adjust cell borders where needed. Avoid relying on color alone to convey an important distinction, since a worksheet may be viewed or printed in grayscale.

Change border color and line style

Excel lets you set a line color and weight or style before applying a border. Select the target cells, open the arrow beside Home > Borders, and choose the available line color or line style options in that menu. Then choose the edge or border arrangement to apply. Menu labels and the visible choices can vary slightly with the Excel update and window size.

You can also open Format Cells: select cells and press Ctrl+1 on Windows, then choose the Border tab. This dialog provides controls for line style, color, and the edges to format. Select a line style and color first, then use the presets or the border preview to turn particular edges on or off. The preview is useful when you need a custom arrangement, such as a top and bottom line but no left or right outline. Choose OK to apply it.

Excel for Mac also has a Format Cells dialog, typically opened with Command+1, and a Border tab for configuring edges. If a shortcut is intercepted by the operating system or differs on a keyboard layout, open Format Cells from the ribbon or cell context options. On both platforms, selecting a border edge in the dialog is separate from selecting the range: confirm the correct cells are selected before applying the format.

Line color and style apply to the border edges you choose, not to the cell fill. If a border appears missing, check whether its color is too close to the cell background, whether a different border style was selected, or whether the relevant edge was actually enabled in the preview.

Borders versus worksheet gridlines

Gridlines are the faint visual guides that divide cells across a worksheet. They are not cell formatting, and they generally disappear from view when you apply a fill color to cells. Borders, by contrast, are deliberate formatting applied to selected cell edges. They can have chosen colors and line styles, and they stay associated with those cells when the worksheet gridline display is turned off.

This distinction matters when a sheet looks lined on screen but prints without the lines. The visible lines may be gridlines rather than borders. To add permanent, controllable lines, select the cells and apply borders. To hide the worksheet gridlines on screen, use the View tab and clear the Gridlines checkbox. That changes the worksheet display, not the borders already applied to cells.

Gridline printing has its own setting. On Windows, open Page Layout and find Sheet Options, then use the Print checkbox under Gridlines if you want worksheet gridlines included in printed output. This setting does not turn cell borders on or off. Borders are cell formatting and are normally included in print output, although the result still depends on print layout, scaling, and whether the border is visible against the page. Use Print Preview to check the result.

Apply borders to ranges, tables, and selected edges

A border choice applies to every selected cell in the manner indicated by the option. For a range, All Borders adds lines to the perimeter and internal cell boundaries; Outside Borders adds a perimeter around the selection. To outline several separate, nonadjacent areas, hold Ctrl while selecting each area on Windows, then apply the border. On Mac, use Command while selecting separate areas. Be careful with large selections: an option that adds internal lines can create a dense grid.

To format only one edge of a range, use the relevant edge command or the Format Cells Border tab. For example, select B2:F2 and apply Bottom Border to create a line below a row of headings. If you instead select the entire data block and apply Bottom Border, Excel adds a bottom edge to each selected cell, which can create horizontal lines between rows as well as along the bottom. Selecting the intended cells is therefore as important as choosing the border command.

When a range is already an Excel table, table styles may supply borders or other visual effects. Changing a table style can affect the appearance of the whole table, whereas a manually applied border targets selected cells. If a style appears to override or obscure a manual choice, inspect the table style and the cell formatting rather than repeatedly adding more borders. Conditional formatting can also change cell appearance when a rule is true; check Home > Conditional Formatting > Manage Rules if a border or other format changes unexpectedly.

Copy, edit, and remove borders

To change a border, select the same cells and apply the replacement edge, color, or line style. Applying No Border removes the borders from the selected cells; it does not clear their values, formulas, fills, or number formats. If only some edges should go, use the Format Cells Border tab to switch off those edges while preserving the others.

You can copy cell formatting along with other cell content. Select a formatted cell, choose Home > Format Painter, and drag over the destination cells. Format Painter may copy more than the border, including fill, font, and number format, so inspect the destination if you only wanted one aspect changed. Another approach is to copy the source, select the destination, then choose Home > Paste > Paste Special > Formats, which copies formatting without replacing the destination values.

If an unwanted line remains, first determine whether it is a border or a gridline. Turn off gridlines temporarily from View to help distinguish them: a line that remains around the formatted cells is likely a border. Then select the affected cells and apply No Border. Avoid using Home > Clear > Clear All unless you intend to remove other cell contents and formatting as well.

Make borders print clearly

Borders can look different on paper than they do at normal screen zoom. A very light line may be difficult to see, and scaling a large sheet to fit one page can shrink both text and lines. Use File > Print to inspect Print Preview, check the selected printer and page orientation, and confirm that the relevant cells fall within the print area. If the sheet is too small, consider changing the page orientation or print scaling rather than making every border heavier.

When a printed sheet has lines between some cells but not others, inspect the border formatting on those cells and the gridline print setting. For a form intended to be completed by hand, deliberate borders are more dependable than relying on gridlines. For a report, a few carefully placed outlines and separators may print more cleanly than a heavy border around every cell.

Common border problems

A border may seem not to apply for several reasons. The wrong cells may be selected, the chosen command may affect only the outside edge, or the line color may blend into the fill. Check the selection first, then use the Borders menu or Format Cells preview to verify which edges are enabled. If cells are protected, editing their formatting may be restricted by worksheet protection; ask the workbook owner or review the protection settings rather than assuming the border command is broken.

Another frequent confusion is expecting a border to move independently of a cell. Borders belong to cell formatting, so moving or copying cells can move or copy their borders too. Also, changing a row height or column width changes the geometry of the cells and can alter how the border looks on screen, but it does not convert the border into a drawn shape. If you need a decorative line independent of cell edges, an inserted shape is a different option, though it may require separate positioning and can be less convenient to maintain in a changing worksheet.

Frequently Asked Questions

How do I put a border around a whole table in Excel?
Select the table cells, open Home > Borders, and choose Outside Borders. Choose All Borders instead if you also want lines between every cell. For a formatted Excel table, a table style may already provide an outline or other visual formatting.

How do I add a line under a heading?
Select the heading cell or heading range and choose Home > Borders > Bottom Border. This adds a cell-edge border below the selection without inserting a new row.

Why do my Excel borders not show when I print?
Check Print Preview, the selected print area, the border color and weight, and the page scaling. If you are relying on worksheet gridlines rather than borders, check Page Layout > Sheet Options > Gridlines > Print; gridline printing is controlled separately.

How do I remove borders without deleting the cell contents?
Select the cells and choose Home > Borders > No Border. This removes cell borders but leaves the values and other formatting, such as fills and number formats, in place.

Can I change border color in Excel?
Yes. Select the cells, choose a line color from the Borders menu or use Format Cells > Border to choose a color and apply it to specific edges. Check that the chosen color contrasts with the cell fill and remains clear in print.

Related

Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.

More in How-to basics

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.