How to use: How this serverless function cost calculator works
This serverless function cost estimator models the usage-based charges that commonly appear on function bills. Your total is typically the sum of: (1) request volume (how many times the function runs), (2) compute time (how long it runs multiplied by the memory size), and sometimes (3) data transfer (outbound GB). Many platforms include a monthly free tier for requests and compute. This estimator applies those same concepts so you can model AWS Lambda, Google Cloud Functions, Azure Functions, or a private pricing plan.
Serverless function cost inputs and units
- Invocations per Month is the number of function executions in a month.
- Average Runtime (ms) is the average duration per invocation in milliseconds. The calculator converts it to seconds.
- Memory (MB) is the configured memory size. The calculator converts it to GB by dividing by 1024.
- Price per Million Invocations ($) is the request price (e.g., $0.20 per 1M requests on some plans).
- Price per GB-Second ($) is the compute price for 1 GB-second.
- Free Requests per Month and Free GB-Seconds per Month are monthly allowances. Defaults match a common AWS free tier, but you can change them.
- Data Transfer (GB) and Price per GB Data ($) are optional. Enter 0 if you don’t want to include egress.
Serverless function cost formula and assumptions
For serverless execution pricing, the calculator applies the following model, clamping request and compute usage to zero after the relevant free allowance is subtracted:
- Billable requests = max(0,
N − FR) - Total GB-seconds =
N × (M/1024) × (Tms/1000) - Billable GB-seconds = max(0,
TotalGBSec − FG) - Total cost =
(BillableReq/1,000,000)×P + BillableGBSec×G + DataGB×PriceData - If Show annual cost is checked, the final cost is multiplied by 12.
This serverless estimate does not reproduce every provider billing detail. Real bills can differ due to provider-specific rounding (e.g., per-ms or per-100ms), CPU allocation differences, architecture (x86 vs ARM), regional pricing, and additional services (API Gateway, queues, databases, logging, monitoring).
Worked example: serverless requests and GB-seconds
Suppose your function runs 2,500,000 times per month, averages 120 ms, uses 256 MB, and your pricing is $0.20 per million requests and $0.00001667 per GB-second. If your free tier is 1,000,000 requests and 400,000 GB-seconds:
- Billable requests = 2,500,000 − 1,000,000 = 1,500,000 → request cost = 1.5 × 0.20 = $0.30
- Total GB-seconds = 2,500,000 × (256/1024) × (120/1000) = 2,500,000 × 0.25 × 0.12 = 75,000 GB-seconds
- Billable GB-seconds = max(0, 75,000 − 400,000) = 0 → compute cost = $0.00
- If data transfer is 0, total monthly estimate = $0.30
This serverless cost example shows how a free compute allowance can cover a modest GB-second total, while higher traffic, longer execution, or more memory shifts the estimate toward compute.
Introduction: Understanding serverless function pricing in practice
Serverless function pricing is designed to be simple, but the details matter. Compute is measured in GB-seconds, which combines memory size and runtime. If you double memory and runtime stays the same, compute cost roughly doubles. If you reduce runtime by optimizing code, compute cost drops proportionally. Request charges are usually small compared to compute for heavy workloads, but they can matter for extremely high invocation counts.
Serverless function cost optimization tips
To lower a serverless function cost estimate, evaluate the execution and egress levers that affect the fields above:
- Reduce runtime: faster code, fewer network calls, reuse connections, and avoid cold-start-heavy patterns.
- Right-size memory: more memory can reduce runtime (sometimes lowering total GB-seconds), but not always—measure both.
- Batch work: process multiple events per invocation when latency requirements allow.
- Reduce egress: compress responses, cache, and use a CDN to lower outbound data transfer.
Serverless function data transfer charges
Serverless compute is only one part of a function workload’s bill. Outbound data transfer (egress) can be significant for APIs, file downloads, media processing, or cross-region traffic. Enter your estimated outbound GB and the per-GB price to include it. If your provider has tiered egress pricing, use an average blended rate for a quick estimate.
Cold starts and provisioned concurrency for serverless functions
Cold starts can increase runtime for a subset of serverless invocations, which increases GB-seconds. If you use provisioned concurrency (or similar reserved capacity), it introduces a fixed monthly charge that this estimator does not model. Calculate that charge separately and combine it with this page’s on-demand execution and data-transfer estimate.
Regional serverless pricing and budgeting
Serverless function prices vary by region and can change over time. For multi-region deployments, run the calculator per region (with that region’s prices and traffic split) and sum the results. For budgeting, revisit inputs monthly using real monitoring metrics (p50/p95 runtime, memory usage, and invocation counts) to keep forecasts realistic.
Serverless function cost planning scenarios
A useful serverless cost scenario begins with the rates and free allowances that apply to the specific provider, region, and account. Enter each workload’s invocation count, average runtime, memory setting, and expected egress rather than relying on a generic dollar example.
In this estimator, invocation volume drives request charges and also multiplies compute usage. Memory and runtime together determine GB-seconds, so confirm both against observed production data. Long-running functions, high memory allocations, and outbound-heavy responses are the inputs most likely to move the total materially.
Provider metering and pricing rules remain authoritative for a serverless bill. Use this page for planning and comparisons, then validate the rate inputs and free-tier eligibility against your provider’s documentation.
Serverless Function Cost Estimator FAQ
Can I use different units?
Serverless runtime should be entered in milliseconds and memory in megabytes. The calculator converts them to seconds and gigabytes internally. If your provider lists memory in GB, multiply by 1024 before entering.
How accurate are the results?
This is a serverless cost estimate. Actual bills may vary with rounding, regional pricing, free-tier eligibility, and charges for related services such as API gateways, queues, databases, logs, and monitoring.
Why can the result be $0.00?
A $0.00 serverless estimate can occur when request and compute usage are both within the entered free allowances and no data-transfer charge is included.
Does this include provisioned concurrency or reserved capacity?
No. This estimator covers on-demand function execution and optional data transfer; calculate fixed provisioned or reserved-capacity fees separately.
Arcade Mini-Game: Serverless Function Cost Estimator Calibration Run
Use this quick arcade run to practice separating useful scenario inputs from common planning mistakes before you rely on the calculator output.
Start the game, then use your pointer or arrow keys to catch useful inputs and avoid bad assumptions.
