How to use the R-Squared Calculator
- Paste two columns of numbers, X first and Y second, with optional column names in the first row.
- Read R² and r in the results panel, together with the strength of the relationship in words.
- Check the “Significant at 5%?” line to see whether the correlation could plausibly be chance.
- Look at the chart: a high R² on a curved pattern is a warning, not a result.
What R² tells you
R², the coefficient of determination, is the share of the variation in Y that a straight-line fit on X accounts for. It runs from 0 to 1. An R² of 0.98 means 98% of the ups and downs in Y track X along the fitted line, and 2% is left as scatter. R² of 0 means the line does no better than just using the average of Y.
For a straight-line fit R² is the square of Pearson’s correlation coefficient r. That is why the calculator reports both: r carries the direction (negative when Y falls as X rises) while R² is the share explained. Adjusted R² reduces R² slightly to allow for the number of points; with few points the plain R² is optimistic.
Worked example: temperature and ice-cream sales
The sample has eight days of temperature (12 to 33 °C) and the ice-cream sales on each day. The calculator gives R² = 0.9808 and r = 0.9903, a very strong positive relationship, with the fitted line y = 9.05x + 11.4: about nine extra sales for every extra degree.
The t statistic for r is 17.5 on 6 degrees of freedom, far above the 5% critical value of 2.447, so the correlation is statistically significant: eight points this tightly aligned are very unlikely to arise by chance. With only three or four points, even a high R² often fails this test, which is the reason to look at it.
| Result | Value |
|---|---|
| R² | 0.9808 |
| r | 0.9903 |
| t (6 df) | 17.5 (critical 2.447) |
| Significant at 5% | Yes |
What counts as a good R²
There is no universal threshold. Analytical calibrations usually need 0.995 or better, physics experiments with tight control often reach 0.99, while in biology, ecology or psychology an R² of 0.3 to 0.6 can be a genuine finding because many other factors act on the outcome. Judge R² against what is normal in your field, and always together with the chart and the residuals.
Three situations make R² misleading. A curved relationship can give a high R² with a straight line, so look for curvature. One extreme point can create a high R² on its own. And a high R² between two things that both trend over time (such as sales and population) usually reflects the shared trend, not a causal link. The guide to line of best fit and R² shows Anscombe’s quartet, four very different data sets with the same R².
R² for non-linear fits
This calculator measures the straight-line R². When data follow an exponential or power law, fit the curve in the scatter plot maker, which supports linear, polynomial, exponential, logarithmic and power trendlines and prints R² in the legend. Note that R² from a model fitted to logged data is calculated on the logged values, so it is not directly comparable with a linear R².
Frequently asked questions
- How do I calculate R-squared?
- R² = 1 − SS_res / SS_tot, where SS_res is the sum of squared distances from the fitted line and SS_tot is the sum of squared distances from the mean of Y. For a straight-line fit it equals r².
- Can R² be negative?
- For an ordinary least-squares line with an intercept it cannot. It can go negative for a model forced through the origin or a badly chosen non-linear model.
- What does an R² of 0.5 mean?
- Half the variation in Y is explained by X. That can be interesting or poor depending on the field. Check the chart and the number of points.
- Is a significant correlation a strong one?
- No. With many points, even a weak correlation can be statistically significant. Significance says the relationship is probably not chance; R² says how much it explains.
- Is my data private?
- No. The calculation runs in your browser, so the numbers you enter are never sent to a server.
Last updated: · by Dev Patel ·Read our guides