What a line of best fit does and when to use it

A line of best fit is a straight line drawn through a scatter plot that shows the general trend of your data. Google Sheets can add this line automatically to help you see whether two things move together — whether sales go up as temperature rises, or whether study hours connect to test scores. The line itself doesn't predict the future; it just makes the pattern visible.

You'll need a scatter chart already made in Google Sheets. If you haven't created one yet, you'll plot two columns of numbers against each other — one on the horizontal axis, one on the vertical. Once that chart exists, adding the line takes about three clicks.

This works best when your data points cluster roughly around an imaginary line rather than scattering randomly. If your points form a clear upward or downward slope, the line of best fit will show that relationship clearly. If the points are scattered with no pattern, the line will still appear, but it won't tell you much.

Key Takeaways

  • You need a scatter chart in Google Sheets before you can add a line of best fit — the line only works with this chart type.
  • Right-click any data point on your scatter chart, then select "Add trendline" from the menu to insert the line.
  • Google Sheets draws a linear trendline by default, which works for most situations where data moves in a straight-line pattern.
  • You can customize the line's color and style, and add a label showing the equation if you need to share the exact relationship with others.

Creating a scatter chart if you don't have one yet

Start by selecting the two columns of data you want to compare. Click the first cell in your first column, hold Shift, and click the last cell in your second column. This selects both columns as a range. Include the header row if you have one — Google Sheets will recognize it and use those names for your axes.

Go to the menu and click Insert, then Chart. Google Sheets opens the chart editor on the right side of your screen. Under "Chart type," scroll down until you see Scatter chart and click it. The preview on your sheet updates immediately to show your data as points.

If the axes look backwards — if the data you wanted horizontal is vertical instead — go back to the chart editor, click the Setup tab, and swap the Series. Once your scatter chart looks right, you're ready to add the line of best fit.

Adding the trendline in three steps

Click directly on one of the data points in your scatter chart. The point should highlight or show a small circle around it. Right-click that point, and a menu appears with several options. Look for Add trendline and click it.

A trendline panel opens on the right side of your screen. Google Sheets has already drawn a straight line through your data — this is the default linear trendline, and it's what you want in most cases. The line appears on your chart immediately. If you want to stop here, you're done; the line of best fit is now part of your chart.

If you want to see more options, the trendline panel shows you the type of line (linear is selected), the color, and the thickness. You can change any of these. You can also check the box next to Show equation to display the mathematical formula on the chart itself — useful if someone needs to understand the exact relationship or use it for calculations.

Understanding the equation if you show it

When you check "Show equation," Google Sheets displays something like y = 2.5x + 10 on your chart. This tells you the slope and starting point of the line. The number before the x (in this case 2.5) is the slope — how much y changes for each unit change in x. The number at the end (10) is where the line crosses the vertical axis.

You don't need to understand this equation to use the line of best fit. The visual line itself shows the trend, and that's usually enough. But if you're sharing the chart with someone who needs the exact numbers — a manager, a teacher, or a colleague doing further analysis — showing the equation gives them that information.

Changing the line's appearance

With the trendline panel still open, you can adjust how the line looks. Click the color box to change the line from the default blue to any color you want. This is useful if your line blends into the data points and you need it to stand out more.

You can also change the line style — solid, dashed, or dotted — by clicking the line style dropdown. A dashed line sometimes makes it easier to see both the data points and the trend at the same time. Adjust the thickness slider if the line is too thin to see clearly on your final chart.

These changes are purely visual and don't affect what the line represents. Make them based on what's easiest to read in your specific chart.

When the line doesn't look right

If your line of best fit seems to miss most of your data points, that usually means your data doesn't follow a straight-line pattern. Some data follows a curve instead — it might rise quickly at first and then level off, or dip before rising. If that's what you see, you can change the trendline type in the trendline panel.

Click the dropdown that says "Linear" and choose Exponential, Polynomial, or Power to try a curved line instead. Polynomial is the most common choice for curved data. The line will adjust to fit your data's shape better. However, for most business and educational charts, a linear trendline is what people expect to see, so stick with it unless you have a specific reason to change.

If your data points are completely scattered with no pattern at all, no trendline will make them look organized. That's not a problem with the line — it's information about your data. A scattered trendline tells you that the two things you're comparing don't have a clear relationship.

Removing or editing the trendline later

If you add a trendline and then decide you don't want it, right-click the line itself and select Delete trendline. The line disappears, but your scatter chart and data stay intact.

To edit an existing trendline, right-click it and select Edit trendline. The trendline panel opens again, and you can change the type, color, thickness, or equation display. Any changes update on your chart immediately.

Frequently Asked Questions

Can I add a line of best fit to a line chart or bar chart?

No, trendlines only work with scatter charts in Google Sheets. If you're using a different chart type, you'll need to convert it to a scatter chart first. Go to the chart editor, click "Chart type," and select "Scatter chart."

Does the line of best fit predict future values?

The line itself shows only the trend in your existing data. It doesn't predict what will happen next. However, if you know the equation (shown on the chart), you can use it to estimate values outside your data range — but those estimates are guesses based on the pattern, not guarantees.

What's the difference between linear and polynomial trendlines?

Linear trendlines are straight lines, best for data that moves steadily up or down. Polynomial trendlines are curved, best for data that changes direction — like sales that rise, peak, then fall. Start with linear; switch to polynomial only if your data clearly follows a curve.

Can I add multiple trendlines to the same chart?

Yes. Right-click each data series separately and add a trendline to each one. This is useful if you're comparing two different trends on the same chart. Each series gets its own line, and you can style them differently so they're easy to tell apart.

Why does my equation show an R² value?

The R² number (between 0 and 1) tells you how well the line fits your data. A value close to 1 means the line matches the data closely; a value close to 0 means the data is scattered. You can turn this display on or off in the trendline panel by checking or unchecking "Show R²."