Trend Line Calculator

Enter your X values and Y values (comma-separated) and choose a trendline typeLinear, Exponential, or Polynomial — to fit a trend line to your data. The Trend Line Calculator returns the trendline equation, R² (goodness of fit), slope, and Y-intercept, plus a visual chart of your data points and fitted line. You can also enter an X value for prediction to extrapolate a forecasted Y result.

Enter your X-axis data points separated by commas.

Enter your Y-axis data points separated by commas. Must match the number of X values.

Choose the model that best fits your data pattern.

Enter an X value to extrapolate and predict a Y result.

Results

Trendline Equation

--

R² (Goodness of Fit)

--

Slope (m)

--

Y-Intercept (b)

--

Predicted Y at X

--

Number of Data Points

--

Data Points & Trend Line

Results Table

Frequently Asked Questions

What is a trend line and what does it show?

A trend line is a straight or curved line fitted to a set of data points that represents the general direction or pattern of the data. It helps you identify whether values are increasing, decreasing, or staying stable over time. Trend lines are commonly used in statistics, finance, and scientific analysis to summarize and communicate patterns in data.

What is the difference between linear, exponential, and polynomial trendlines?

A linear trendline is best for data that changes at a roughly constant rate and produces a straight line (y = mx + b). An exponential trendline suits data that grows or decays at an accelerating rate (y = ae^bx). A polynomial trendline fits more complex, curved patterns, such as data that rises and then falls, using a second-degree equation (y = ax² + bx + c).

What does R² (R-squared) mean?

R² is a statistical measure that indicates how well the trendline fits your data. Its value ranges from 0 to 1 — an R² of 1.0 means the trendline fits the data perfectly, while an R² of 0 means there is no relationship. Generally, an R² above 0.9 is considered an excellent fit, and values above 0.7 are considered acceptable in most fields.

How is a linear regression line calculated?

Linear regression uses the Ordinary Least Squares (OLS) method, which finds the slope (m) and intercept (b) that minimize the sum of squared differences between the actual Y values and the predicted Ŷ values. The formulas are: m = (n·Σxy − Σx·Σy) / (n·Σx² − (Σx)²) and b = (Σy − m·Σx) / n, where n is the number of data points.

What are residuals in regression analysis?

Residuals are the differences between your actual Y values and the values predicted by the trendline (Ŷ). A residual of zero means the trendline passed exactly through that data point. Large residuals suggest those points deviate significantly from the trend. Examining residuals helps you assess whether your chosen trendline model is appropriate for your data.

How many data points do I need for a reliable trend line?

For linear regression, a minimum of 3 data points is required, but at least 10–20 points produce more reliable results. For polynomial regression, you need at least 3 points for a quadratic fit, though more data always reduces overfitting. Exponential regression also benefits from larger datasets to accurately estimate the growth or decay rate.

Can I use this calculator to predict future values?

Yes. Once the trendline equation is fitted to your data, you can enter any X value into the 'X Value for Prediction' field to get a forecasted Y. Keep in mind that extrapolating far beyond your original data range can produce unreliable predictions, as real-world patterns may not continue to follow the same trend indefinitely.

What is Ordinary Least Squares (OLS) regression?

Ordinary Least Squares is the most common method for fitting a regression line. It works by choosing the line that minimizes the total of the squared vertical distances (residuals) between each data point and the line. This approach ensures the fitted line is the best possible linear approximation to your dataset under standard assumptions.

More Statistics Tools