🏆 US-Registered Digital Marketing Agency
Advertisement
Advertisement
AI

Mean Squared Error Calculator — MSE, RMSE, MAE and R² together

Paste a list of predicted values and a list of actual values to get every standard regression error metric at once, plus a breakdown showing which observations are driving the squared error.

Separate with commas, spaces or new lines. The model's output, in the same order as the actual values below.
The observed truth. If the two lists are different lengths, only the overlapping pairs are used and the tool says so.
Every metric is computed regardless. This only changes which one occupies the large figure.
Mean squared error
 
0
RMSE
0
MAE
0
0
MAPE
Tip: the bars show which individual observations own the squared error. If one point holds a large share of the total, your MSE is describing that point rather than your model, and MAE will tell a very different story.
Advertisement

A mean squared error calculator compares two lists — what a model predicted and what actually happened — and reduces the difference between them to a single number. There are several such numbers, they disagree, and choosing the wrong one is one of the most common ways a regression model gets reported as better or worse than it is.

Arb Digital publishes a free tools library, and this page has clear neighbours in it. The root mean square calculator takes the RMS of a single list of values, which is a different operation entirely — this page takes two lists and measures the distance between them. The classification accuracy calculator and the confusion matrix calculator handle the equivalent question for classification, where predictions are labels and error is a count rather than a distance.

What This Mean Squared Error Calculator Does

It pairs your two lists element by element and computes every standard regression error metric from the residuals: mean squared error, root mean squared error, mean absolute error, mean absolute percentage error, the coefficient of determination R², and the mean signed error, which is bias.

The bias figure is the one most calculators omit and it deserves attention. MSE, RMSE and MAE all discard the sign of each error, so a model that is consistently 5 units too high scores identically to one that is randomly wrong by 5 units in either direction. Those are completely different failures with completely different fixes, and only a signed statistic reveals which you have.

The bars decompose the squared error by observation, showing the four largest contributors individually and the remainder pooled. This is the fastest way to see whether your MSE is a summary of the model or a summary of one bad data point.

How to Use It

  1. Keep the two lists in the same order. Pairing is positional, so a misaligned paste produces confident nonsense.
  2. Separate values however you like. Commas, spaces and new lines all work, so pasting a column straight from a spreadsheet is fine.
  3. Check the pair count in the line beneath the headline. If it is lower than you expected, one list is shorter or contains something that did not parse as a number.
  4. Compare RMSE against MAE. If RMSE is much larger, a few big errors dominate, and the bars will show you which.
  5. Read R² only against a meaningful baseline. It compares your model to predicting the mean, which is a very low bar on some data and a very high one on others.

The Formula / How It's Calculated

Every metric here starts from the residual e = predicted − actual for each of n pairs.

MSE = (1 ÷ n) × Σe² — the average squared residual, in squared units of whatever you are predicting. RMSE = √MSE, which returns the figure to the original units. MAE = (1 ÷ n) × Σ|e| — the average absolute residual, also in original units. MAPE = (100 ÷ n) × Σ(|e| ÷ |actual|), undefined wherever an actual value is zero. Bias = (1 ÷ n) × Σe, which keeps the sign.

R² = 1 − (Σe² ÷ Σ(actual − mean actual)²). The denominator is the total variation in the actual values, so R² reports the proportion of that variation the model accounts for. It is 1 for a perfect fit, 0 for a model exactly as good as always predicting the mean, and negative for a model worse than that — a negative R² is entirely possible on held-out data and is not a bug. These definitions match those in the scikit-learn documentation on metrics and scoring: quantifying the quality of predictions.

Worked example, matching the values this page loads with. Predicted 12, 18, 33, 37, 55 against actual 10, 20, 30, 40, 50. The residuals are +2, −2, +3, −3 and +5, so the squared residuals are 4, 4, 9, 9 and 25, summing to 51. MSE = 51 ÷ 5 = 10.2000 and RMSE = √10.2 = 3.1937. The absolute residuals are 2, 2, 3, 3 and 5, summing to 15, so MAE = 3.0000. The percentage errors are 20%, 10%, 10%, 7.5% and 10%, giving MAPE = 11.5000%. The actual values have a mean of 30 and a total sum of squares of 400 + 100 + 0 + 100 + 400 = 1,000, so R² = 1 − 51 ÷ 1,000 = 0.9490. Bias is (2 − 2 + 3 − 3 + 5) ÷ 5 = +1.0000 — the model runs slightly high. Note the decomposition: that single 5-unit error contributes 25 of the 51 total, just under half the squared error from one fifth of the data.

Advertisement

MSE Versus MAE: the Choice That Changes Your Model

This is not a reporting preference. Squaring the errors changes what the model optimises, and therefore changes the model you end up with.

Because MSE squares each residual, an error of 10 contributes a hundred times as much as an error of 1. A model trained to minimise MSE will therefore accept many small errors to avoid a few large ones, which pulls its predictions toward outliers. A model trained to minimise MAE treats all errors in proportion and will happily leave an outlier badly predicted if fitting it would cost accuracy elsewhere. Google's machine learning crash course makes the contrast directly in its treatment of linear regression loss, noting that MSE moves the model toward outliers while MAE does not.

Which behaviour you want depends on what the outliers are. If a large error is genuinely much worse than several small ones — an underestimated flood level, a badly mispriced contract — squaring encodes that correctly and MSE is the right objective. If your outliers are measurement noise, mis-entered data or rare events you do not need to predict, MSE hands them control of your model and MAE is the better choice.

The diagnostic is the ratio between RMSE and MAE. On errors of similar size, RMSE is only slightly larger than MAE. When RMSE is two or three times MAE, a small number of observations own most of the squared error — exactly what the worked example shows in miniature, with one point holding 49% of the total.

Where Each Metric Misleads

All four headline metrics have a failure mode, and knowing them is more useful than knowing the formulas.

MSE misleads by units. It is in squared units, so an MSE of 10.2 on a quantity measured in dollars is 10.2 squared dollars, which means nothing intuitively. It is also unbounded and scale-dependent, so an MSE cannot be compared between two problems measuring different things. Use it as an objective, report RMSE.

RMSE misleads by hiding outliers. Returning to the original units makes it readable, but it is still dominated by the largest errors. An RMSE of 3.19 in the worked example sounds like a typical error of about 3, when in fact three of five predictions were within 2 and one was out by 5.

MAE misleads by treating everything as equal. If large errors really are disproportionately costly, MAE understates the damage — and a model tuned on it will let outliers go badly wrong. It is also less sensitive to genuine improvement in tail behaviour.

MAPE misleads on small and zero actuals. Dividing by the actual value makes it explode as the denominator approaches zero and undefined at exactly zero. It is also asymmetric: over-prediction is bounded at 100% error while under-prediction is not, so it systematically favours models that predict low. Never use it on data that crosses or approaches zero.

R² misleads by flattering high-variance data. It measures improvement over predicting the mean, so on data with a wide spread even a mediocre model scores well, while on data with little variation a genuinely good model can score poorly. It also cannot fall below zero on the training set but very much can on held-out data, and a negative held-out R² means the model is worse than a constant.

Which One to Report

A defensible evaluation reports more than one, and the combination is what tells the story.

The practical minimum is RMSE alongside MAE, because the gap between them describes the shape of the error distribution that neither number carries alone. Adding bias costs nothing and immediately separates a systematically off model from a noisily wrong one. R² is worth including when your audience needs a scale-free figure, with the caveat about variance stated alongside it.

Two habits improve any regression report. First, quote the error against the scale of the target — an RMSE of 3.19 means one thing when values run from 10 to 50 and something else entirely when they run from 10 to 50,000. Second, look at the residuals rather than only their summary: structure in the residuals, such as errors growing with the predicted value, is invisible in every metric on this page and is usually the most actionable finding available.

For the supporting statistics, the mean, median and mode calculator summarises a single list of values and the percentage calculator handles the proportional arithmetic behind MAPE.

Building an AI feature into a product?

Arb Digital designs and builds fast, dependency-free web interfaces around models — evaluation dashboards, calculators and tools that load instantly and rank.

See Web Design Services Talk to Arb Digital

Common Mistakes to Avoid

  • Comparing MSE between different problems — it is scale-dependent and in squared units, so a lower MSE on a different target means nothing at all.
  • Reporting RMSE without the range of the target — the same figure is excellent or terrible depending on the scale of what is being predicted.
  • Using MAPE on data near zero — the denominator collapses, the metric explodes, and it is asymmetric in a way that rewards under-prediction.
  • Treating a negative R² as an error — on held-out data it simply means the model is worse than always predicting the mean, which is a real and informative result.
  • Ignoring bias — every squared and absolute metric discards the sign, so a model that is consistently high looks identical to one that is randomly wrong.

Related Free Tools From Arb Digital

The root mean square calculator takes the RMS of a single list rather than comparing two, and the classification accuracy calculator and confusion matrix calculator cover the classification equivalent. For the underlying statistics, use the mean, median and mode calculator and the percentage calculator. Everything else is in the free online tools hub.

Frequently Asked Questions

What is mean squared error?

The average of the squared differences between predicted and actual values. Squaring makes every error positive and gives disproportionate weight to large ones, so a single big miss can dominate the figure. It is in squared units of the target, which is why RMSE is usually reported instead.

What is the difference between MSE and RMSE?

RMSE is the square root of MSE. The only change is the units: MSE is in squared units of whatever you are predicting and RMSE is back in the original units, which makes it readable. Both rank models identically, so the choice is purely about interpretability.

Should I use MSE or MAE?

Use MSE when a large error is genuinely much worse than several small ones, because squaring encodes that. Use MAE when your outliers are noise or mis-entered data, because MSE lets those points pull the model toward them. The choice changes the model you end up with, not just the number you report.

Why is my RMSE much larger than my MAE?

Because a small number of observations carry most of the squared error. On errors of similar size the two are close, so a large gap is a reliable signal that outliers are present. The bars on this page show exactly which observations are responsible.

Can R-squared be negative?

Yes, on held-out data. R-squared compares your model against always predicting the mean of the actual values, so a negative figure means the model is worse than that constant. On training data with a fitted intercept it cannot go below zero, which is why the possibility surprises people.

When should I avoid MAPE?

Whenever the actual values approach or cross zero, because dividing by them makes the metric explode and it is undefined at exactly zero. It is also asymmetric — over-prediction is capped at 100% error while under-prediction is unbounded — so it quietly favours models that predict low.

How is this different from a root mean square calculator?

A root mean square calculator takes the RMS of one list of values, which is a summary of that list's magnitude. This page takes two lists, computes the residual between each pair, and summarises the distance between prediction and truth. Different inputs, different question.

This tool performs statistical arithmetic on values you supply. It does not assess whether a model is fit for any particular purpose, and error metrics from a model used in a medical, financial or safety context must be interpreted by someone qualified in that domain.

Advertisement
Advertisement

Take it further