Claude Code on Windows: Complete Installation Guide (2026)

Install Claude Code on Windows 10/11 via WSL2, native PowerShell, Docker, or VS Code Dev Containers. Covers prerequisites, configuration, performance tuning, and common issues.

March 6, 2026 ยท 2 min read

Claude Code was built for macOS and Linux. On Windows, the installation method you choose determines whether you get full compatibility or a subset of features. This guide covers four approaches, ranked by reliability.

4
Installation methods
< 5 min
WSL2 setup time
3-5x
Faster on Linux FS
0
Node.js required (native)

WSL2 is the recommended path

If you want every Claude Code feature to work as documented, use WSL2. The native PowerShell installer covers basic usage, but file watching, some MCP servers, and shell integrations work more reliably in a Linux environment. Docker and Dev Containers are good alternatives when WSL2 is not an option.

Prerequisites

Before installing, confirm these requirements:

  • Windows version: Windows 10 version 2004+ (Build 19041) or Windows 11
  • RAM: 8 GB minimum (16 GB recommended if using WSL2 or Docker)
  • Disk: 2 GB free for WSL2 + Claude Code, 500 MB for native install
  • Account: Claude Pro ($20/month), Max ($100-200/month), Teams, Enterprise, or Anthropic Console with API credits

The free Claude.ai plan does not include Claude Code access. You need a paid account.

Node.js (only for npm method)

The native installer and Docker methods do not require Node.js. If you plan to use the npm installation path inside WSL2, install Node.js 18+ using one of these methods:

Install Node.js (inside WSL2)

# Option 1: nvm (recommended, avoids permission issues)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
nvm install 22

# Option 2: apt (Ubuntu/Debian)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs

On native Windows, install via winget install OpenJS.NodeJS.LTS, the Node.js installer, or choco install nodejs-lts if you use Chocolatey.

Method 1: WSL2 (Recommended)

WSL2 runs a real Linux kernel on Windows. Claude Code operates exactly as it would on a native Linux machine: file watching, git hooks, shell integration, MCP servers, everything works.

Step 1: Install WSL2

Open PowerShell as Administrator and run:

Install WSL2

wsl --install

This installs WSL2 with Ubuntu as the default distribution. Restart your computer when prompted. After reboot, Ubuntu opens and asks you to create a Linux username and password.

Step 2: Install Claude Code inside WSL2

Open your WSL2 terminal (search "Ubuntu" in the Start menu) and run:

Install Claude Code in WSL2

# Native installer (recommended, no Node.js needed)
curl -fsSL https://claude.ai/install.sh | bash

# Or via npm if you prefer
npm install -g @anthropic-ai/claude-code

Step 3: Verify the installation

Verify installation

# Check claude is on your PATH
which claude

# Start Claude Code
cd ~/projects/your-project
claude

On first launch, Claude Code opens your browser for authentication. Authorize it with your Anthropic account. The session token is stored in your WSL2 home directory.

Keep projects in the Linux filesystem

Store your code at ~/projects/ inside WSL2, not at /mnt/c/Users/.../. Accessing Windows drives from WSL2 crosses a filesystem boundary that adds latency to every file read and write. The difference is 3-5x on typical codebases. You can still access these files from Windows Explorer by navigating to \\wsl$\Ubuntu\home\youruser\projects.

Method 2: Native Windows (PowerShell)

The native installer runs Claude Code directly on Windows without WSL2 or Docker. Good for quick setup, but with some limitations.

Native Windows install

# Run in PowerShell (not CMD)
irm https://claude.ai/install.ps1 | iex

After installation, open a new PowerShell window and run claude. The command should be available globally.

Limitations of native Windows

  • File watching: Some file system events behave differently on NTFS than ext4. Claude Code may not detect external file changes as reliably.
  • Shell integration: Bash-specific features (prompt integration, shell hooks) are not available in PowerShell.
  • MCP servers: Servers that assume Unix paths or use Unix sockets may not work natively. Check each server's Windows compatibility.
  • Line endings: Windows uses CRLF by default. Configure Git to use LF (see Common Issues below).

For basic code editing, asking questions about your codebase, and running commands, the native install works fine. If you run into edge cases, switch to WSL2.

Method 3: Docker on Windows

Docker gives you a fully isolated Linux environment without installing WSL2 system-wide. Install Docker Desktop for Windows first (it uses WSL2 as its backend, but manages it automatically).

Run Claude Code in Docker

# Pull and run with your project mounted
docker run -it --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  -e ANTHROPIC_API_KEY=sk-ant-... \
  node:22-slim \
  bash -c "npm install -g @anthropic-ai/claude-code && claude"

# Or use the native installer inside the container
docker run -it --rm \
  -v "$(pwd):/workspace" \
  -w /workspace \
  -e ANTHROPIC_API_KEY=sk-ant-... \
  ubuntu:24.04 \
  bash -c "apt-get update && apt-get install -y curl && \
  curl -fsSL https://claude.ai/install.sh | bash && \
  claude"

For repeated use, build a custom Dockerfile so you don't reinstall on every run:

Dockerfile for Claude Code

FROM ubuntu:24.04

RUN apt-get update && apt-get install -y curl git && \
    curl -fsSL https://claude.ai/install.sh | bash && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

WORKDIR /workspace
ENTRYPOINT ["claude"]

Build and run

docker build -t claude-code .
docker run -it --rm \
  -v "$(pwd):/workspace" \
  -e ANTHROPIC_API_KEY=sk-ant-... \
  claude-code

Docker Desktop license

Docker Desktop requires a paid subscription for companies with more than 250 employees or more than $10M in annual revenue. For personal use and small teams, it is free. Alternatives like Rancher Desktop or Podman work too.

Method 4: VS Code Dev Containers

Dev Containers run your development environment inside a Docker container while keeping the VS Code UI on your Windows host. You get Linux compatibility, reproducible environments, and IDE integration in one package.

Setup

  1. Install VS Code and the Dev Containers extension
  2. Install Docker Desktop for Windows
  3. Add a .devcontainer/devcontainer.json to your project

.devcontainer/devcontainer.json

{
  "name": "Claude Code Dev",
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04",
  "features": {
    "ghcr.io/devcontainers/features/node:1": {
      "version": "22"
    },
    "ghcr.io/devcontainers/features/git:1": {}
  },
  "postCreateCommand": "curl -fsSL https://claude.ai/install.sh | bash",
  "containerEnv": {
    "ANTHROPIC_API_KEY": "${localEnv:ANTHROPIC_API_KEY}"
  },
  "remoteUser": "vscode"
}

Open the project in VS Code, then run Dev Containers: Reopen in Container from the command palette (Ctrl+Shift+P). VS Code rebuilds the container, installs Claude Code, and opens an integrated terminal where claude is available.

Set your ANTHROPIC_API_KEY as a Windows environment variable so it gets passed into the container automatically. In PowerShell: [System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-ant-...', 'User')

Installation Method Comparison

Each method trades off between setup complexity and compatibility. Here is how they compare:

WSL2Native PowerShellDockerDev Containers
Setup time5 min + reboot2 min5 min10 min
Full compatibilityYesPartialYesYes
File watchingFullLimitedFullFull
MCP serversAll workSome limitationsAll workAll work
Shell integrationFull (bash/zsh)PowerShell onlyFullFull
IDE integrationManualManualManualBuilt-in
Node.js requiredNo (native installer)NoNoNo
IsolationLinux userspaceNoneFull containerFull container
Disk usage~1-2 GB~500 MB~1-3 GB~1-3 GB

Choose WSL2 if...

You want the closest experience to native Linux. Best for daily development, full MCP server support, and performance-sensitive workloads. One-time setup, then forget about it.

Choose Native if...

You need Claude Code quickly for basic tasks: asking questions, simple edits, running commands. No extra software required. Switch to WSL2 if you hit compatibility issues.

Choose Docker if...

Your team needs reproducible environments without requiring WSL2 on every machine. Good for CI/CD pipelines and shared development setups.

Choose Dev Containers if...

You use VS Code and want container isolation with IDE integration. Best for teams that already use Dev Containers for other tooling.

Configuration

API Key Setup

Claude Code needs authentication. On first run, it opens your browser for OAuth. For headless or automated environments, set the API key directly:

Set API key

# In WSL2 / Linux (add to ~/.bashrc or ~/.zshrc)
export ANTHROPIC_API_KEY=sk-ant-...

# In PowerShell (persistent, user-level)
[System.Environment]::SetEnvironmentVariable('ANTHROPIC_API_KEY', 'sk-ant-...', 'User')

# In PowerShell (current session only)
$env:ANTHROPIC_API_KEY = "sk-ant-..."

Windows Terminal Setup

Windows Terminal renders Claude Code's output correctly: 24-bit color, Unicode, proper line wrapping. Install it from the Microsoft Store or via winget:

Install Windows Terminal

winget install Microsoft.WindowsTerminal

Set your WSL2 distribution as the default profile in Windows Terminal settings for the smoothest workflow.

Git Configuration

Configure Git before using Claude Code. This is especially important on Windows to avoid line ending issues:

Git configuration

# Set your identity
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

# Fix line endings (critical on Windows)
git config --global core.autocrlf input

# Set default branch name
git config --global init.defaultBranch main

CLAUDE.md

After Claude Code is installed, run /init inside any project to generate a CLAUDE.md file. This gives Claude persistent context about your codebase: build commands, conventions, architecture. It is the most impactful post-install step. See our CLAUDE.md guide for detailed examples.

Common Issues

Node.js version mismatch (npm method only)

The npm package requires Node.js 18+. A common mistake on WSL2: having Node.js installed on Windows but not inside the WSL2 environment. Check from your WSL2 terminal:

Check Node.js in WSL2

node --version
# If not found or below v18, install via nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
nvm install 22

Permission errors with npm

Never use sudo npm install -g. It creates root-owned files that break future npm operations. Use nvm instead, which installs Node.js in your home directory and avoids permission issues entirely.

CRLF vs LF line endings

Windows uses CRLF (\r\n), Linux uses LF (\n). When Claude Code edits files, it writes LF. If your repository has CRLF, you get spurious diffs. Fix it globally:

Fix line endings

# Global Git config
git config --global core.autocrlf input

# Per-project .gitattributes (add to repo root)
# * text=auto eol=lf

# Fix existing files in a repo
git rm -r --cached .
git add .
git commit -m "Normalize line endings to LF"

WSL2 networking issues

If Claude Code can't reach the Anthropic API from WSL2, check your DNS resolution:

Fix WSL2 DNS

# Test connectivity
curl -I https://api.anthropic.com

# If DNS fails, override the resolver:
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'

# Restart WSL2 from PowerShell:
# wsl --shutdown

claude: command not found

Open a new terminal window after installation. If it still doesn't work, check that the install location is in your PATH:

Debug PATH

# In WSL2/bash
which claude
echo $PATH

# In PowerShell
Get-Command claude
$env:PATH -split ';'

Performance Tips

Use the Linux filesystem in WSL2

This is the single biggest performance improvement. Projects stored at /mnt/c/ (Windows drives accessed from WSL2) are 3-5x slower for file operations than projects stored in the native Linux filesystem at ~/.

Move projects to Linux filesystem

# Create your projects directory in the Linux filesystem
mkdir -p ~/projects

# Clone directly into the Linux filesystem
cd ~/projects
git clone https://github.com/your-org/your-repo.git

# Access from Windows Explorer if needed:
# \\wsl$\Ubuntu\home\youruser\projects

Configure .wslconfig for memory

WSL2 defaults to using up to 50% of your system RAM. For large codebases, you may want to allocate more. Create or edit %USERPROFILE%\.wslconfig on the Windows side:

%USERPROFILE%\\.wslconfig

[wsl2]
memory=8GB
processors=4
swap=4GB

After editing, restart WSL2 from PowerShell: wsl --shutdown, then reopen your terminal.

Windows Terminal rendering

Enable GPU-accelerated rendering in Windows Terminal for smoother output when Claude Code streams long responses. In Windows Terminal settings, go to Rendering and enable "Use the new text renderer."

Frequently Asked Questions

Can I install Claude Code on Windows?

Yes. Four methods: WSL2 (recommended), native PowerShell installer, Docker, or VS Code Dev Containers. WSL2 gives full Linux compatibility. The native installer works for basic usage with some limitations around file watching and MCP servers.

Is WSL2 required for Claude Code on Windows?

No, but it is the recommended approach. The native PowerShell installer (irm https://claude.ai/install.ps1 | iex) works without WSL2. Docker Desktop is another WSL2-free option if you use the HyperV backend.

Why are file operations slow in WSL2?

Accessing Windows drives from WSL2 (via /mnt/c/) crosses a filesystem boundary. Every stat(), read(), and write() call goes through a translation layer. Store projects in the native Linux filesystem (~/projects/) for 3-5x faster performance.

Do I need Node.js to run Claude Code on Windows?

Not for the native installer or Docker methods. Node.js 18+ is only required if you use the npm installation: npm install -g @anthropic-ai/claude-code.

How do I fix CRLF line ending issues?

Run git config --global core.autocrlf input to convert CRLF to LF on commit. Add a .gitattributes file with * text=auto eol=lf to your repository for project-wide enforcement.

Related Guides

Install Claude Code

Full installation guide covering macOS, Linux, and Windows. Native installer, Homebrew, npm, authentication, and post-install setup.

Claude Code Tutorial

Step-by-step walkthrough of Claude Code features: code editing, git workflows, slash commands, hooks, and MCP servers.

Claude Code in Docker

Detailed guide for running Claude Code in Docker containers. Covers Dockerfile setup, volume mounts, CI/CD integration, and multi-stage builds.

Claude Code in VS Code

Using Claude Code with VS Code: terminal integration, Dev Containers, extension setup, and keyboard shortcuts.

Supercharge Claude Code with Morph

Morph builds MCP servers that make Claude Code faster and more accurate. WarpGrep gives Claude RL-trained code search in its own context window. Fast Apply speeds up file edits by 10x. Both plug directly into Claude Code as MCP tools.