How to find the line of best fit on Desmos
To find the line of best fit on Desmos, put your data in a table, then type y_1 ~ m x_1 + b on a new line. The ~ (tilde) means “fit this”. Desmos draws the line and reports the values of m, b and r².
y_1 ~ m x_1 + by_1 ~ a x_1^2 + b x_1 + cy_1 ~ a b^(x_1)Step by step
- 1Click + and choose “table”, then enter your data in x₁ and y₁.
- 2On a new line, type
y_1 ~ m x_1 + b. The underscore makes a subscript, and the tilde key is usually just left of the 1 key. - 3Read the slope m, the intercept b and r² under the line.
- 4To check the fit, click “plot” next to the residuals under the line.
Curved fits
| Model | Type this |
|---|---|
| Quadratic | y_1 ~ a x_1^2 + b x_1 + c |
| Exponential | y_1 ~ a b^(x_1) |
| Logarithmic | y_1 ~ a + b ln(x_1) |
| Power | y_1 ~ a x_1^b |
r and r²
For a straight-line fit, Desmos shows both r, the correlation, and r², which is the share of the variation the line explains. For other models, it reports R² rather than r. Close to 1 means a tight fit, but always look at the residuals as well. Our post on what R² doesn’t tell you explains why.
Getting more from a fit
Desmos gives you the coefficients and R². If you need standard errors on those coefficients, or a confidence band around the line, the regression calculator here reports them. Your data format carries over: paste the same two columns.
Frequently asked questions
How do I find the line of best fit on Desmos?
How do I type the ~ symbol?
What does r² mean?
Why am I getting an error?
Keep going
Fits with standard errors and confidence bands.
Scatter plots from pasted data.
r, r² and a p-value.
Type r = 2 sin(3θ), then set the range and the polar grid.
Name a list, then type boxplot(L).
A table is a scatter plot; a list makes a histogram.
The same equations work here, with algebra, steps and exports built in. It is free, with no account.