Skip to content
ihateDesmos

How to find the line of best fit on Desmos

Updated 6 November 2026 · An independent guide, not from 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².

What to type
y_1 ~ m x_1 + by_1 ~ a x_1^2 + b x_1 + cy_1 ~ a b^(x_1)
2468510150
Open in calculator
Eight points and their line of best fit, with a slope of about 2.

Step by step

  1. 1
    Click + and choose “table”, then enter your data in x₁ and y₁.
  2. 2
    On 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.
  3. 3
    Read the slope m, the intercept b and r² under the line.
  4. 4
    To check the fit, click “plot” next to the residuals under the line.

Curved fits

ModelType this
Quadraticy_1 ~ a x_1^2 + b x_1 + c
Exponentialy_1 ~ a b^(x_1)
Logarithmicy_1 ~ a + b ln(x_1)
Powery_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?
Put your data in a table, then type y_1 ~ m x_1 + b. Desmos reports m, b and r².
How do I type the ~ symbol?
It is the tilde key, usually left of the 1 key, typed with Shift. On a phone, it is on the Desmos keypad under the functions section.
What does r² mean?
The share of the variation in y that the line explains, from 0 to 1.
Why am I getting an error?
Check the column names match your table exactly, including the subscript: y_1, not y1.

Keep going

Or try it in ihateDesmos

The same equations work here, with algebra, steps and exports built in. It is free, with no account.

Open the calculator