Skip to content
Calcrivo

Cloud Functions Cost Calculator

Estimate Cloud Functions cost from invocations, memory and duration with 100 ms rounding and the free tier applied.

Inputs

millions
ms
MB
GHz

Gen 1 CPU scales with the memory tier — 512 MB gets about 0.8 GHz.

USD/million
USD/GB-s
USD/GHz-s
millions
GB-s
GHz-s
GB
USD/GB

Monthly Cost

$80.60

Invocation Charge

$7.20

Memory (GB-second) Charge

$9.00

CPU (GHz-second) Charge

$62.00

Egress Charge

$2.40

Billed GB-Seconds

3,600,000GB-s

Time Paid for but Not Used

0.0%

Cost per Million Invocations

$4.0300

Step by step

  1. Values used

    Invocations per month = 20 millions; Average execution time = 400 ms; Memory allocated = 512 MB; CPU allocated = 0.8000 GHz; Price per million invocations = 0.4000 USD/million; Price per GB-second = 0.0000 USD/GB-s; Price per GHz-second = 0.0000 USD/GHz-s; Free invocations = 2 millions; Free GB-seconds = 400,000 GB-s; Free GHz-seconds = 200,000 GHz-s; Outbound network egress = 20 GB; Egress price per GB = 0.1200 USD/GB

  2. Cloud Functions Cost

    cost = (invocations − free) ÷ 1,000,000 × invocation price + (GB-seconds − free) × GB-second price + (GHz-seconds − free) × GHz-second price, where duration is rounded up to the next 100 ms.

  3. Monthly Cost

    = 80.60

  4. Invocation Charge

    = 7.20

  5. Memory (GB-second) Charge

    = 9.00

  6. CPU (GHz-second) Charge

    = 62.00

  7. Egress Charge

    = 2.40

  8. Billed GB-Seconds

    = 3,600,000 GB-s

How it works

Cloud Functions bills three meters at once: a flat charge per invocation and two resource meters derived from execution time, one for memory and one for CPU. Because time is rounded up to the next 100 ms, a function that finishes in 130 ms is billed for 200, so short functions pay a large rounding premium that the waste figure here quantifies. Memory and CPU are linked to the same duration term, so shaving milliseconds cuts two lines of the bill at once, while over-allocating memory raises cost with no latency benefit unless the function is memory bound. Verify the per-GB-second and per-invocation prices for your region in the Google Cloud pricing calculator, and note that the free tier is per billing account.

Formula

Cloud Functions Cost

cost = (invocations − free) ÷ 1,000,000 × invocation price + (GB-seconds − free) × GB-second price + (GHz-seconds − free) × GHz-second price, where duration is rounded up to the next 100 ms.

GB-seconds
Memory in GB multiplied by rounded execution seconds, summed over invocations
GHz-seconds
CPU allocation multiplied by the same rounded seconds
100 ms rounding
Every invocation is billed in whole 100 ms increments

Frequently Asked Questions

How is Cloud Functions Cost calculated?

cost = (invocations − free) ÷ 1,000,000 × invocation price + (GB-seconds − free) × GB-second price + (GHz-seconds − free) × GHz-second price, where duration is rounded up to the next 100 ms. Cloud Functions bills three meters at once: a flat charge per invocation and two resource meters derived from execution time, one for memory and one for CPU. Because time is rounded up to the next 100 ms, a function that finishes in 130 ms is billed for 200, so short functions pay a large rounding premium that the waste figure here quantifies.

Why does Cloud Functions Cost matter?

Memory and CPU are linked to the same duration term, so shaving milliseconds cuts two lines of the bill at once, while over-allocating memory raises cost with no latency benefit unless the function is memory bound. Verify the per-GB-second and per-invocation prices for your region in the Google Cloud pricing calculator, and note that the free tier is per billing account.

What values do I need to enter?

This calculator takes 12 inputs: Invocations per month, Average execution time, Memory allocated, CPU allocated, Price per million invocations, Price per GB-second, Price per GHz-second, Free invocations, Free GB-seconds, Free GHz-seconds, Outbound network egress, Egress price per GB. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

Is more memory ever cheaper?

Sometimes. Gen 1 scales CPU with the memory tier, so doubling memory can more than halve execution time on CPU-bound work. Because both meters multiply by duration, the faster, larger configuration can bill less overall — test it rather than assuming.

You might also need