How to Make Lines in Excel: The Complete 2026 Guide to Borders, Gridlines, Sparklines, and Cell Dividers
Learn how to make lines in Excel: add borders, draw cell dividers, insert sparklines, control gridlines, and format tables for clean spreadsheets.

Learning how to make lines in Excel is one of those small skills that completely transforms the look of a spreadsheet. Whether you are building a budget, a class schedule, or a quarterly report that will sit next to a vlookup excel reference table, the difference between a polished workbook and a chaotic one usually comes down to deliberate use of borders, gridlines, and divider lines. This guide walks through every method Excel offers in 2026, from one-click borders to custom diagonal lines and sparklines that draw mini trend lines inside a single cell.
Excel actually supports several distinct kinds of lines, and treating them as interchangeable is the most common mistake new users make. Gridlines are the faint gray lines that separate every cell by default, but they only show on screen unless you tell Excel to print them. Borders are real, formatted lines that you draw onto specific cells. Sparklines are micro charts. Underlines apply to text inside a cell. Shapes let you draw freehand connector lines on top of a worksheet. Each behaves differently when you copy, print, or export.
Most readers landing here want one of three things: they need to add visible separators between rows and columns, they need to remove the default gridlines for a cleaner finished look, or they need to draw a custom diagonal line through a header cell to label two values at once. We will cover all three plus several advanced techniques like conditional border formatting, repeating header underlines on every printed page, and using sparklines to embed trend lines without leaving the worksheet.
The good news is that none of these techniques require a macro, an add-in, or a paid subscription. Every method described here works in Excel 2019, 2021, Microsoft 365, Excel for the web, and Excel for Mac, with only minor menu-position differences between platforms. The shortcuts work identically on Windows and Mac except for the Cmd versus Ctrl swap, and once you internalize the Borders flyout in the Home tab you will be styling tables in seconds.
Before we dive in, it helps to understand why this matters beyond aesthetics. A spreadsheet without clear visual structure forces the reader's eye to do extra work, and studies of dashboard usability consistently show that even thin one-pixel rules between sections reduce comprehension time by double-digit percentages. When you are presenting numbers to a manager, a client, or a teacher, the lines you draw quite literally guide them through your logic. Treat lines as a communication tool, not decoration.
Throughout this guide we will use a sample sales workbook with regions, months, and totals so you can follow along. If you want to test your knowledge as you go, try our practice quizzes linked at the bottom, including the full Excel certification practice test that covers formatting, formulas, and functions in a single timed assessment.
By the end of this article you will know how to add, remove, recolor, thicken, dash, diagonal, and conditionally apply lines to any cell or range. You will also know which method to choose for which situation, which is what separates spreadsheets that look amateur from ones that look professional.
Lines in Excel by the Numbers

Five Ways to Add Lines in Excel
Apply a Border Preset
Use the Format Cells Dialog
Draw Borders Manually
Insert a Shape Line
Add a Sparkline
To make smart choices about lines you need to understand the three layers Excel renders on top of each other. The bottom layer is gridlines, the faint default lines that show every cell boundary. The middle layer is borders, which belong to cells and travel with them when you sort or filter. The top layer is shapes, which float independently. Knowing which layer you are working on prevents the most frustrating bug in spreadsheet formatting, which is when a line refuses to disappear no matter how many times you click Remove Border.
Gridlines are controlled from the View tab with the Gridlines checkbox. Turning them off across the entire sheet gives reports a clean, magazine-like finish, and it is almost always the right move before sharing a polished workbook. If you want gridlines hidden on screen but visible when printed, go to Page Layout and check Print under Gridlines. This pair of settings is independent, which surprises a lot of users who think the View toggle controls printing too.
Borders are where most of the action happens. When you select a range and apply All Borders, Excel adds a thin black line to every internal and external edge of every selected cell. The line lives with the cell, so if you cut and paste the range elsewhere the borders move with it. This makes borders the right choice whenever the lines are part of the data, like the rule between a header row and the first data row, or the heavy outline around a totals section that should always sit just below the values being summed.
The Format Cells dialog, opened with Ctrl+1, is the power user's tool. Inside the Border tab you can pick a line style first, then a color, and only then click the preview to apply that style to a specific edge. The order matters because Excel applies whatever style is currently selected, so if you pick the edges first and the style second nothing happens. Mac users sometimes miss this because the dialog layout differs slightly, but the logic is identical.
Shape lines are perfect when you need a connector that crosses many cells at an angle, like an arrow pointing from a callout box to a specific data point. Because shapes ignore cell boundaries you can draw them anywhere, but they also ignore sorting and filtering, so they will not follow rows around if your table changes. Use shapes for annotations that describe the worksheet, not for structural lines that should belong to the data itself.
Sparklines are technically a kind of line too, even though they are charts. A line sparkline draws a tiny trend line entirely within one cell, with optional markers for high and low points. Once you understand them you will find dozens of places to use sparklines instead of standalone charts. Many users build dashboards where every row has its own sparkline trend next to current values and percentage changes, all in a compact width that fits on one screen.
The last concept worth internalizing is that lines respond to row height and column width. A diagonal border drawn through a tall narrow cell looks almost vertical, while the same border drawn through a short wide cell looks almost horizontal. If you plan to print at a specific size, set your row heights and column widths first, then add borders last, otherwise everything will need adjustment after the layout changes.
Drawing Diagonal, Dashed, and Custom Lines
Diagonal lines are most often used in header cells where one row label and one column label need to share the same corner. Select the cell, press Ctrl+1, go to the Border tab, and click either the upper-left to lower-right or upper-right to lower-left diagonal button in the preview. You can then type both labels into the cell separated by spaces and use Alt+Enter to push the second label onto a new line.
To make the labels sit in opposite corners, increase the row height and column width, then use the Alignment tab to set the first label as top-left and the second as bottom-right. Many learners discover this trick when building schedules that cross days and times, similar to how a vlookup excel lookup table separates row keys from column keys. It is a small touch but instantly signals professional formatting.

Borders vs Gridlines: Which Should You Use?
- +Borders travel with cells when sorted, filtered, or moved
- +Borders print by default with no extra setting changes
- +Borders support color, thickness, and dash styles
- +Borders can be applied conditionally with rules
- +Borders allow diagonal lines that gridlines cannot
- +Borders work in exports to PDF and image formats
- −Gridlines are faster — no formatting needed at all
- −Gridlines stay perfectly aligned even after column resize
- −Gridlines never need to be reapplied after edits
- −Gridlines can be hidden globally with one checkbox
- −Gridlines do not interfere with conditional formatting colors
- −Gridlines are easier for beginners who fear menu navigation
Pre-Print Line Checklist for Polished Worksheets
- ✓Turn off screen gridlines under View to preview the final look
- ✓Apply a thick outside border to the entire data range
- ✓Add a thin bottom border under the header row only
- ✓Use a double bottom border above the grand total row
- ✓Set all border colors to dark gray or black for print clarity
- ✓Remove stray borders left over from copy-pasted ranges
- ✓Confirm diagonal borders display correctly at current zoom
- ✓Check that merged-cell borders extend across the full merge
- ✓Verify sparklines appear in every intended row with no gaps
- ✓Print to PDF first and review every page before sending
Ctrl+Shift+& applies an outline border in under a second
Select any range and press Ctrl+Shift+& on Windows or Cmd+Option+0 on Mac to instantly add a thin outline around the selection. Pair this with Ctrl+Shift+_ to remove all borders. These two shortcuts alone will save you thousands of clicks across a year of Excel work.
Sparklines are the most underused line feature in Excel, and once you start using them you will wonder how you ever lived without them. A sparkline is a tiny chart that lives entirely inside a single cell, drawing a trend line from a row or column of source data. They were introduced in Excel 2010 and have been refined ever since, and in 2026 they still represent one of the cleanest ways to show pattern at a glance without burning vertical space on a full chart.
To insert a sparkline, click the cell where you want it to appear, go to the Insert tab, and choose Sparklines, then Line. A small dialog appears asking for the data range. Point to the row of numbers you want to plot, click OK, and a tiny line graph appears in your target cell. Drag the fill handle down to populate sparklines for every row in your table, and Excel automatically adjusts the source range for each row, just like a relative formula would.
The Sparkline Design tab, which appears whenever a sparkline is selected, gives you control over markers, colors, and axis behavior. Turning on the High Point and Low Point markers is almost always worth it because those two dots immediately tell the reader where peaks and troughs occurred. The Same for All Sparklines axis setting is critical when comparing rows — without it, each sparkline scales independently and a flat line on one row looks identical to a wild swing on another, which is misleading.
Column sparklines plot bars instead of a line and are better for discrete monthly or quarterly comparisons. Win/Loss sparklines plot a small upward bar for positive numbers and a small downward bar for negative numbers, ignoring magnitude. Sales teams love win/loss for showing a streak of weekly results, while finance teams prefer line sparklines for showing smooth trends over time. Pick the type that matches the underlying data shape.
One gotcha worth knowing: sparklines do not appear in the formula bar like normal content, which means a casual viewer might not realize they are there. To make them obvious, give the sparkline column a clear header like Trend or Last 12 Months and use a slightly different background fill. This signals to the reader that the lines are meaningful and not just decorative.
For more advanced trend visualization you can combine sparklines with conditional formatting in adjacent cells. Imagine a row that shows current month sales, a sparkline of the last twelve months, the percent change versus last year, and a colored data bar showing relative size. That single row tells a story that would otherwise require three separate charts and a paragraph of commentary. Dashboards built this way are dense without being cluttered.
Finally, sparklines respect cell formatting in subtle ways. If you change row height the sparkline scales with it. If you merge cells, the sparkline expands across the merge. If you copy a sparkline to a new sheet, the source data reference may break, so always verify that copied sparklines still point to live data before sharing the workbook with stakeholders.

When you insert a row in the middle of a bordered range, Excel sometimes does not extend the existing borders to the new row, leaving a visible gap in your table outline. After any structural change to a bordered range, reapply All Borders to the full table to restore continuity. This is the single most common cause of broken-looking spreadsheets.
Even experienced Excel users run into recurring problems with lines, and most of them trace back to a handful of avoidable mistakes. The first is mixing borders and gridlines without realizing it. If you turn off gridlines but only apply borders to part of your data, the unbordered cells suddenly look like floating numbers with no structure. The fix is to either apply borders to the entire used range or leave gridlines on for the working sheet and only turn them off for the final printable version.
The second mistake is overusing thick or colored borders. A spreadsheet that uses bright red 3-point borders on every section starts to feel like a warning sign rather than a report. The strongest visual designs in Excel use exactly two border weights — a thin one for internal divisions and a thick one for the outer frame — and reserve color only for the very top edge or the grand total. Restraint communicates confidence.
The third mistake is applying borders before merging cells. If you merge a range that already has internal borders, Excel sometimes preserves those internal lines as ghost edges that show up only at certain zoom levels or in print preview. Always do your merging first and apply borders to the merged result. If you need to learn how to merge cells in excel quickly, the keyboard path is Alt-H-M-M on Windows.
A fourth issue is forgetting that conditional formatting can also apply borders. If a cell has a conditional rule that adds a red bottom border when a value drops below zero, and you do not realize the rule exists, you will see seemingly random borders appearing and disappearing. Always check Conditional Formatting Rules Manager before assuming a stray line is a bug. The same applies to table styles, which include their own border patterns that override manual borders.
A fifth common pitfall is exporting to PDF without checking line rendering. Some printer drivers thin out one-pixel borders to the point of invisibility, while others over-render them as dark bands. The cure is to set borders that matter to a slightly thicker weight, around 1.5 points, and to always preview the PDF before distribution. For learners just starting out, a great way to reinforce this is to take the free Excel functions practice quiz and then format your answer sheet with proper borders.
The sixth pitfall happens when you copy formatting from one workbook to another with different theme colors. A border that looked black in the source workbook may render as light blue in the destination because the underlying theme color is Accent 1, not actual black. To prevent this, use the standard color palette rather than theme colors for any border you want to look identical across workbooks. Theme colors are great for fills, less great for lines.
The seventh and final issue is line clutter on dashboards. When sparklines, conditional formatting, manual borders, table styles, and chart axes all compete for attention, the eye does not know where to land. Build dashboards by starting with zero lines, then add back only what is necessary. If a line does not help the reader make a decision, remove it. Less really is more in spreadsheet design.
Now that you understand every method, here are practical tips that will make your line work look professional without taking extra time. First, build a personal style guide for your spreadsheets. Pick one thin gray color for internal borders, one darker color for outlines, and one accent color for grand totals. Save these as cell styles under Home, Cell Styles, New Cell Style. From that point forward you can apply a consistent look with a single click on any new workbook.
Second, leverage Excel Tables. When you convert a range to a Table using Ctrl+T, Excel automatically applies banded rows, header borders, and a consistent outer frame, and it maintains all of those as you add or delete rows. Tables also bring filters, structured references, and easier integration with Power Query. For most working data sets, starting with a Table is the right move before any manual border work even begins.
Third, learn the keyboard shortcuts and stop reaching for the mouse. Ctrl+Shift+& for outline border, Ctrl+Shift+_ to remove all borders, Ctrl+1 to open Format Cells, and Alt+H+B to open the Borders dropdown will cover ninety percent of your line work. Combine these with arrow keys and Shift to select ranges, and you can format a complex report in under a minute without ever touching the mouse.
Fourth, plan your borders to support filtering. If you put a thick border between Q1 and Q2 sections of a sales table, and then a user filters the table to show only one region, the visual separation can disappear because the filtered rows hide. For tables that will be filtered, prefer banded fill colors over hard borders to separate groups, because fills travel with visible rows correctly.
Fifth, consider accessibility. Very thin light gray lines may be invisible to readers with low vision or to printouts on lower-quality printers. If your spreadsheets are read by a wide audience, default to medium-weight darker borders. For colorblind-friendly design, never rely on color alone to convey meaning in a line — pair color with thickness or style differences so the meaning still comes through in grayscale.
Sixth, document your formatting choices in a hidden Notes sheet or at the top of the workbook. If a colleague inherits the file in six months, a note saying thin gray equals internal divider, dark blue equals section boundary, double black equals grand total saves them hours of confusion. This is especially important for reports that get reused across quarters or years.
Finally, practice. Lines feel like a small skill but they are the foundation of everything visual in Excel. Build a sample workbook, try every method covered in this guide, and time yourself reformatting a messy spreadsheet into a clean one. After three or four practice sessions the muscle memory takes over and you will never again be the person whose reports look unfinished.
Excel Questions and Answers
About the Author
Business Consultant & Professional Certification Advisor
Wharton School, University of PennsylvaniaKatherine Lee earned her MBA from the Wharton School at the University of Pennsylvania and holds CPA, PHR, and PMP certifications. With a background spanning corporate finance, human resources, and project management, she has coached professionals preparing for CPA, CMA, PHR/SPHR, PMP, and financial services licensing exams.