ForHosting KIT · Developer Utilities

Mean Absolute Percentage Error (MAPE) Calculator

The Mean Absolute Percentage Error calculator compares an ordered array of observed values with an equally sized array of predictions and returns their average absolute percentage difference.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

MAPE turns errors into a percentage that is easy to communicate across forecasts with different scales. Enter corresponding values in the same order and receive both the percentage result and the number of pairs evaluated. The calculator rejects zero observed values because percentage error is undefined when the denominator is zero, helping prevent a misleading metric from entering reports or automated evaluations.

Prepare aligned observed and predicted values

Start with two arrays that describe the same events in the same order. The first observed value must correspond to the first predicted value, the second observed value to the second predicted value, and so on. Both arrays must therefore have identical lengths and contain at least one finite number. Observed values may be positive or negative, but none may be zero because each observed value becomes the denominator of its pair's percentage error. Predicted values may be zero or negative when those values make sense for the data. Avoid placeholders such as null, empty strings, numeric strings, Infinity, or NaN; the calculator accepts actual finite JSON numbers only. Consistent units are also essential. Do not compare observed revenue in dollars with predictions in thousands of dollars, or measured temperature in Celsius with a forecast in Fahrenheit. MAPE does not know the meaning of the values, so correct alignment and units are the caller's responsibility. Once prepared, send the arrays under the observed and predicted fields. The response reports mape as a percentage and count as the number of evaluated pairs.

Understand how the percentage is calculated

For every pair, the calculator subtracts the prediction from the observed value, takes the absolute value of that difference, and divides it by the absolute magnitude implied by the observed denominator through the standard absolute percentage-error expression. It then averages those ratios and multiplies the result by 100. Consequently, a returned mape of 8.5 means the predictions differ from the observations by 8.5 percent on average, without preserving whether individual predictions were too high or too low. Taking the absolute value prevents positive and negative misses from canceling each other. Every pair receives equal weight in the final mean, regardless of the observed value's magnitude. That characteristic makes the result intuitive, but it also means a small observed value can contribute a very large percentage error. The implementation uses ordinary deterministic floating-point arithmetic and does not round the result, so consumers can apply the precision appropriate to their own interface or report. The count field makes it easy to verify how many pairs contributed to the calculation and to detect accidental filtering upstream.

Interpret MAPE carefully in real evaluations

MAPE is most useful when the observed values are nonzero, share a meaningful ratio scale, and percentage differences match the question you need to answer. It is commonly used for demand, traffic, sales, inventory, and other forecasts where stakeholders understand statements such as an average error of twelve percent. Compare results only when datasets were prepared consistently, because the metric can change substantially when the evaluated time window or product mix changes. Be cautious when observations sit very close to zero: even a modest absolute miss can become an enormous percentage and dominate the average. Negative observations are accepted mathematically by this calculator, but percentage interpretations may be unintuitive in domains where sign changes carry special meaning. MAPE also does not reveal bias, timing patterns, or the distribution of errors. Pair it with a signed metric when systematic overprediction matters, and consider MAE, RMSE, WAPE, or a domain-specific measure when zeros and near-zero values are common. For automation, the API costs $0.002 per request. Invalid arrays fail explicitly instead of returning a partial or silently filtered result, so upstream data problems remain visible.

Evaluate demand forecasts

Compare weekly predicted demand with nonzero observed sales and communicate average error as a percentage.

Monitor model versions

Calculate the same metric for candidate forecasting models and track whether percentage accuracy improves.

Check planning estimates

Measure how closely budget, traffic, or capacity estimates matched their eventual observed values.

What does the returned MAPE number mean?

It is the mean absolute percentage error expressed as a percentage. A value of 7 means an average absolute error of 7 percent.

Why are zero observed values rejected?

Each percentage error divides by its observed value. Division by zero is undefined, so the calculator rejects the complete input instead of producing a misleading result.

Must both arrays have the same length?

Yes. Each observed value needs exactly one corresponding prediction, and unequal lengths are reported as invalid input.

Does the calculator round the result?

No. It returns the deterministic JavaScript floating-point result so you can choose the display precision appropriate for your application.

Can observed values be negative?

Yes, finite negative values are accepted, although MAPE can be harder to interpret when signs have domain-specific meaning.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/mape-error

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/mape-error \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"observed":[100,200,50,400],"predicted":[110,190,55,360]}'
{
  "observed": [
    100,
    200,
    50,
    400
  ],
  "predicted": [
    110,
    190,
    55,
    360
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.mape_error",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_items100000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →