# E2B vs Modal Sandboxes

URL: https://heaven.dev/compare/e2b-vs-modal
Title: E2B vs Modal Sandboxes - the sandbox API for your agent's runs
Description: E2B and Modal Sandboxes for an agent product: pause and resume, GPUs, raw TCP, interpreters, how many run at once and what a month of runs costs.
Checked: November 21, 2026

E2B and Modal Sandboxes both let your code start isolated Linux sandboxes and pay for them by the second, and both stop a single run at 24 hours. Pick E2B when sandboxes follow a user's session: a pause keeps memory and processes with no expiry, a request can wake it, a fork copies it mid-run, and its Code Interpreter SDK returns charts as data. Pick Modal when runs need GPUs, raw TCP, a region near your users or a credit that renews: Starter includes $30 of compute every month, and Modal reports a median start under 500 ms at scale.

## E2B vs Modal Sandboxes features

| Running time and state | E2B | Modal Sandboxes |
| --- | --- | --- |
| **Longest uninterrupted run** | 1 hour on Hobby, 24 hours on Pro. Resuming starts the clock again | 5 minutes by default, 24 hours at most |
| **When a run ends** | Deleted, unless auto-pause keeps it, with no expiry | Ends. A snapshot can start a new Sandbox with its files |
| **Freeze it with memory and processes** | ✓ Pause, resumed in about 1 second | Alpha memory snapshots: they end the original, restore within 7 days and skip GPU Sandboxes |
| **Wakes when a request arrives** | ✓ Opt-in auto-resume | ✗ Your code starts a new Sandbox |
| **Branch a running sandbox** | ✓ Fork with memory, up to 20 copies a call | ✓ Snapshot its filesystem and start copies |
| **How long saved state is kept** | Paused sandboxes have no expiry | Filesystem snapshots 30 days by default, or forever. Memory snapshots 7 days |

| Cost and limits | E2B | Modal Sandboxes |
| --- | --- | --- |
| **Rates while running** | $0.0504 a vCPU-hour and $0.0162 a GiB-hour | About $0.142 a core-hour (2 vCPUs) and $0.024 a GiB-hour, at the higher of request and use |
| **Free usage** | $100 once | ✓ $30 every month on Starter |
| **Sizes on the free plan** | The default 2 vCPUs and 512 MiB only | ✓ The CPU and memory you request |
| **Paid plan** | Pro, $150 a month: custom sizes, 24-hour runs | Team, $250 a month with $100 of compute: any number of seats, 5,000 containers |
| **Sandboxes at once** | 10 on Hobby, 100 on Pro, up to 1,100 with add-ons | 100 on Starter, 5,000 on Team |
| **Where it runs** | 5 regions. US West by default, the rest on request | 19 locations to choose from, at 1.15 to 1.75 times the rate |

| Building on it | E2B | Modal Sandboxes |
| --- | --- | --- |
| **What each sandbox is** | A Firecracker microVM with its own kernel | A gVisor container, or a Linux VM that runs Docker and systemd |
| **GPUs** | ✗ CPU only | ✓ T4 to B300, by the second. GPU Sandboxes can be preempted |
| **Code interpreter that keeps variables** | ✓ Returns charts and tables as data | Build your own over the Sandbox's input and output |
| **Computer-use agents** | ✓ Desktop template with screenshot and input APIs | A VNC recipe for a VM Sandbox |
| **Public TCP ports** | ✗ HTTP and WebSocket only | ✓ Raw TCP tunnels |
| **Custom domains** | ✓ Every plan | Team and Enterprise |
| **API keys kept out of the sandbox** | ✓ Secrets added to outbound requests | Beta: an outbound policy adds headers to HTTPS calls |
| **Fixed outbound address** | Through a proxy you run | Team and Enterprise, through a static egress proxy |

Both run your own images, keep previews private behind tokens, limit outbound traffic by CIDR or domain, and have SOC 2 and a HIPAA option.

## Who should pick E2B

E2B fits an agent product where each user has a sandbox that comes and goes with their session.

- **Sessions that resume.** A full pause keeps files, memory and processes with no expiry, compute billing stops while it's paused, and auto-resume wakes it when a request arrives. A user can leave mid-task and return the next day.

- **Branching from a running state.** One fork call copies a running sandbox, memory included, into up to 20 new ones.

- **Ready-made parts.** The Code Interpreter SDK keeps variables and returns charts, the Desktop template gives computer-use agents screenshot and input APIs, and ACP starts a coding agent and streams its session to your app.

- **Your own infrastructure.** E2B Embed is open source under Apache-2.0, and Enterprise can run in your AWS, Google Cloud or Azure account.

It isn't the fit for GPU work, or for runs over an hour or above 512 MiB without Pro at $150 a month.

## Who should pick Modal Sandboxes

Modal fits code that fans out many runs from Python and needs more than a CPU box to do it.

- **GPUs by the second.** A Sandbox can attach anything from a T4 to a B300 and pay per second. GPU Sandboxes can be preempted, so their work should survive a retry.

- **A credit that renews.** Starter includes $30 of compute every month, any size you request, and 100 containers at once, with no monthly fee.

- **Scale and regions.** Modal measured a median under 500 ms from create to running code while launching a million Sandboxes. You can pin Sandboxes to 19 locations, and a Sandbox can burst past its request when capacity is free.

- **A VM when you need one, and raw TCP.** The VM runtime runs Docker and systemd, and tunnels can expose raw TCP as well as HTTPS.

It isn't the fit when a user's sandbox has to come back with its memory, since memory snapshots are in alpha, end the original and expire after 7 days.

## Pricing

| Plan | Price | What you get |
| --- | --- | --- |
| **E2B Hobby** | $0 plus usage, $100 of credit once | The default 2 vCPU, 512 MiB sandbox, 10 at once, runs up to 1 hour |
| **E2B Pro** | $150 a month plus usage | Sizes up to 8 vCPUs and 8 GiB, 100 at once, runs up to 24 hours |
| **Modal Starter** | $0 plus usage | $30 of compute a month, 3 seats, 100 containers at once, 1 TiB of egress |
| **Modal Team** | $250 a month plus usage | $100 of compute a month, any number of seats, 5,000 containers, 10 TiB of egress |

A Modal core is 2 vCPUs, and Modal bills at least what a Sandbox requests. At E2B's default size, 2 vCPUs and 512 MiB, an hour costs $0.1089 on E2B and $0.1539 on Modal.

**300 short runs.** 300 runs a month of 20 minutes at that size are 100 hours: **$10.89** on E2B Hobby, covered by the one-time credit for about nine months, and **$0** on Modal, inside the monthly credit.

**A coding agent's long runs.** 60 runs a month of 2 hours at 2 vCPUs and 4 GiB are 120 hours. E2B needs Pro for the size and the length: **$169.87**. Modal comes to $28.56, so **$0** after Starter's credit.

**A busy month.** At 1,000 hours of the default size, E2B Hobby costs **$108.90** and Modal **$123.92** after its credit. Modal costs less until about 666 hours a month at this size, and E2B costs less above it, as long as 512 MiB is enough.

## Frequently asked questions

### Which is cheaper for a month of agent runs?

Modal, below about 666 run-hours a month at 2 vCPUs and 512 MiB, because of its $30 monthly credit. Above that, E2B Hobby costs less if 512 MiB is enough. Runs that need more memory or more than an hour put E2B on Pro at $150 a month.

### Can a user come back to the same sandbox the next day?

On E2B, yes. A full pause keeps files, memory and processes, with no expiry. Modal ends a Sandbox when it times out, and a filesystem or alpha memory snapshot starts a new one. Memory snapshots expire after 7 days.

### Can either run a job for more than 24 hours?

Not in one run. Both stop a run at 24 hours, and E2B Hobby at 1 hour. E2B starts the clock again when a paused sandbox resumes.

## Also consider Heaven

Heaven, which we make, is cloud infrastructure for software factories. Each agent or app gets a Computer: a full Linux VM with root that keeps running with nobody connected, and a team's Computers share one pool of CPU, memory and storage. Every Computer comes with an HTTPS website with sign-in in front, share links, custom domains, public TCP ports, email, snapshots and hourly off-site backups, and integrations keep GitHub and API credentials outside the machine. Plans start at $20 a month for 2 vCPUs and 8 GiB, with any number of members. See [pricing](https://heaven.dev/pricing).

## Related comparisons

See [E2B alternatives](https://heaven.dev/alternatives/e2b), [Modal Sandboxes alternatives](https://heaven.dev/alternatives/modal), [E2B vs Daytona](https://heaven.dev/compare/e2b-vs-daytona), [Daytona vs Modal Sandboxes](https://heaven.dev/compare/daytona-vs-modal) and [the best code sandboxes for AI agents](https://heaven.dev/compare/best-code-sandboxes-for-ai-agents).

## Sources and corrections

| Source | Checked |
| --- | --- |
| [E2B pricing](https://e2b.dev/pricing) | November 20, 2026 |
| [E2B plans and limits](https://docs.e2b.dev/billing#plans) | November 19, 2026 |
| [E2B auto-pause and persistence](https://docs.e2b.dev/sandbox/persistence.md) | November 19, 2026 |
| [E2B auto-resume](https://docs.e2b.dev/sandbox/auto-resume.md) | November 19, 2026 |
| [E2B fork](https://docs.e2b.dev/sandbox/fork#create-multiple-forks) | November 20, 2026 |
| [E2B GPU support](https://docs.e2b.dev/faq/gpu-support.md) | November 19, 2026 |
| [E2B SDKs](https://docs.e2b.dev/quickstart.md) | November 19, 2026 |
| [E2B interpreter contexts](https://docs.e2b.dev/code-interpreting/contexts.md) | November 19, 2026 |
| [E2B computer use](https://docs.e2b.dev/use-cases/computer-use.md) | November 19, 2026 |
| [E2B ACP](https://docs.e2b.dev/agents/acp.md) | November 19, 2026 |
| [E2B ingress access](https://docs.e2b.dev/network/restrict-public-access.md) | November 19, 2026 |
| [E2B custom domains](https://docs.e2b.dev/network/custom-domain.md) | November 19, 2026 |
| [E2B secrets injection](https://docs.e2b.dev/secrets/inject.md) | November 19, 2026 |
| [E2B regions](https://docs.e2b.dev/faq/egress-ip-ranges.md) | November 19, 2026 |
| [E2B BYOC](https://docs.e2b.dev/byoc) | November 19, 2026 |
| [E2B Embed](https://github.com/e2b-dev/runtime/tree/main/embed) | November 19, 2026 |
| [Modal pricing](https://modal.com/pricing) | November 19, 2026 |
| [Modal Sandbox timeouts](https://modal.com/docs/guide/sandboxes#timeouts) | November 19, 2026 |
| [Modal runtimes](https://modal.com/docs/guide/sandboxes#runtimes) | November 19, 2026 |
| [Modal Sandbox resources and billing](https://modal.com/docs/guide/sandbox-resources.md) | November 19, 2026 |
| [Modal GPU Sandboxes](https://modal.com/docs/guide/sandbox-resources#gpu-sandboxes) | November 19, 2026 |
| [Modal snapshots](https://modal.com/docs/guide/sandbox-snapshots.md) | November 19, 2026 |
| [Modal memory snapshot limits](https://modal.com/docs/guide/sandbox-snapshots#limitations) | November 19, 2026 |
| [Modal Sandbox networking](https://modal.com/docs/guide/sandbox-networking.md) | November 19, 2026 |
| [Modal static egress](https://modal.com/docs/guide/proxy-ips.md) | November 19, 2026 |
| [Modal secret injection](https://modal.com/docs/guide/sandbox-secret-injection) | November 19, 2026 |
| [Modal interpreter example](https://modal.com/docs/examples/simple_code_interpreter) | November 19, 2026 |
| [Modal computer-use example](https://modal.com/docs/examples/computer_use_vnc) | November 19, 2026 |
| [Modal JavaScript and Go SDKs](https://modal.com/docs/guide/sdk-javascript-go) | November 19, 2026 |
| [Modal regions](https://modal.com/docs/guide/region-selection.md) | November 19, 2026 |
| [Modal scale test](https://modal.com/blog/scaling-to-1-million-concurrent-sandboxes-in-seconds) | November 19, 2026 |

Spot an error? Email support@heaven.dev with the page, the claim and a source.
