Industrial Engineering Calculator

Economic Production Quantity (EPQ) Calculator

Determine the optimal production batch size that minimizes total annual setup and holding costs for in-house manufacturing systems where items are produced and consumed simultaneously.

Inventory Profile

Stock level over a single production cycle (production rate p > demand rate d)

Inventory LevelTimeProduction(p > d)Consumption(only d)ImaxQCycle Time TtpProduction phase (p)Consumption phase (d)Inventory level

Input Parameters

Enter demand, cost, and rate parameters. Ensure production rate exceeds demand rate.

units/year

Total yearly demand for the product.

$/run

Fixed cost to prepare each production run (labor, machine setup, tooling).

$/unit/year

Annual cost to carry one unit in inventory (storage, capital, insurance).

Rate Parameters

units/time

Rate at which items are consumed (e.g., units/day).

units/time

Rate at which items are produced. Must be greater than d.

Engineering Tip

The closer p is to d, the larger the EPQ must be to amortize setup costs. Always ensure p > d — otherwise inventory will never deplete and the model is infeasible.

Utilization (d/p)33.3%

Economic Production Quantity

1,369units

Optimal batch size to minimize total annual cost

Max Inventory (Imax)

912.87 units

Total Annual Cost

$3,651.48

Production Time (tp)

9.13 time

Cycle Time (T)

27.39 time

Runs / Year

7.3

Feasible Model — Production rate exceeds demand rate

With p = 150 and d = 50, inventory builds at a net rate of 100.00 units/time during production, reaching a peak of 912.87 units.

Annual Cost Breakdown

Setup Cost

(D / Q) × S

$1,825.74

Holding Cost

(Q / 2) × H × (1 − d/p)

$1,825.74

Total Annual Cost

Setup + Holding

$3,651.48

Setup
Holding

Governing Formula

Q* = √[ (2DS) / (H(1 − d/p)) ]
Q*units

Optimal production quantity

Dunits/year

Annual demand

S$/run

Setup cost per run

H$/unit/year

Holding cost per unit per year

dunits/time

Demand rate

punits/time

Production rate

Model Assumptions

  • Constant, known demand rate
  • Constant production rate
  • No stockouts allowed
  • Instantaneous setup
  • Constant holding & setup costs
  • Single product, infinite horizon
  • Production rate > demand rate
  • No quantity discounts

Engineering Code

Reuse the EPQ calculation in your own operations research workflow.

Python
import math

def epq(D, S, H, d, p):
    """
    Calculate Economic Production Quantity (EPQ).
    D: Annual demand (units/year)
    S: Setup cost per production run ($/run)
    H: Holding cost per unit per year ($/unit/year)
    d: Demand rate (units/time)
    p: Production rate (units/time) - must be > d
    Returns:
        Optimal production quantity (units)
    """
    if p <= d:
        raise ValueError("Production rate must exceed demand rate.")
    if D <= 0 or S <= 0 or H <= 0:
        raise ValueError("D, S, and H must be positive.")

    ratio = 1 - (d / p)
    Q = math.sqrt((2 * D * S) / (H * ratio))
    return Q

def max_inventory(Q, d, p):
    return Q * (1 - d / p)

def total_annual_cost(D, S, H, d, p, Q):
    setup = (D / Q) * S
    holding = (Q / 2) * H * (1 - d / p)
    return setup + holding

# Example
D = 10000
S = 250
H = 4
d = 50
p = 150

Q = epq(D, S, H, d, p)
Imax = max_inventory(Q, d, p)
TC = total_annual_cost(D, S, H, d, p, Q)

print(f"EPQ (Q*): {Q:.2f} units")
print(f"Max Inventory: {Imax:.2f} units")
print(f"Total Annual Cost: ${TC:,.2f}")
MATLAB
function [Q, Imax, TC] = epq(D, S, H, d, p)
% Economic Production Quantity (EPQ)
% D = Annual demand (units/year)
% S = Setup cost per run ($/run)
% H = Holding cost ($/unit/year)
% d = Demand rate (units/time)
% p = Production rate (units/time)
    if p <= d
        error('Production rate must exceed demand rate.');
    end
    ratio = 1 - (d / p);
    Q = sqrt((2 * D * S) / (H * ratio));
    Imax = Q * ratio;
    TC = (D / Q) * S + (Q / 2) * H * ratio;
end

% Example
D = 10000;
S = 250;
H = 4;
d = 50;
p = 150;

[Q, Imax, TC] = epq(D, S, H, d, p);
fprintf('EPQ (Q*): %.2f units\n', Q);
fprintf('Max Inventory: %.2f units\n', Imax);
fprintf('Total Annual Cost: $%.2f\n', TC);
Excel Formula
=SQRT((2*D*S)/(H*(1-d/p)))

Assumes cells: D, S, H, d, p are defined as named ranges.

Example Calculation

For a product with annual demand of 10,000 units, setup cost of $250 per run, holding cost of $4 per unit per year, demand rate of 50 units/day, and production rate of 150 units/day:

Q* = √[ (2 × 10000 × 250) / (4 × (1 − 50/150)) ]
Q* = √[ 5,000,000 / (4 × 0.6667) ] = √[ 1,875,000 ]
Q* ≈ 1,369 units per production run
Imax = 1369 × (1 − 50/150) ≈ 913 units  |  Total Annual Cost ≈ $3,651

Technical Explanation: Economic Production Quantity

The Economic Production Quantity (EPQ) model — also known as the Production Order Quantity (POQ) model — extends the classic EOQ framework to manufacturing environments where items are produced internally rather than ordered from an external supplier. Unlike EOQ, which assumes instantaneous replenishment, EPQ recognizes that inventory builds up gradually at a net rate of (p − d), where p is the production rate and d is the demand rate.

This distinction is critical: because inventory accumulates more slowly than in the EOQ model, the optimal batch size is smaller, and the maximum inventory level is lower — reducing holding costs while still amortizing setup costs efficiently.

How to Use This Calculator

  1. Annual Demand (D): Enter the total yearly requirement in units/year.
  2. Setup Cost (S): Input the fixed cost per production run — labor, machine changeover, tooling, documentation.
  3. Holding Cost (H): Specify the annual cost to carry one unit in inventory (storage, capital, insurance, obsolescence).
  4. Demand Rate (d): Enter the consumption rate in units/time (must match the time unit of production rate).
  5. Production Rate (p): Enter the manufacturing rate in the same time units. Must be strictly greater than d.

How does the ratio d/p affect the optimal batch size?

The factor (1 − d/p) appears in the denominator of the EPQ formula. As the utilization ratio d/p approaches 1 (production barely outpaces demand), the factor shrinks toward zero, driving the optimal batch size toward infinity. In practice, this means that near-capacity systems require very long production runs to avoid constant changeovers. Conversely, when p ≫ d, the EPQ converges toward the classic EOQ.

When should you NOT use EPQ?

The model assumes deterministic demand, constant rates, no stockouts, and no quantity discounts. It is inappropriate for items with highly variable demand (use safety stock or stochastic models), products with short shelf lives, or environments where setup times are sequence-dependent. For multi-product systems with shared resources, consider the ELSP (Economic Lot Scheduling Problem) instead.

Real-World Engineering Cases

'Harley-Davidson's Lot-Size Revolution (1980s)'

In the early 1980s, Harley-Davidson ran massive production batches with setup times exceeding 4 hours per machine. Inventory carrying costs were crippling. After studying Japanese manufacturers, they launched a systematic setup-reduction program (SHINE / SMED) that cut changeover times from hours to minutes.

Engineering Lesson

Since setup cost (S) appears directly in the EPQ numerator, even modest reductions in setup time dramatically shrink the optimal batch size. Smaller batches mean lower inventory, faster feedback, and greater flexibility — often a bigger competitive advantage than any formula optimization.

Toyota Production System — The Origin of "Lot Size = 1"

Taiichi Ohno observed that American automakers produced in huge batches to "amortize setup costs." He inverted the logic: instead of accepting large setups, he engineered the system so setups became trivial. The result was that the EPQ formula, fed with near-zero S, yielded a batch size approaching one unit — enabling true flow production.

Engineering Lesson

The EPQ model exposes the tradeoff between setup and holding costs, but the real strategic insight is that setup cost is not a fixed constant — it is a design variable. World-class manufacturers treat setup reduction as a core capability, not an input to a formula.

Frequently Asked Questions

What is the Economic Production Quantity (EPQ)?

EPQ is the optimal production batch size that minimizes the sum of annual setup costs and annual inventory holding costs for an in-house manufacturing system where items are produced and consumed simultaneously.

How is EPQ different from EOQ?

EOQ assumes the entire order arrives instantly, while EPQ accounts for gradual production. EPQ includes the factor (1 − d/p) to reflect that inventory builds up at a net rate of (p − d) during production, resulting in a lower optimal batch size than EOQ for the same parameters.

What is the EPQ formula?

Q* = √[ (2DS) / (H(1 − d/p)) ], where D is annual demand, S is setup cost per run, H is annual holding cost per unit, d is demand rate, and p is production rate.

Why must production rate exceed demand rate?

If production rate (p) is less than or equal to demand rate (d), inventory will never build up and stockouts are inevitable. The model becomes infeasible because the system can never catch up with demand.

What is maximum inventory in the EPQ model?

Maximum inventory Imax = Q × (1 − d/p). It represents the peak stock level reached at the end of each production run, before the consumption-only phase begins.

Operations research calculations provided by this tool are for educational and preliminary planning purposes. Always validate results against actual demand variability, capacity constraints, sequence-dependent setups, and business-specific cost structures before implementing production policies.