Windows Sandbox: Test Suspicious Files Safely

Windows 11 desktop screenshot showing the Windows Sandbox window open in the center, running a clean, isolated copy of Windows 11
Windows Sandbox is a small, disposable copy of Windows that runs inside your normal Windows. You can open a file or install a program in it, and when you close it, everything inside is deleted. It is a useful way to check a program you are not sure about. It is not a perfect shield, and this guide explains the limits. Registry changes can be tried there first too; see how to test registry changes safely.

What you need

  • Windows 10 or 11 Pro, Enterprise or Education. Windows Home does not include Sandbox.
  • A processor with at least 2 cores (4 cores with hyper-threading is recommended), a standard 64-bit (AMD64) PC or, on Windows 11 22H2 and later, an Arm64 PC. Virtualization must be turned on (see enable virtualization in the BIOS).
  • At least 4 GB of RAM (8 GB is better) and 1 GB of free disk space (an SSD is recommended).
These figures come from Microsoft's Install Windows Sandbox page on Microsoft Learn.

Step-by-step: use Windows Sandbox

Step 1: Check your Windows edition

Open Settings > System > About and look at Edition. If it says Home, Sandbox is not available. Consider a virtual machine instead.

Step 2: Turn the feature on

  1. Search the Start menu for Turn Windows features on or off.
  2. Tick Windows Sandbox and select OK.
  3. Restart the PC when asked.
You can also run this command in Windows PowerShell as administrator, and then restart:
Enable-WindowsOptionalFeature -Online -FeatureName "Containers-DisposableClientVM" -All
You should see: Windows Sandbox in the Start menu after the restart. If the tick box is missing or greyed out, your edition does not include it or virtualization is off.

Step 3: Start Windows Sandbox

Open Windows Sandbox from the Start menu. A clean Windows desktop opens in a window. You should see: a plain Windows desktop in its own window within about a minute. If you get a virtualization error instead, see "If the Sandbox will not start" below. On Windows 11 version 24H2 and later, Windows Sandbox can update itself to a newer version from the Microsoft Store, with a new look. Microsoft says this version adds controls while it runs (the … icon at the top right) for clipboard sharing, audio and video input and folder sharing, plus an early command line. The steps below work the same in both versions, but the window and menus may not match this guide exactly. See Microsoft's Windows Sandbox versions page.

Step 4: Copy the file into the Sandbox

Copy the file on your normal desktop (Ctrl + C) and paste it (Ctrl + V) into the Sandbox window. Do not copy your private files into it. If copy and paste stops working between your PC and the Sandbox, see our guide to fixing copy and paste in Windows.

Step 5: Run and watch

Open the file or run the installer inside the Sandbox. Watch for warnings, unexpected pop-ups and attempts to download other programs.

Step 6: Close the Sandbox

When you close the window, Windows warns that all content will be discarded and deleted. Select OK. Nothing you installed there stays on your PC.

Limits you should know

  • By default, the Sandbox has network access, so a malicious program can still use the internet from inside it. Microsoft warns that this can expose untrusted programs to your internal network. Turn networking off with the configuration file below.
  • Clipboard sharing with your real PC is also on by default, so anything you copy on your PC can be read inside the Sandbox. Do not copy passwords or private text while it is open, or turn clipboard sharing off with the file below.
  • Do not sign in to your real accounts or type real passwords inside it.
  • It is not a replacement for an antivirus. Scan files first (see remove a virus or malware).
  • Some advanced malware tries to detect virtual environments.
  • Only use it to test files you have a good reason to test, and delete anything you do not trust.

Turn networking and clipboard sharing off

Open Notepad and paste this text. Save it with the name safe.wsb (choose All files as the type, so it does not end in .txt):
<Configuration>
  <Networking>Disable</Networking>
  <ClipboardRedirection>Disable</ClipboardRedirection>
</Configuration>
Double-click the file to start the Sandbox with those settings. With the clipboard off, you can no longer paste files in, so use the next section to hand the Sandbox a folder instead. Networking off also stops downloads: that is the point.

Test a file without network, clipboard or write access

First create a folder named ToTest on your Desktop and put the one file in it. Then save this as test-file.wsb, replacing YourName with your Windows user name:
<Configuration>
  <VGpu>Disable</VGpu>
  <Networking>Disable</Networking>
  <ClipboardRedirection>Disable</ClipboardRedirection>
  <MappedFolders>
    <MappedFolder>
      <HostFolder>C:\Users\YourName\Desktop\ToTest</HostFolder>
      <SandboxFolder>C:\Users\WDAGUtilityAccount\Desktop\ToTest</SandboxFolder>
      <ReadOnly>true</ReadOnly>
    </MappedFolder>
  </MappedFolders>
</Configuration>
You should see: the Sandbox opens with a ToTest folder on its desktop, no internet and no way to paste in or out. Because the folder is read-only, a malicious file cannot change the original on your PC. If the Sandbox shows an error and closes, the host folder path is wrong: the folder must already exist and the user name must match. The setting names (VGpu, Networking, ClipboardRedirection, MappedFolders, ReadOnly) are the ones Microsoft documents for .wsb files. Microsoft's own sample for testing unknown downloads works the same way, with networking and the virtual GPU off and a read-only folder. See Use and configure Windows Sandbox for every option. The exact files above were not run on a real PC for this guide.

Common mistakes

  • Testing with networking on. A program can still send data out or download more malware.
  • Mapping a folder as writable, or mapping your whole Documents folder. Map one small test folder, read-only.
  • Saving the file as safe.wsb.txt. Windows then opens it as a text file. Show file extensions to check the name.
  • Treating a clean result as proof the file is safe. A program can wait or detect a virtual environment and behave well in it.

If the Sandbox will not start

More help

For more security and Windows guides, browse the PC Repair Atlas homepage.

FAQ

Can I use Windows Sandbox on Windows 11 Home? No. It needs Pro, Enterprise or Education. Are my files safe inside it? Files you put in are deleted when it closes. Files on your normal PC are not shared unless you choose to share them. Is it safe to run real malware in it? No. It is meant for testing doubtful files, not for experiments with live malware.