ForHosting KIT · Developer Utilities

Calculate weighted average product rating from star counts

Turn a five-star review distribution into the two figures shoppers and commerce teams use most: the weighted average rating and the total number of reviews.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter the count recorded at each star level from one through five. The calculator multiplies every count by its star value, combines those weighted scores, and divides by the complete review total. It also adds every bucket to report the exact number of reviews represented. The calculation is deterministic, requires no product identifiers, and rejects an empty distribution rather than presenting a misleading zero rating.

Enter the complete rating distribution

Start with the five counts shown by your store, marketplace export, review provider, or reporting database. Put the number of one-star reviews in the one-star field, then do the same for two, three, four, and five stars. Counts must be whole numbers of zero or more because each value represents actual reviews, not a percentage or an already calculated score. Include buckets with no reviews as zero; do not omit them. The calculation works equally well for a new item with one review and a mature catalog listing with millions, provided every count remains within the safe integer range. Use figures from the same product, variant scope, channel, and reporting moment. Mixing a lifetime five-star count with a monthly one-star count creates a mathematically valid result that describes no real population. If a source supplies only percentages, obtain the underlying counts first whenever possible, since rounded percentages may not reconstruct the true review total. Once the five compatible counts are ready, submit them together as one distribution.

Understand the weighted calculation

A simple average of the five bucket counts would answer the wrong question. The calculator instead gives each bucket its star value: one-star reviews contribute one point each, two-star reviews contribute two points each, and so on through five points for every five-star review. It adds those contributions to obtain a weighted score, then divides that score by the total number of reviews across all five buckets. For example, ten five-star reviews influence the result five times as much as ten one-star reviews because they contribute fifty rating points instead of ten. The returned average is rounded to no more than six decimal places, which keeps output stable while preserving far more detail than a typical storefront display. The total review count is returned separately and is never inferred from the average. If all five counts are zero, there is no population and therefore no defined weighted average. The capability reports invalid input in that case instead of manufacturing a zero-star result that could be mistaken for genuine customer sentiment.

Use the result consistently

The average rating is suitable for catalog quality checks, internal dashboards, product-feed enrichment, marketplace reconciliation, and display logic. Decide separately how your storefront presents it: a system may show one decimal place, two decimal places, or a graphical star fill, while retaining the more precise returned value for comparisons. Always keep the total review count beside the average because confidence and commercial meaning differ sharply between a rating based on two reviews and the same rating based on twenty thousand. When comparing channels, calculate each channel from its own five buckets before combining data. To obtain an overall rating across channels, sum corresponding star counts first and run the combined distribution; averaging channel averages directly can overweight a channel with very few reviews. In automated pipelines, preserve the source timestamp and product key alongside the result even though they are not inputs to this calculation. Browser use is free, while an API request costs $0.002. The same deterministic arithmetic supports both paths, so repeated submissions of the same counts return the same figures.

Build a storefront summary

Convert the five rating buckets stored for a product into the average and review count displayed beside its title.

Check marketplace reports

Recalculate a reported product rating from exported star counts and identify summaries that do not match their distribution.

Combine review channels

Add matching star buckets from several channels, then calculate one correctly weighted rating for the combined review population.

What does the calculation cost?

It is free to run in the browser on this page. Each API request costs $0.002.

Why can I not submit five zero counts?

An empty review population has no defined average. Returning zero would incorrectly suggest that customers awarded a zero-star rating.

Can a star count be a decimal?

No. Counts represent individual reviews and must be non-negative whole numbers.

How is the average rounded?

The result is rounded to at most six decimal places for stable, precise output. Your storefront can apply its own display rounding.

How should I combine ratings from multiple stores?

Sum the one-star counts together, then the two-star counts, and so on. Calculate the rating from those five combined buckets instead of averaging store averages.

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/ecom/review-rating-average

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/ecom/review-rating-average \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"one_star_count":4,"two_star_count":6,"three_star_count":10,"four_star_count":30,"five_star_count":50}'
{
  "one_star_count": 4,
  "two_star_count": 6,
  "three_star_count": 10,
  "four_star_count": 30,
  "five_star_count": 50
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "ecom.review_rating_average",
  "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.

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 →