Percent Error Calculator

Check a measured value against the expected one — percent error, absolute error, and over/under direction, plus the Excel, Sheets, and SQL formulas.

Runs in your browser — your numbers are never sent

How to calculate percent error in Excel, Google Sheets, and SQL

Decimals: use a period or a comma — 99.5 or 99,5.

Percent error
Absolute error
Signed error

What percent error tells you, and when to use it

Percent error measures how far an observed value falls from the value you expected, as a share of that expected reference. The formula is |observed − expected| / |expected| × 100: the numerator is the absolute error (the raw gap in the inputs' own units), and dividing by the expected value turns that gap into a percentage you can compare across measurements of different sizes. The reference — the true, accepted, theoretical, or reported value — always goes in the denominator; swapping the two inputs changes the answer, because percent error is not symmetric. Keeping the absolute value in the denominator lets it stay meaningful even when the reference is negative, and a percent error above 100% is perfectly valid when the observed value is more than double the expected one.

This calculator returns three numbers at once so you don't have to run the arithmetic by hand: the percent error (a positive magnitude that describes accuracy), the absolute error (the plain gap, useful when the units matter more than the ratio), and a signed over/under direction that tells you whether you overestimated or underestimated. Analysts reach for percent error when comparing a forecast or a calculated figure against an actual or reported one; students reach for it in the lab when comparing a measured value against an accepted one. The direction is what a spreadsheet's bare percentage usually throws away, yet it is often the first thing you need to know.

The one case with no answer is an expected value of zero: there is nothing for the error to be a percentage of, so the result is genuinely undefined rather than zero or infinity — the calculator says so and still shows the absolute error, which remains valid. Everything runs in your browser: no upload, no account, no server round-trip. Below the calculator you'll find the exact Excel and Google Sheets formula, a divide-by-zero-safe SQL query for computing percent error across a whole column, and a table that separates percent error from the two metrics people most often confuse it with — percent difference and percent change.

Percent error is a measure of accuracy — how close a single value lands to the truth — not of precision, which is how tightly repeated measurements agree with each other. A thermometer that always reads exactly two degrees high is precise but not accurate, and its percent error exposes that bias, while a spread of noisy readings around the right answer would not. Keep the distinction in mind when you report it: a small percent error says this one number is close to the reference, and says nothing about whether the next measurement will land in the same place.

For a one-off check this calculator is enough, but when you are scoring a whole forecast or a batch of measurements you usually want the average of the per-row percent errors — the mean absolute percent error, or MAPE, which you get by wrapping the percent-error column below in AVG(). MAPE inherits percent error’s weakness: it explodes when any reference sits at or near zero, so on data with real zeros analysts switch to a symmetric variant or fall back to absolute error. That trade-off is exactly why this tool shows the absolute error next to the percentage instead of hiding it.

In Excel and Google Sheets

Put the expected (true) value in cell A2 and the observed (measured) value in B2. These formulas are identical in Microsoft Excel and Google Sheets. The absolute value on the denominator, ABS(A2), keeps the result correct when the reference is negative.

Percent error as a decimal — then format the cell as Percentage:
=ABS(B2-A2)/ABS(A2)

Percent error as a plain number where 5 means 5%:
=ABS(B2-A2)/ABS(A2)*100

Absolute error (same units as the inputs):
=ABS(B2-A2)

Signed error (negative = under, positive = over), Percentage-formatted:
=(B2-A2)/ABS(A2)

Over / under / exact label:
=IF(B2>A2,"over",IF(B2<A2,"under","exact"))
Core formulas. A2 = expected, B2 = observed.

Watch the formatting: if the cell is formatted as Percentage, Excel and Sheets already multiply the stored value by 100 for display, so use =ABS(B2-A2)/ABS(A2) and do NOT also multiply by 100 — otherwise 5% shows as 500%. Multiply by 100 only when you leave the cell as a General or Number format.

  1. Type the expected value in A2 and the observed value in B2.
  2. In C2 enter =ABS(B2-A2)/ABS(A2).
  3. Select C2 and apply the Percentage format (Ctrl+Shift+5 in Excel) — it now reads as a percent.
  4. Drag C2 down to compute the percent error for every row of a column at once.
=IFERROR(ABS(B2-A2)/ABS(A2),"N/A")
Divide-by-zero-safe: when A2 = 0 the raw formula returns #DIV/0!; IFERROR shows N/A instead.

In SQL

To compute percent error across a whole table — forecast versus actual, batch of measurements — do it in one query. Given a table measurements(expected, observed), this PostgreSQL-style statement returns the absolute error and the percent error per row and never raises a divide-by-zero error.

SELECT
    expected,
    observed,
    ABS(observed - expected)                                              AS absolute_error,
    ROUND(ABS(observed - expected) * 100.0 / NULLIF(ABS(expected), 0), 4) AS percent_error_pct
FROM measurements;
NULLIF(ABS(expected), 0) returns NULL when expected = 0, so the row survives and percent_error_pct is simply NULL instead of throwing.

Two traps to avoid. First, divide-by-zero: NULLIF turns a zero reference into NULL so the division is skipped rather than erroring. Second, integer division: if expected and observed are INTEGER columns, ABS(observed - expected) / NULLIF(ABS(expected),0) truncates toward zero — 2/8 becomes 0, so a real 25% error prints as 0. Force floating-point math by putting the float literal in the numerator, before the division: multiplying by 100.0 first is what promotes the whole expression to a decimal.

-- PostgreSQL
ABS(observed - expected)::numeric / NULLIF(ABS(expected),0) * 100

-- SQL Server
CAST(ABS(observed - expected) AS FLOAT) / NULLIF(ABS(expected),0) * 100

-- MySQL ('/' already returns a decimal; also returns NULL on divide-by-zero)
ABS(observed - expected) / NULLIF(ABS(expected),0) * 100
Explicit casts per engine when the columns are integers.

Percent error vs percent difference vs percent change

Three formulas that look alike but answer different questions. The denominator tells you which one you actually want: a known reference, the average of two values, or an original starting value.

MetricFormulaDenominatorSignUse it when
Percent error|observed − expected| / |expected| × 100The accepted / true valueAlways ≥ 0 (magnitude)One value is a known reference and you're checking another against it (measured vs accepted, forecast vs actual).
Percent difference|A − B| / |(A + B) / 2| × 100The average of the two valuesAlways ≥ 0, symmetricYou compare two values and neither is the 'true' one — you just want how far apart they are.
Percent change(new − old) / |old| × 100The original (old) valueSigned: + up, − downA single value moves over time from an old to a new figure (growth, price move).

FAQ

What counts as an acceptable percent error?

There is no universal threshold — it depends entirely on the field. A physics lab might accept a few percent, a well-controlled chemistry titration under 1%, a business forecast anywhere from 5% to 20% depending on the horizon. Percent error only tells you the size of the gap; whether that size is tolerable is a judgement call about the context, the cost of being wrong, and how precise your reference value really is.

Why does the calculator say my percent error is 'undefined'?

Because the expected value is zero. Percent error is a gap expressed as a percentage of the reference, and there is no meaningful percentage of zero — the division is undefined, not zero and not infinity. When this happens, compare against a non-zero reference if you have one, or just use the absolute error, which the tool still shows and which stays perfectly valid at an expected value of zero.

Is percent error the same as percent difference or percent change?

No, and the denominator is the giveaway. Percent error divides by a known reference value (|observed − expected| / |expected|) and reports a positive magnitude. Percent difference divides by the average of two values that are equally 'true' and is symmetric. Percent change divides by an original (old) value and keeps its sign to show growth or decline over time. The table above works through all three side by side.

Related tools