E2B vs Cloudflare Sandbox: pricing, isolation and limits
E2B is a microVM API billed on allocated CPU; Cloudflare runs a container in a VM from a Worker, billed on active CPU.
On a model-bound agent job Runtime costs 77% less than E2B and 53% less than Cloudflare, with no Worker and no plan to join. 1,000 one-minute runs at 2 vCPU are $2.76 on E2B, $1.35 on Cloudflare and $0.64 on Runtime. Like Cloudflare, Runtime charges for CPU in use, but at about a third of Cloudflare's rate, and memory is whatever size the job needs. Rates checked 23 September 2026.
Estimated compute cost
77% less than E2B53% less than Cloudflare Sandbox
2 vCPUs · 4 GiB · 60 s a run · 20 CPU-seconds busy
Compute only, at list rates checked 23 September 2026 (E2B pricing, Cloudflare Containers pricing). Plan fees, network, taxes and free credits are left out. The worked example below shows the arithmetic.
At a glance
The Cloudflare figures are Cloudflare Containers rates, which is what the Sandbox SDK runs on and is billed as.
| E2B | Cloudflare Sandbox SDK | Runtime | |
|---|---|---|---|
| Isolation | Firecracker microVM, own kernel | A container in its own VM | Firecracker microVM, own kernel |
| CPU | $0.0504 per allocated vCPU-hour | $0.072 per active vCPU-hour, metered in 10 ms steps | $0.025 per vCPU-hour of measured CPU, with a small floor |
| Memory | $0.0162 per GiB-hour | $0.009 per provisioned GiB-hour; at least 3 GiB per vCPU | $0.0075 per reserved GiB-hour |
| Disk | Included, no separate charge | $0.000252 per provisioned GB-hour | Included while running; paused storage $0.08 per GB-month |
| Plan fee | Hobby $0; Pro $150 a month | Workers Paid, at least $5 a month | None; prepaid credit from $10 |
| Free start | $100 of usage credit, once | No free tier; the plan includes 375 vCPU-minutes a month | 50 sandbox hours, no card |
| When idle | Pause keeps files, memory and processes | Sleeps after 10 idle minutes by default; files are lost | Pause keeps files, memory and processes, 1 to 365 days |
| Interfaces | API, CLI, MCP server, JavaScript and Python SDKs | A TypeScript SDK called from a Cloudflare Worker | API, CLI, MCP server, JavaScript and Python SDKs |
Which is cheaper, E2B or Cloudflare?
For a waiting agent, Cloudflare. It meters CPU only while the code runs, $0.000020 per vCPU-second, and its memory is cheaper per GiB than E2B's. E2B charges for every allocated vCPU from start to stop. Cloudflare's cost comes from its shapes: a custom size needs at least 3 GiB per vCPU, so 2 vCPUs carry 6 GiB, and provisioned disk is billed on top.
That fixed part is about a third of E2B's hourly price, so Cloudflare stays cheaper until the code averages around 1.5 busy CPUs out of 2, some 90 CPU-seconds a minute. At full load E2B wins, $2.76 against $3.35. Runtime meters CPU at $0.025 a vCPU-hour, about a third of Cloudflare's $0.072, with memory set apart from vCPUs, and is below both at any load.
Cost for the same job
The case priced: 1,000 runs on 2 vCPU, 60 seconds each, 20 CPU-seconds of work per run. E2B and Runtime have 4 GiB. Cloudflare's smallest 2 vCPU shape has 6 GiB and is given 12 GB of disk, the size in Cloudflare's example.
TextE2B CPU 1,000 × 60 s / 3,600 × 2 × $0.0504 = $1.68 Memory 1,000 × 60 s / 3,600 × 4 × $0.0162 = $1.08 Total $2.76Cloudflare 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 Total $1.35Runtime CPU 1,000 × 20 s / 3,600 × $0.025 = $0.14 Memory 1,000 × 60 s / 3,600 × 4 × $0.0075 = $0.50 Total $0.64That is $276.00 on E2B, $135.04 on Cloudflare and $63.89 on Runtime over 100,000 runs in a month. With both CPUs busy for the whole minute, it is $1.33 on Runtime, $2.76 on E2B and $3.35 on Cloudflare. Cloudflare is priced as if each sandbox were destroyed after its run. Plan fees, Workers requests, Durable Object time, network and free credit are left out.
What happens to an idle sandbox?
A paused E2B sandbox keeps its files, memory and running processes, with no expiry. A Cloudflare sandbox sleeps after 10 idle minutes by default and starts again from its image, with its files gone unless you backed them up to R2 first. A paused Runtime sandbox keeps files, memory and running processes for the retention you set, 1 to 365 days, and wakes on the next request. See how to pause and resume a sandbox.
Which one to pick
- E2B, for a microVM API that any backend can call, paused sandboxes that never expire, or an Apache-2.0 runtime you can host yourself.
- Cloudflare Sandbox, for an app that already runs on Workers and wants its sandboxes on the same account, bill and bindings, near its users.
- Runtime, for CPU billed by use at about a third of Cloudflare's rate, memory sized to the job, a pause that keeps memory and processes, and an API that needs no platform around it.
Moving to Runtime
E2B code changes one import:
TypeScriptimport { Sandbox } from "withruntime/e2b"; // was: from "e2b"Pythonfrom withruntime.e2b import Sandbox # was: from e2b import SandboxCloudflare code maps call for call and can then run on any server:
getSandbox(env.Sandbox, name) is Sandbox.getOrCreate(name),
sandbox.exec(cmd) is exec, and proxyToSandbox is
box.previews.create(port). An app that stays on Workers can still call
Runtime from the Worker, with SDK 0.4.0 or later and the nodejs_compat
flag; the sample is in
Runtime vs Cloudflare.
TypeScriptimport { Sandbox } from "withruntime";const box = await Sandbox.create({ funding: "trial" });try { console.log((await box.exec("python3 -c 'print(6 * 7)'", { check: true })).stdout);} finally { await box.stop();}Before the first top-up, npx withruntime switch --from cloudflare or
--from e2b matches it with credit, up to $100. A coding agent can handle the
port from the one instruction in migration, on a branch and
against the free trial. For E2B in depth, see
Runtime vs E2B.
Sources
E2B and Cloudflare Containers pricing pages rechecked 25 September 2026; the rest checked 23 September 2026.
- E2B pricing, E2B sandbox persistence
- Cloudflare Containers pricing, Containers limits and instance types, Containers architecture, Sandbox lifecycle, Sandbox backup and restore
- Runtime pricing
Facts on this page were checked on 25 September 2026.