Which is better, Cloudflare Sandbox or Fly Machines?
It depends on which platform you build on and how much the CPU works. For agent work that idles between model calls, Runtime has the lowest cost: $0.64 for 1,000 one-minute runs, against $1.35 on Cloudflare and $1.53 on a Fly Machine. It stays the cheapest when both CPUs work. Pick Cloudflare Sandbox for a product built on Workers that wants sandboxes near users. Pick Fly Machines for general VMs in 17 regions, next to volumes and Managed Postgres.
At a glance
The Cloudflare column uses Containers rates, since the Sandbox SDK runs on
Cloudflare Containers. The Fly column uses Fly's Ashburn (iad) region.
| Cloudflare Sandbox SDK | Fly Machines | Runtime | |
|---|---|---|---|
| Isolation | A container in its own VM | Firecracker microVM | Firecracker microVM, own kernel |
| CPU | $0.072 per active vCPU-hour, metered in 10 ms steps | By size while started: $0.0916704 an hour for 2 vCPUs and 4 GB | $0.025 per vCPU-hour of measured CPU, with a small floor |
| Memory | $0.009 per provisioned GiB-hour; at least 3 GiB per vCPU | Included in the size; more at $6 per GB a month | $0.0075 per reserved GiB-hour |
| Largest | 4 vCPUs, 12 GiB and 20 GB of disk | 16 performance vCPUs and 128 GB | Up to 16 vCPUs and 64 GiB paid, chosen separately |
| Plan fee | Workers Paid, at least $5 a month | None; pay as you go | None; prepaid credit from $10 |
| Free start | No free tier; the plan includes 375 vCPU-minutes a month | Not stated on the pricing page | 100 free hours of a 1 GB machine in the first 30 days, no card |
| When idle | Filesystem-only snapshots; processes restart | Root disk is temporary; volumes keep files | Pause keeps files, memory and processes while you have credit |
| Interfaces | A TypeScript SDK called from a Cloudflare Worker | Machines API and flyctl | API, CLI, MCP server, JavaScript and Python SDKs |
Metered CPU or a flat size: where is the break-even?
These two sit at opposite ends of the billing spectrum. A Fly Machine is a fixed size at a fixed price, $0.0916704 an hour for this one, busy or idle. That makes the job $1.53 at any load. Cloudflare meters CPU at $0.000020 per vCPU-second actually used. But it will not provision 2 vCPUs with less than 6 GiB. It bills that memory plus disk for every second the sandbox is up: $0.95 of the total before any CPU is counted.
| Load per one-minute run (of 120 CPU-seconds) | Cheaper of the two |
|---|---|
| Under about 29 CPU-seconds | Cloudflare |
| Over about 29 CPU-seconds | Fly Machine |
| Both CPUs fully busy | Fly Machine, by more than half |
The Machine in these sums is a performance-2x, whose vCPUs each get a
whole core's time. A shared-cpu-2x with 4 GB would run the 1,000 minutes for about
$0.59, but each of its vCPUs is only guaranteed 6.25% of a core.
Cost for the same job
Each of the 1,000 runs is 60 seconds long on 2 vCPU, with 20 CPU-seconds of work, as an agent waiting on a model would do. Runtime gets 4 GiB, and the Machine gets 4 GB. Cloudflare needs at least 3 GiB per vCPU, so its smallest custom 2 vCPU shape has 6 GiB. It is given 12 GB of disk, the figure Cloudflare's own example uses.
- CPU
- 1,000 × 20 s × $0.000020
- $0.40
- Memory
- 1,000 × 60 s × 6 × $0.0000025
- $0.90
- Disk
- 1,000 × 60 s × 12 × $0.00000007
- $0.05
- Size
- 1,000 × 60 s / 3,600 × $0.0916704
- $1.53
- CPU
- 1,000 × 20 s / 3,600 × $0.025
- $0.14
- Memory
- 1,000 × 60 s / 3,600 × 4 × $0.0075
- $0.50
For a month of 100,000 runs: $135.04 on Cloudflare, $152.78 on Machines, and $63.89 on Runtime. With both CPUs busy for the whole minute, the job costs $1.33 on Runtime, $3.35 on Cloudflare and $1.53 on Machines. The rival totals assume each sandbox is torn down as its run ends. They leave out plan fees, Workers requests, Durable Object time, storage, network and free credit.
What is left after a run?
Cloudflare's public-beta snapshots restore saved files after a stop, but not memory or processes. Your application saves and restores them. A stopped Fly Machine bills only for storage, but its root filesystem resets, so anything durable belongs on a Fly Volume. Fly's suspend does keep memory, but only on Machines of 2 GB or less, which rules out the 4 GB Machine priced here.
Runtime's pause keeps files, memory and running processes while you have credit, at $0.08 per GB-month. The sandbox wakes on the next request. More in how to pause and resume a sandbox.
Which one to pick
- Cloudflare Sandbox fits a product built on Workers that wants sandboxes under the same account and bindings, started close to users on Cloudflare's network.
- Fly Machines fits teams that want general-purpose VMs in 17 regions, next to volumes and Managed Postgres.
- Runtime fits agent work that idles between model calls. CPU is billed by use, at 65% below Cloudflare's rate. Memory is set independently of vCPUs. A pause keeps memory and processes. SDKs for JavaScript and Python run from any backend, not only a Worker.
Porting the code
Cloudflare's 0.x calls translate directly: getSandbox(env.Sandbox, name) is
Sandbox.getOrCreate(name), sandbox.exec(cmd) is exec, and
proxyToSandbox is box.previews.create(port). On Fly, wherever the code
starts a Machine for a job, start a Runtime sandbox instead and stop it when
the job is done.
Pythonfrom withruntime import Sandboxwith Sandbox.create() as box: box.files.write("/workspace/invoice.py", "print(sum([125, 250, 375]))\n") print(box.exec("python3 /workspace/invoice.py", check=True).stdout)A coding agent can make the change for you from the one instruction in migration, on a branch, tested on the free usage. Credit you add within 30 days of signing up is matched, up to $1,000 in total. See also Runtime vs Cloudflare, Runtime vs Fly.io and E2B vs Cloudflare Sandbox.
Runtime Cloud
Runtime costs 53% less than Cloudflare and 58% less than a Fly Machine on this job. For 1,000 one-minute runs at 2 vCPU, Cloudflare charges $1.35, a Fly Machine $1.53, and Runtime $0.64. Cloudflare and Runtime both charge for CPU the code uses. Runtime's rate is 65% below Cloudflare's, and Runtime lets you pick memory without a per-vCPU minimum. Rates checked 25 October 2026.
To see the bill on your own workload, sign in with npx withruntime login and use the free usage. Moving from a Worker or a Machine is covered in the migration guide.
Sources
Fly.io prices checked 25 October 2026.
Cloudflare sandbox lifetime, snapshot behavior checked 25 October 2026. Rates checked 25 October 2026; Fly's suspend page and Cloudflare's sandbox lifecycle page read 26 October 2026.
Cloudflare Containers pricing, Containers limits and instance types, Sandbox lifecycle, Sandbox backup and restore
Fly.io pricing, Machine CPU performance, Machine suspend and resume, Fly Volumes
Runtime pricing
Facts on this page were checked on 26 October 2026.