Infrastructure

Serverless Function Cost Calculator

Estimate what your functions cost on AWS Lambda or Cloudflare Workers. Adjust invocations, duration, and memory — the estimate updates live.

Used for AWS Lambda GB-seconds calculation. Ignored for Cloudflare Workers.
Estimated monthly cost $0.00 AWS Lambda
Request cost$0.00
Compute cost$0.00

How this estimate is built

For AWS Lambda, compute cost is GB-seconds (invocations times duration in seconds times memory in GB) multiplied by the per-GB-second rate, plus a per-request fee based on invocation count. For Cloudflare Workers, compute cost is total CPU-milliseconds (invocations times duration) multiplied by the per-million-CPU-ms rate, plus its own per-request fee.

It doesn't account for free-tier allowances, provisioned concurrency charges, data transfer fees, or cold-start overhead that can add extra billed duration in practice. Treat this as a directional estimate for architecture decisions, not an exact invoice.

Frequently asked questions

How is serverless function cost calculated?

AWS Lambda bills a per-request fee plus compute measured in GB-seconds (memory allocated times execution duration). Cloudflare Workers bills a per-request fee plus compute measured in CPU-milliseconds actually used, which excludes time waiting on network I/O.

Why can Cloudflare Workers be cheaper for I/O-heavy functions?

Workers bills CPU time, not wall-clock time, so a function that spends most of its duration waiting on a database or API call is only charged for the milliseconds it actually uses the CPU. Lambda bills the full wall-clock duration regardless of waiting.

Does memory allocation affect Lambda cost even if I don't need it?

Yes. Lambda compute cost is proportional to allocated memory, not memory actually used, so over-provisioning memory directly increases your bill even if the function never touches most of it.

Related calculators

API gateway cost · Cloud VPS cost · LLM API cost · Compare: Lambda vs Cloudflare Workers