Curve Fitting Calculator
Fit a line, polynomial, exponential, logarithmic or power curve to your data and get the equation and R²
Loading the tool…
Fits a trendline to x and y data by least squares and gives the equation, R², adjusted R², standard error and residuals, with predictions from the fitted curve.
How to use
- Paste two columns into "x and y data", x on the left; a header row is recognised.
- Choose a "Model"; the equation, R² and chart update at once.
- For exponential and power curves, pick the "Fitting method": "Log transform (as Excel trendlines)" or "Nonlinear least squares".
- Use "Predict y at x" or "Find x for y", and "Copy equation" or "Copy Excel formula" to reuse the result.
- Compare every model in "All models compared".
How it works
- R² = 1 − SSE ÷ SST, where SSE is the sum of squared residuals. AIC = n × ln(SSE ÷ n) + 2 × (coefficients + 1); lower is better.
- Exponential and power curves are fitted by default as a straight line through ln y, as Excel does.
- Models that need positive values show the reason when the data contains zeros or negatives. Results were checked against NIST reference datasets.
Questions and answers
- Why is my R² different from the Excel trendline?
- For exponential and power trendlines Excel reports R² of ln y. The page shows it as "R² of ln y" next to R² measured on y.
- Which model should I choose?
- The simplest one whose residuals scatter randomly around 0. Higher polynomial degrees always raise R², so compare adjusted R² or AIC.
- Can I fit an exponential curve when some y values are zero?
- No. The log transform needs every y greater than 0. Use a polynomial instead.
- What is the standard error of the regression?
- The typical size of a residual, √(SSE ÷ (n − number of coefficients)), in the unit of y.