Linear Regression Calculator

Compute the OLS line of best fit (y = mx + b), R², Pearson r, and interactive Y predictions with instant chart export.

Free online linear regression calculator and trend line grapher. Paste X, Y pairs to get slope, intercept, R², correlation r, 95% confidence band, and predicted values — then export PNG, SVG, or JPG.

✓ No signup required✓ All processing happens in your browser← Back to Tools

Sponsored

Best Use Cases

  • Solve statistics, physics, and economics homework with exact slope, intercept, and R².
  • Forecast future outcomes by entering any target X value to get the predicted Y immediately.
  • Evaluate correlation strength and plot a publication-ready line of best fit with 95% CI.

Why Use This Tool

  • Calculation + visualization in one step: see the exact formula y = mx + b right above the plot.
  • Interactive X → Y predictor: highlight your forecasted point directly on the regression line.
  • 95% confidence band toggle + crisp PNG, SVG, and JPG export — 100% free and private.

How to Calculate Linear Regression Online

1

Paste X, Y pairs

Enter two columns (with or without headers) separated by commas, tabs, or spaces.

2

Compute OLS statistics

Click Calculate & Plot to get y = mx + b, slope, intercept, R², and Pearson r.

3

Predict any X value

Type a new X value to compute predicted Y and highlight it in red on the chart.

4

Download your graph

Export 2x PNG, JPG, or vector SVG for lab reports, papers, and slides.

Linear Regression Calculator FAQ

How is the regression line calculated?
It uses Ordinary Least Squares (OLS), minimizing the sum of squared vertical residuals between observed Y values and the line y = mx + b.
What does R² mean?
R² (coefficient of determination, 0 to 1) tells you what proportion of the variance in Y is explained by X. Closer to 1 means a stronger linear fit.
Do I need a header row in my data?
No — headers like "Hours,Score" are automatically detected if present, and headerless numeric pairs work just as smoothly.
What is the 95% confidence band?
The dashed lines show the 95% confidence interval for the mean predicted response across X using the Student-t distribution.
Is my data uploaded to a server?
Never. All OLS calculations and charting happen locally inside your browser.

Popular Linear Regression Calculator Searches

Line of Best Fit Calculator

Paste X and Y values to compute the least-squares regression equation and plot it automatically.

Slope, Intercept & R² Calculator

Get exact OLS slope (m), Y-intercept (b), coefficient of determination (R²), and Pearson r.

Linear Regression Graph Maker

Export your scatter plot, fitted trend line, and 95% confidence interval as PNG, SVG, or JPG.

Related Tools