Fit a trend line to your data
Paste x,y pairs from a spreadsheet and get the least-squares slope, intercept, R², and predictions — no chart software needed.
Tools used in this guide
The job
Sales by week, temperature by hour, page size by month — you want the straight line that best describes the trend and a quick read on how tight the fit is.
Fit the line
Paste x,y pairs (comma, tab, or space separated — straight from a spreadsheet). The tool computes the ordinary least-squares line: slope, intercept, R² coefficient, and the residuals. An optional 'predict at x' field evaluates the line at new points.
- A first non-numeric line like 'week,sales' is treated as a header and skipped.
- R² near 1.0 means the line explains most of the variance; near 0 means a line is the wrong model.
Worked example
Six weeks of sales (1,120) (2,138) (3,131) (4,145) (5,152) (6,160): the fit gives slope ≈ 7.6/week, R² ≈ 0.97 — a strong linear trend worth extrapolating a week or two, not a year.
Where it stops
Simple linear regression on two columns — no multiple regression, no polynomial or log fits, no confidence intervals or outlier detection. Ten thousand points max. Always look at the residuals; a high R² with curved residuals means the model is wrong.