# E2B vs Modal: E2B is 30% cheaper per agent run Runtime Cloud (withruntime.com) costs 77% less than E2B, and E2B costs less than Modal. E2B uses microVMs; Modal uses gVisor or a VM. ## Which is better, E2B or Modal? It depends on GPUs and on what you already run. For CPU agents, Runtime has the lowest bill on this page, busy or waiting: $0.64 for the job, against $2.76 on E2B and $3.97 on Modal, with a Firecracker microVM for every sandbox. Pick E2B to self-host its runtime. Pick Modal for GPU sandboxes, or to keep sandboxes beside your Modal functions, endpoints and scheduled jobs. ## At a glance | | E2B | Modal Sandboxes | Runtime | | -------------- | -------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | Isolation | Firecracker microVM, own kernel | gVisor, a user-space kernel, or a VM with its own kernel; GPU sandboxes need gVisor | Firecracker microVM, own kernel, every sandbox | | CPU | $0.0504 per allocated vCPU-hour | $0.1419 per physical core-hour (2 vCPUs), requested or used | $0.025 per vCPU-hour of measured CPU, with a small floor | | Memory | $0.0162 per GiB-hour | $0.0240 per GiB-hour, requested or used | $0.0075 per reserved GiB-hour | | Plan fee | Hobby $0; Pro $150 per month | Starter $0 with $30 per month of compute; Team $250 per month | None; prepaid credit from $10 | | Free start | $100 of usage credit, once | $30 of compute per month on Starter | 100 free hours of a 1 GB machine in the first 30 days, no card | | Session length | 1 hour on Hobby, 24 hours on Pro | Up to 24 hours; snapshots carry state beyond that | No time limit: runs while it works, pauses itself after 300 seconds idle | | Pause | Files, memory and processes | Snapshots carry state past a session | Files, memory and processes, kept while you have credit | | Setup | One call | A Modal App is required outside Modal | One call; no app or project | | Agent sign-in | API key | API key | Browser approval; no key in the agent's config | ## Why is Modal more expensive for the same sandbox? Modal bills whichever is higher, the CPU a sandbox requested or the CPU it used, at $0.00003942 per physical core-second. One physical core is two vCPUs, so a 2 vCPU sandbox pays $0.1419 an hour for its core whether it works or waits. E2B bills every allocated vCPU at $0.0504 an hour, which comes to $0.1008 for the same two vCPUs. Memory follows the same pattern: $0.0240 per GiB-hour on Modal, against $0.0162 on E2B. Runtime bills neither the request nor the allocation. It measures the CPU your code uses, at $0.025 per vCPU-hour, with a floor of a twentieth of a vCPU while it waits on a model. ## Cost for the same job 1,000 runs of a 2 vCPU, 4 GiB sandbox (one physical core on Modal). Each run lasts 60 seconds and keeps the CPU busy for 20 CPU-seconds: an agent that mostly waits for a model. ``` E2B 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.76 Modal CPU 1,000 × 60 s × 1 core × $0.00003942 = $2.37 Memory 1,000 × 60 s × 4 × $0.00000667 = $1.60 Total $3.97 Runtime 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.64 ``` At 100,000 runs per month, that is $276.00 on E2B, $396.60 on Modal and $63.89 on Runtime. With both CPUs busy for the whole minute, it is $1.33 on Runtime, against $2.76 on E2B and $3.97 on Modal, so Runtime is cheaper however busy the sandbox is. A smaller Modal request lowers its figure but also caps what the sandbox can use. Plan fees, disk, network and free credits are left out. ## Is gVisor as safe as a microVM? They draw the boundary in different places. gVisor, one of Modal's two sandbox runtimes and the only one for GPU sandboxes, is in its project's words an application kernel that "intercepts application system calls and acts as the guest kernel, without the need for translation through virtualized hardware". Modal's other runtime, `vm`, runs a sandbox in a virtual machine with its own Linux kernel. A Firecracker microVM, which E2B and Runtime use on every sandbox, gives each sandbox its own Linux kernel behind hardware virtualization. [Firecracker vs gVisor](/compare/firecracker-vs-gvisor) explains the trade-off, and Runtime's model is in [security](/docs/security). ## Which one to pick - **Pick E2B** if you want a microVM per sandbox at a lower rate than Modal, or want to self-host: its runtime is Apache-2.0. Sessions past an hour need the Pro plan, $150 per month. - **Pick Modal** if your sandboxes need GPUs, or you already run Modal functions, web endpoints and scheduled jobs and want sandboxes in the same account and SDK. - **Pick Runtime** for E2B's microVM isolation at 77% below E2B's price and 84% below Modal's, with no plan fee, memory and processes kept on every pause, and an agent that connects without an API key. ## Runtime Cloud Runtime runs the same job for 77% less than E2B and 84% less than Modal. 1,000 one-minute runs of a 2 vCPU, 4 GiB sandbox cost $2.76 on E2B, $3.97 on Modal and $0.64 on Runtime, because Runtime bills the CPU your code uses rather than the CPUs it holds. Every Runtime sandbox is a Firecracker microVM with its own kernel, like E2B's. Rates checked 25 October 2026. Start on the free usage with `npx withruntime login`. Code for E2B and Modal Sandboxes switches by import, as the [migration guide](/docs/migrate) sets out. ## Switch from either one From E2B, Runtime's SDK runs your code after one import change: ```ts no-run import { Sandbox } from "withruntime/e2b"; // was: from "e2b" ``` ```python no-run from withruntime.e2b import Sandbox # was: from e2b import Sandbox ``` From Modal, the calls map directly: `modal.Sandbox.create(app=...)` becomes `Sandbox.create()`, `sb.exec(*args)` becomes `exec`, `Sandbox.from_name` becomes `Sandbox.getOrCreate(name)` and `idle_timeout` becomes `idlePauseSeconds`. No App is needed: ```python from withruntime import Sandbox with 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) ``` Or give your coding agent the one instruction in [migration](/docs/migrate): it switches the project on a branch, tests it on the free usage and reports the monthly saving. `npx withruntime compare --from modal` (or `--from e2b`) prices what you ran at the old provider's rates. Credit you add within 30 days of signing up is matched, up to $1,000 in total. The full comparisons are [Runtime vs E2B](/docs/e2b-alternative) and [Runtime vs Modal](/docs/modal-sandbox-alternative). ## Sources E2B and Modal pricing pages rechecked 25 October 2026; the rest checked 25 October 2026. - [E2B pricing](https://e2b.dev/pricing), [E2B sandbox persistence](https://docs.e2b.dev/sandbox/persistence) - [Modal pricing](https://modal.com/pricing), [Modal resources and billing](https://modal.com/docs/guide/resources), [Modal Sandboxes](https://modal.com/docs/guide/sandbox), [Modal security](https://modal.com/docs/guide/security) - [gVisor documentation](https://gvisor.dev/docs/), read 26 October 2026 - Runtime [pricing](/docs/pricing) and [security](/docs/security) Facts on this page were checked on 26 October 2026.