The simplest way to add a line in Excel

A line in Excel is a shape you draw on top of your spreadsheet — it does not go into a cell or affect your data. To add one, click the Insert tab at the top of the screen, then find Shapes in the ribbon. Click the dropdown arrow next to Shapes, scroll down to the Lines section, and click the straight line icon. Your cursor will change to a crosshair.

Now click where you want the line to start, hold down your mouse button, and drag to where you want it to end. Release the mouse. The line appears on your spreadsheet. You can move it by clicking and dragging, or delete it by clicking it once and pressing Delete.

If you want the line to be perfectly horizontal or vertical, hold down the Shift key while you drag. This locks the angle and prevents accidental tilts. If you want to change the line's color, thickness, or style, right-click it and choose Format Shape. A panel opens on the right side where you can adjust the appearance.

Key Takeaways

  • Lines in Excel are shapes drawn on top of your spreadsheet and do not affect the data in your cells.
  • You add a line by going to Insert, clicking Shapes, selecting a line from the Lines section, and dragging on your spreadsheet.
  • Hold Shift while dragging to make the line perfectly horizontal, vertical, or at a 45-degree angle.
  • Right-click a line and choose Format Shape to change its color, thickness, style, or other appearance options.

When to use lines instead of cell borders

Excel has two ways to create lines on a spreadsheet: you can draw a shape line (what we just covered), or you can add borders to cells. A border goes around the edge of a cell and moves with your data if you add or delete rows. A shape line sits on top of the spreadsheet and stays in the same place no matter what you do to your cells.

Use a shape line when you want to highlight or separate sections of your spreadsheet visually without affecting the cells themselves. For example, you might draw a line to divide your budget into sections, or to point out a total row. Use cell borders when you want the lines to stay attached to specific cells — for instance, to box in a table or highlight a range of data that might move around.

Moving and resizing a line you have drawn

Once you have drawn a line, you can adjust it. Click the line once to select it — small squares appear at each end. To move the entire line without changing its length or angle, click anywhere on the line itself (not on the squares) and drag it to a new location.

To change the length or angle, click and drag one of the squares at either end. Drag an end square to make the line longer or shorter, or to rotate it. If you want to move just one end while keeping the other fixed, drag only that end's square. If you accidentally move it the wrong way, press Ctrl+Z to undo.

Changing line color, thickness, and style

Right-click the line and select Format Shape. On the right side of the screen, a panel opens with formatting options. Look for the Line section — you will see options for color, width (thickness), and dash type (solid, dashed, dotted, and so on).

To change the color, click the color dropdown and choose from the palette. To change thickness, find the Width field and type a number or use the up and down arrows. Thicker lines are measured in points — 1 point is very thin, and 4 or 5 points is noticeably thick. To change the style from solid to dashed or dotted, click the Dash type dropdown and select the pattern you want.

If you do not see the Format Shape panel, make sure the line is selected (click it once), then right-click it again and choose Format Shape. The panel should appear on the right side of your screen.

Aligning multiple lines

If you have drawn more than one line and want them to line up perfectly, select all of them at once. Click the first line, then hold Ctrl and click each additional line. All selected lines will have selection squares around them.

Now right-click one of the selected lines and look for Align options. You can choose to align them to the left, right, top, bottom, or center. You can also distribute them evenly across the space they occupy. This is useful when you are creating a grid or a structured visual layout on your spreadsheet.

Deleting a line you no longer need

Click the line once to select it, then press the Delete key. The line disappears when ready. If you delete it by mistake, press Ctrl+Z to undo and bring it back.

If you have trouble selecting the line — for instance, if it is very thin or hidden behind other shapes — click somewhere empty on the spreadsheet first to deselect everything, then try clicking the line again. If it still will not select, try clicking very close to the middle of the line rather than at the ends.

Frequently Asked Questions

Can I make a curved line in Excel?

Yes. Go to Insert, click Shapes, and look in the Lines section for Curve. Click to set points along the path you want the curve to follow, then double-click to finish. You can also use the Freeform tool to draw by hand, though it is harder to control precisely.

How do I make a line go behind my data instead of on top of it?

Right-click the line, choose Wrap Text or Send to Back (the exact option depends on your Excel version). This moves the line behind the cells so your data appears on top. To bring it back to the front, right-click and choose Bring to Front.

What if my line keeps snapping to the grid and I want to place it somewhere else?

Excel has a snap-to-grid feature that makes shapes align to cell edges. To turn it off temporarily, hold Alt while dragging the line. This lets you place it anywhere. To turn off snap-to-grid permanently, go to the View tab and uncheck Gridlines, or go to File, Options, Advanced, and uncheck Snap to Grid.

Can I copy a line I have already formatted?

Yes. Click the line to select it, press Ctrl+C to copy, then press Ctrl+V to paste. A duplicate appears on your spreadsheet, usually slightly offset from the original. You can then move it to where you need it. This is faster than drawing and formatting a new line from scratch.