# Claude Code Sandbox

> A wall that keeps Claude's shell commands in set folders and sites.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** Sandboxing, /sandbox, sandbox-runtime

## Think of it like

It is like a fence around a yard. The dog can run, but not get out.

## Definition

The Claude Code sandbox runs the shell commands Claude starts inside a wall set by your computer's system. You choose up front which folders they may write to and which sites they may reach. Inside that wall, commands can run without asking, since they cannot reach anything else. It is off at first, and you turn it on with /sandbox. It is a separate layer from permission rules, and the two work together.

## Example

Emma turns on the sandbox. Now Claude can run build scripts without prompts, and a script that tries to read her home folder is simply blocked.

## Example code

```console
/sandbox
```

Turn on the sandbox for shell commands.

## Why it matters

It cuts prompts and adds safety at the same time, because the walls do the checking.

## Common mistake

Thinking it covers every tool. It wraps shell commands, so keep permission rules for the other tools too.

## Three principles

- **A boundary.** Set by the system.
- **Folders and sites.** You choose them.
- **Off by default.** Turn on with /sandbox.

## Related terms

- [Agent Sandbox](https://learn.benibix.com/term/ai/agent-sandbox)
- [Permission Rule](https://learn.benibix.com/term/ai/permission-rule)
- [Auto Mode](https://learn.benibix.com/term/ai/auto-mode)
- [Bypass Permissions Mode](https://learn.benibix.com/term/ai/bypass-permissions-mode)

## Told apart from

- [Bash Permission Rule vs Sandbox](https://learn.benibix.com/compare/bash-permission-rule-vs-claude-code-sandbox): People think a Bash deny rule is a wall around a program. It is a check on the text Claude writes. Bash(rm *) stops rm, but not /bin/rm or sh -c 'rm'. The sandbox works lower down. It limits which files and hosts any command can reach, however it is spelled. Use rules to cut prompts, and the sandbox for a hard limit.
- [Claude Code Dev Container vs Sandbox](https://learn.benibix.com/compare/claude-code-dev-container-vs-claude-code-sandbox): People think the sandbox and a dev container are the same wall. They are not. The sandbox wraps only the shell commands Claude starts, on your own computer. A dev container is a whole separate box, with its own tools and files, and Claude Code itself runs inside it. Use the sandbox for safe commands on your machine. Use a dev container to give a team one shared, walled-off setup.

## Taught in

- [Permission Rules and Sandbox](https://learn.benibix.com/learn/ai-claude-code/permission-rules-and-sandbox): Claude Code, 6/16

![Shell commands run inside a box. They can reach the project folder and allowed sites, and nothing else.](https://learn.benibix.com/diagrams/cc-claude-code-sandbox.svg)

---

Source: https://learn.benibix.com/term/ai/claude-code-sandbox
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-19
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
