Economic order quantity calculator
With 1,000 units a year, 10 per order and 0.5 to hold one unit for a year, the best order size is 200: five orders a year and an annual inventory cost of 100, split evenly. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Annual demand
- 1,000
- Ordering cost
- 10
- Holding cost
- 0.5
- Eoq
- 200
- Orders per year
- 5
- Annual ordering cost
- 50
- Annual holding cost
- 50
The economic order quantity (EOQ) is the order size that minimises the combined cost of placing orders and holding stock when demand is steady and replenishment is instantaneous. Planners, buyers, and operations analysts still reach for the classic Harris–Wilson square-root formula when they need a transparent baseline before adding lead times, quantity discounts, or multi-echelon constraints.
What EOQ means and how the square-root formula works
Inventory managers face a classic trade-off: order too often and fixed ordering or setup costs pile up; order too much at once and capital, storage, insurance, and obsolescence costs rise with average stock. Under the standard assumptions—constant annual demand, fixed cost per order, holding cost proportional to average inventory, and instantaneous replenishment—the total relevant annual cost is the sum of ordering cost times the number of orders plus holding cost times half the order quantity.
Differentiating with respect to the order quantity Q and setting the derivative to zero yields the familiar economic order quantity EOQ equals the square root of two times annual demand D times ordering cost S, all divided by holding cost H per unit per year. At that optimum, annual ordering cost equals annual holding cost, which is a useful sanity check when you audit a spreadsheet.
The formula does not replace safety stock, reorder-point, or discount-schedule analysis; it is the transparent baseline those extensions build on when demand is treated as deterministic and continuous.
Where an EOQ calculator earns its keep
Procurement and inventory teams use an economic order quantity calculator to size recurring purchase orders when annual usage and cost parameters are known from the ERP or from last year’s actuals. Finance and operations courses need a deterministic oracle that rejects non-positive holding cost instead of silently emitting NaN that a buggy grader might treat as success. Failed validation does not consume balance.
Keep requests small, pin the rounded EOQ and cost fields in tests, and you get reproducible lot sizes for training, LMS plugins, and edge workers without standing up a full inventory-optimisation stack of your own.
What you can do with it
Procurement lot sizing
Size recurring purchase orders from annual demand, fixed order cost, and annual holding cost per unit when you need a transparent EOQ baseline for the ERP or buyer checklist.
Classroom and LMS grading
Mark inventory-management homework with a deterministic EOQ oracle that rejects non-positive holding cost and returns stable rounded roots for D, S, and H.
S&OP and consulting models
Generate a continuous EOQ and cost split inside planning notebooks before applying pack multiples, discounts, or multi-echelon constraints elsewhere.
FAQ
What is the economic order quantity formula?
EOQ = sqrt(2 × annual demand D × ordering cost S ÷ holding cost H).
Which units should I use for demand and costs?
Keep units consistent: annual demand in units per year, ordering cost in currency per order, holding cost in currency per unit per year. The calculator does not convert currencies or unit-of-measure.
Does EOQ include safety stock or lead time?
No. Classic EOQ optimises order quantity under steady demand and instantaneous replenishment. Safety stock and reorder points are separate calculations you apply after choosing the lot size.
Why are ordering cost and holding cost equal at the EOQ?
Because the EOQ is the point where the two costs balance. With 1,000 units a year, 10 per order and 0.5 to hold a unit, both come to 50, so the total of 100 is the lowest possible.
What happens if the holding cost is zero?
The calculation stops with a message instead of returning infinity or an empty zero. A holding cost of zero or below makes the formula meaningless, so demand, order cost and holding cost must all be positive numbers.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/biz/eoq-calculate \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"annual_demand":1000,"ordering_cost":10,"holding_cost":0.5}'const res = await fetch("https://api.kit.forhosting.com/biz/eoq-calculate", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"annual_demand": 1000,
"ordering_cost": 10,
"holding_cost": 0.5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/biz/eoq-calculate",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"annual_demand": 1000,
"ordering_cost": 10,
"holding_cost": 0.5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/biz/eoq-calculate", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"annual_demand":1000,"ordering_cost":10,"holding_cost":0.5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"annual_demand":1000,"ordering_cost":10,"holding_cost":0.5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/biz/eoq-calculate", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"annual_demand": 1000,
"ordering_cost": 10,
"holding_cost": 0.5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "biz.eoq_calculate",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This economic order quantity calculator accepts annual demand D, ordering cost per order S, and holding cost per unit per year H, returns the optimal lot size EOQ together with orders per year and the annual ordering and holding cost at that lot size, and fails with invalid_input when holding cost (or any other driver) is not strictly positive.
What EOQ means and how the square-root formula works
This endpoint implements that closed form exactly: it computes EOQ equals sqrt of (2 times D times S divided by H), then derives orders per year as D divided by EOQ, annual ordering cost as that frequency times S, annual holding cost as half of EOQ times H, and total annual inventory cost as the sum of the two.
Input contract, response shape, and error behaviour
Holding cost must be strictly positive—when H is zero or negative the EOQ expression is undefined or meaningless, so the task fails instead of returning infinity or a hollow zero. Textbook check: annual demand one thousand, ordering cost ten, holding cost zero point five yields EOQ two hundred, five orders per year, and equal annual ordering and holding costs of fifty each for a total annual cost of one hundred. Keep units consistent—if demand is in cases per year, holding cost must be per case per year, not per piece. POST a JSON body with three required positive finite numbers: annual_demand (D, units per year), ordering_cost (S, currency per order or per setup), and holding_cost (H, currency per unit per year). Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, non-finite values, zero, and negative values fail with invalid_input naming the field. On success the body echoes the three drivers and returns eoq, orders_per_year, annual_ordering_cost, annual_holding_cost, total_annual_cost, and a short formula string restating EOQ equals sqrt of (2 times D times S over H). Pair the numeric result with your own lot-size policy (round to pack multiples, minimum order quantities, or truckload steps) outside this endpoint; the calculator returns the continuous optimum only and does not emit purchase orders or ERP postings.
Where an EOQ calculator earns its keep
Consulting models and S&OP workbooks often need a transparent baseline lot size before layering quantity discounts, joint replenishment, or multi-warehouse allocation; calling a tiny parse API avoids embedding fragile spreadsheet square roots that drift when someone edits a cell format.
Technical questions
What happens if holding cost is zero or negative?
The task fails with invalid_input. Holding cost must be strictly positive; otherwise the EOQ expression is undefined or meaningless and the call is not billed.
What does the economic order quantity calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.