"We spent two days on a Windows install loop before finding the execution policy note. That single line unblocked the whole team. The WSL route is now our standard for new starters."— Bastian E. LindqvistPlatform Engineer · Northbrume Oy · Helsinki
Claude Code on Windows
Two practical routes for getting Claude Code running on Windows: the native PowerShell path and a WSL-based setup. Each route is documented step by step with the exact commands that work.
Common gotcha
Windows Execution Policy can silently block npm-installed scripts. If claude is on PATH but fails to launch, run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser in an elevated PowerShell session before trying again.
Choosing your route: native PowerShell vs WSL
Claude Code on Windows works through two distinct paths, and picking the right one at the start saves you a session's worth of configuration later.
The native PowerShell route installs Node and Claude Code directly on the Windows side. It is the faster route to reach a working binary, and it is the natural choice if your project files live on a Windows drive and you do not need Linux-specific tooling. The trade-off is that Windows line endings and path separators occasionally create friction when the CLI writes files that another tool expects in Unix format.
The WSL route runs the entire Claude Code install inside a Linux environment hosted by Windows Subsystem for Linux 2. It is the better option for teams that deploy to Linux, use shell scripts that assume Bash semantics, or want the same environment locally as in CI. Setup takes a few extra minutes to enable WSL and install a distribution, but day-to-day use feels identical to a Linux terminal — because it is one.
Both routes ultimately run the same npm install -g @anthropic-ai/claude-code command. The difference is which shell you open when you use Claude Code each day, and where the API key lives.
Native PowerShell installation steps
The steps below assume a clean Windows 10 or Windows 11 machine. If Node is already installed, skip to step two.
Step 1 — Install Node.js on Windows
Download the current LTS release from the official Node.js site and run the installer. On the setup screen that asks about optional tools, make sure Add to PATH is checked. After install, open a new PowerShell window and verify.
node --version # should read v18.x.x or higher
npm --version # should read 9.x.x or higher
Step 2 — Install Claude Code
In PowerShell, run the global install. If your terminal reports a permissions error, open PowerShell as Administrator and retry.
npm install -g @anthropic-ai/claude-code
Step 3 — Confirm the binary
Close and reopen PowerShell so the new PATH entry is loaded, then check the version.
claude --version
If the shell reports "command not found" or "unrecognized", the npm global bin directory is not in PATH. Add it manually through System Properties > Environment Variables > User PATH. The typical value to add is C:\Users\<YourName>\AppData\Roaming\npm.
Step 4 — Set the API key in the PowerShell profile
Open your PowerShell profile file (create it if it does not yet exist) and add the key export.
# Open the profile in Notepad
notepad $PROFILE
# Add this line to the file:
$env:ANTHROPIC_API_KEY = "sk-ant-..."
# Save, close Notepad, then reload:
. $PROFILE
Step 5 — Run the auth check
claude auth
A success message prints the account email. If you see a 401 error, the key variable was not loaded — confirm $env:ANTHROPIC_API_KEY prints the key value, then retry.
WSL installation steps
Use this route if you want a Linux shell environment on Windows.
Step 1 — Enable WSL2 and install Ubuntu
# In PowerShell (Administrator):
wsl --install
# After reboot, open Ubuntu from Start and set up your Linux username.
# Verify WSL version:
wsl --list --verbose
Step 2 — Install Node inside WSL
# Inside the Ubuntu terminal:
sudo apt update
sudo apt install -y nodejs npm
# Or use nvm for version control:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 20
nvm use 20
Step 3 — Install Claude Code inside WSL
npm install -g @anthropic-ai/claude-code
claude --version
Step 4 — Set the API key in ~/.bashrc or ~/.zshrc
echo 'export ANTHROPIC_API_KEY="sk-ant-..."' >> ~/.bashrc
source ~/.bashrc
claude auth
Windows route comparison
The table below summarises the key differences between the two installation paths so you can pick the one that fits your workflow.
| Step | PowerShell command | Notes |
|---|---|---|
| Verify Node version | node --version |
Must be v18 or higher on both routes |
| Install Claude Code | npm install -g @anthropic-ai/claude-code |
Same command on native and WSL |
| Verify binary (native) | claude --version |
Run after reopening PowerShell |
| Set API key (native) | $env:ANTHROPIC_API_KEY = "..." in $PROFILE |
Persists across PowerShell sessions |
| Set API key (WSL) | export ANTHROPIC_API_KEY="..." in ~/.bashrc |
Persists inside the WSL environment |
| Auth check | claude auth |
Same on both routes |
Windows Terminal as the recommended host
Windows Terminal handles Unicode output correctly and supports tabs that switch between PowerShell, WSL, and Command Prompt profiles. The legacy conhost.exe terminal can display garbled characters in Claude Code's output — switching to Windows Terminal resolves that without any other change. Install Windows Terminal from the Microsoft Store if it is not already present on your machine.
For a broader look at AI tool safety frameworks relevant to corporate Windows deployments, the MIT CSAIL research publications cover agent autonomy and oversight patterns that are directly applicable to Claude Code rollouts in managed environments.
Frequently asked questions about Claude Code on Windows
Should I use the native PowerShell route or WSL for Claude Code on Windows?
The native PowerShell route is faster to set up and works well if your project files live on the Windows filesystem. WSL is the better choice for teams deploying to Linux, using shell scripts with Unix line endings, or wanting a consistent environment with CI. Both routes install Claude Code the same way; the difference is the shell profile where the API key lives and which terminal you open each day.
Why does claude --version fail after installing on Windows?
The most common cause is that Node's global bin directory is not in the Windows PATH. Open System Properties > Environment Variables, find the Path entry under User variables, and add the npm global bin path (typically C:\Users\<you>\AppData\Roaming\npm). Close and reopen PowerShell, then try claude --version again. A second cause is an Execution Policy that blocks the script — run Set-ExecutionPolicy RemoteSigned -Scope CurrentUser to fix it.
How do I set ANTHROPIC_API_KEY permanently on Windows?
Add it to your PowerShell profile by opening $PROFILE in a text editor and adding $env:ANTHROPIC_API_KEY='sk-ant-...'. Save and reload with . $PROFILE. Alternatively, set it as a User environment variable via Control Panel so it is available in every shell, not just PowerShell.
Can I install Claude Code inside WSL on Windows?
Yes. Enable WSL2, install Ubuntu from the Microsoft Store, then inside the WSL terminal run sudo apt update && sudo apt install nodejs npm followed by npm install -g @anthropic-ai/claude-code. Add ANTHROPIC_API_KEY to ~/.bashrc inside WSL. The binary lives in the WSL filesystem and is reached from the WSL terminal only.
Does Claude Code on Windows support Windows Terminal?
Yes, and it is the recommended terminal host. Windows Terminal handles Unicode output correctly and supports tabs with separate PowerShell and WSL profiles. The legacy conhost terminal can display garbled characters — switching to Windows Terminal resolves that without any other configuration change. Install it from the Microsoft Store if not already present.
Related topics
If you came here looking for the broader install claude code reference that covers all three platforms, that hub page sits one level up in the silo. The CLI setup guide picks up where this page ends — it covers the full list of environment variables, shell profile patterns for both PowerShell and Bash, and the PATH configuration steps in more depth. The claude code download page explains the version naming convention and how to verify a package download before running it.
Teams using the windowed client alongside the terminal will find the claude code desktop page useful — it covers the Windows desktop client specifically and explains how its version number relates to the CLI release. The claude ai download reference lists every downloadable artefact in one place. For model selection after install, start with the models overview and consult the claude api reference when you are ready to integrate beyond the CLI.
Need the full environment setup?
The CLI setup guide covers every environment variable, PATH configuration, and auth flow step for Windows, macOS, and Linux in one place.
Go to CLI setup