HPA Target Calculator
Calculate the ideal Horizontal Pod Autoscaler target utilization and replica range.
About HPA Target Calculator
The Horizontal Pod Autoscaler computes desired replicas as desiredReplicas = ceil(currentReplicas × (currentMetricValue / desiredMetricValue)), then clamps the result to the configured minReplicas/maxReplicas range. This mirrors the exact formula the Kubernetes HPA controller uses for the resource-metric algorithm, letting you predict scaling behavior before it happens in the cluster.
Formula
desiredReplicas = clamp(ceil(currentReplicas × (currentCPU% / targetCPU%)), min, max)
- R_c
- Current replica count
- U_c
- Current CPU utilization percentage
- U_t
- Target CPU utilization percentage
- R_{min}
- HPA minimum replicas
- R_{max}
- HPA maximum replicas
- D
- Desired replica count
Worked example
With the default values below, HPA Target Calculator returns Desired Replicas of 6. Change any input above and every figure here is recalculated in your browser.
Inputs used
- Current CPU Utilizationaccepts 0–500 %
- 85 %
- Target CPU Utilizationaccepts 1–500 %
- 60 %
- Current Replicasaccepts 1–10,000 pods
- 4 pods
- Min Replicasaccepts 1–10,000 pods
- 2 pods
- Max Replicasaccepts 1–10,000 pods
- 20 pods
Results
- Desired Replicas
- 6 pods
- Change from Current
- 2 pods
- Projected Utilization at Desired
- 56.7%
- Clamped by Max Replicas
- false
- Clamped by Min Replicas
- false
Step by step
- 1Desired replicas: current × (current% / target%)= 5.67
- 2Round up to whole pods= 6
- 3Clamp to [min, max] replicas= 6
Assumptions and limits
- The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
- In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
- Figures are rounded for display to 1 decimal place, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.
How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.
Frequently Asked Questions
Why did my HPA not scale even though utilization is above target?
The HPA has built-in stabilization windows and tolerance (default ±10%) to avoid thrashing — small deviations from target within that tolerance band do not trigger a scaling event.
What happens when the calculated replicas exceed maxReplicas?
The HPA clamps the desired count to maxReplicas and the pods will remain under-provisioned relative to the target utilization until you raise the ceiling or the load decreases.
Does this work for custom or external metrics?
The same ratio formula applies to any metric type the HPA supports (CPU, memory, custom metrics via adapters), as long as you're using the average utilization (Value) metric target type.
How do I choose a good target utilization?
Target below the level where response times start degrading, typically 50-70% for CPU, to leave headroom for scale-up delay while new pods start and pass readiness checks.
