Least Squares Regression Calculator

Free statistics calculators designed for data scientists. This linear regression line calculator:

  • Fits Linear Regression Trendline
  • Graphs Data vs. Regression Line
  • Save & Recycle Data Between Projects

Trendline Equation



Click To Clear; enter values seperated by commas or new lines. Cut & Paste from Excel also works.

Can be comma separated or one line per data point; you can also cut and paste from Excel.

Saved Datasets - Click to Restore

Saved in your browser; you can retrieve these and use them in other calculators on this site.

Sharing Results of The Least Squares Regression Line Calculator

Need to pass an answer to a friend? It's easy to link and share the results of this calculator. Hit calculate - then simply cut and paste the url after hitting calculate - it will retain the values you enter so you can share them via email or social media.

Explore Single Series

Explore (X,Y) Pairs

Test Single Sample

Compare Samples

Confidence Intervals

Probability Distributions

Classical Statistics

How To Use The Regression Line Calculator

Enter your data as a string of number pairs, separated by commas. Enter each data point as a separate line. Then hit calculate. The linear regression calculator will estimate the slope and intercept of a trendline that is the best fit with your data.

You can save your data for use with this calculator and the other calculators on this site. Just hit the "save data" button. It will save the data in your browser (not on our server, it remains private). It will appear on the list of saved datasets below the data entry panel. To retrieve it, all you need to do is click the "load data" button next to it.

Interpreting Calculator Results

This calculator fits a linear trendline to your data using the least squares technique. This approach optimizes the fit of the trendline to your data, seeking to avoid large gaps between the predicted value of the dependent variable and the actual value. The calculator will return the slope of the line and the y-intercept. It will also generate an R-squared statistic, which evaluates how closely variation in the independent variable matches variation in the dependent variable (the outcome). For a deeper view of the mathematics behind the approach, here's a regression tutorial.

To help you visualize the trend - we display a plot of the data and the trendline we fit through it. If you hover or tap on the chart (in most browsers), you can get a predicted Y value for that specific value of X.The equation of the regression line is of particular interest since you can use it to predict points outside your original data set. Similarly, the r-squared gives you an estimate of the error associated with effort: how far the points are from the calculated least squares regression line.

Real World Linear Regression Analysis

Some practical comments on using regression in real world analysis:

The underlying calculations and output are consistent with most statistics packages. It applies the method of least squares to fit a line through your data points. The equation of the regression line is calculated, including the slope of the regression line and the intercept. We also include the r-square statistic as a measure of goodness of fit. This equation can be used as a trendline for forecasting (and is plotted on the graph).

Want to know more? This page has some handy linear regression resources.