Short answer: to switch accounts, type /login in Claude Code and sign in with the other one (/status shows which account is in use). To keep two accounts signed in at once, like work and personal, give each its own configuration folder with the CLAUDE_CONFIG_DIR environment variable. Anthropic's own example, for macOS and Linux:
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'
Now claude runs on your personal account and claude-work on your work account, each with its own login, settings and history. Windows and VS Code are below.
Everything here is from Anthropic's Claude Code documentation, checked on November 10, 2026. (I build Morphy, which keeps several Claude accounts and switches between them in one click; that's near the end.)
Switch accounts
| What you want | Command |
|---|---|
| Sign in with another account | /login in a session, or claude auth login in your terminal |
| Sign out | /logout, or claude auth logout |
| See which account is in use | /status, or claude auth status --text |
| Sign in to a Console (API) account instead | claude auth login --console |
/login opens your browser. If it signs you straight back in to the account you already have, sign out of claude.ai in the browser first, or press c to copy the login link and open it in a private window.
/logout also resets Claude Code's first-run setup, so the next start walks you through login and setup again.
Use two accounts at once
Claude Code keeps everything in one folder, ~/.claude (on Windows, %USERPROFILE%\.claude): your login, settings, session history, plugins and personal CLAUDE.md. CLAUDE_CONFIG_DIR points it at another folder, and each folder signs in on its own. On a Mac, the Keychain entry follows the folder too, so the two logins never mix.
On macOS and Linux
Add the alias to ~/.zshrc or ~/.bashrc:
alias claude-work='CLAUDE_CONFIG_DIR=~/.claude-work claude'
Open a new terminal and run claude-work: the first time, Claude Code walks you through login and setup for the new folder. You can make as many as you like (claude-client, claude-test), and run them side by side in different terminals.
On Windows (PowerShell)
Open your PowerShell profile with notepad $PROFILE (create it if it asks) and add:
function claude-work {
$env:CLAUDE_CONFIG_DIR = "$HOME\.claude-work"
try { claude @args } finally { Remove-Item Env:CLAUDE_CONFIG_DIR }
}
Open a new PowerShell window and run claude-work. Plain claude keeps using your usual account. New to Claude Code on Windows? Start with how to install it.
In VS Code
The Claude Code extension reads CLAUDE_CONFIG_DIR from its Environment Variables setting (claudeCode.environmentVariables, under Settings → Extensions → Claude Code). Write the full path, like C:\Users\you\.claude-work or /Users/you/.claude-work: the extension doesn't expand ~ and ignores a relative path. Or start VS Code from a terminal where the variable is set (code .), so it inherits it.
What each account keeps separately
- Separate: the login, your user settings (
settings.json), session history (so/resumeonly lists that account's sessions), plugins, and your personalCLAUDE.md, skills and subagents in that folder. - Shared: everything in the project itself, like its
CLAUDE.md,AGENTS.mdand.claude/folder. - So: a new folder starts empty. To bring your setup along, copy
settings.json,CLAUDE.mdand yourskills/andagents/folders from~/.claudeinto the new one. Don't copy.credentials.json. - One exception: two Claude Console sign-ins made without an API key aren't kept apart by separate folders, because Claude Code stores that kind of sign-in elsewhere.
claude auth status shows the folder in use: its JSON has a configDirectory field.
When an API key gets in the way
Claude Code picks one credential, and an API key in your environment beats your login. In order: a cloud provider (Bedrock, Google Cloud or Foundry), ANTHROPIC_AUTH_TOKEN, ANTHROPIC_API_KEY, an apiKeyHelper script, CLAUDE_CODE_OAUTH_TOKEN, an Anthropic profile, and last your /login.
So if /login seems to do nothing, check /status: a leftover ANTHROPIC_API_KEY may be in use. Remove it (unset ANTHROPIC_API_KEY, or Remove-Item Env:ANTHROPIC_API_KEY in PowerShell) and restart. The sign-in errors this causes are in Claude Code API errors.
For scripts and CI: claude setup-token makes a one-year token for an account, which you set as CLAUDE_CODE_OAUTH_TOKEN wherever that account should run. It needs a Pro, Max, Ultra, Team or Enterprise plan.
Is it allowed?
Having a work and a personal account is the case Anthropic's documentation describes. Its consumer terms say nothing about owning more than one account, but they do forbid sharing your login with anyone else, and "bypassing any of our systems or protective measures". On Team plans, each seat is for one named person.
Each account has its own usage limits, shared across claude.ai, the Claude apps and Claude Code. If you'd want a second account only for more usage, Anthropic's own answers are Max, Ultra or usage credits: see Claude Max vs Ultra and how to stop hitting Claude Code's usage limits.
In Morphy
Morphy runs Claude Code as chats on a canvas, and keeps more than one Claude account for you, without folders or aliases:
- Add another account on the Claude Code card in Settings → Account, then Switch to change accounts in one click (or Ctrl+K, "Switch Claude"). Your chats keep their conversations.
- When a limit hits, the chat offers Switch to your other account and sends the stopped message again. Turn on Switch accounts when a limit is hit and it does that by itself.
- Several at the same time: a project, or a single chat, can keep its own account, so a work chat and a personal chat run side by side (on Windows and Linux; on a Mac, projects and chats can't keep their own Claude account yet).
The same works for Codex and Grok. See More than one account.
Questions
Can you have two accounts in Claude Code? Yes. Switch between them with /login, or keep both signed in at once by giving each its own CLAUDE_CONFIG_DIR.
How do I switch accounts in Claude Code? Run /login and sign in with the other account, or /logout first. /status shows which one is in use.
Can I switch accounts in the middle of a session? Yes: run /login in the session. To keep a conversation on one account, run it in a terminal started with that account's CLAUDE_CONFIG_DIR.
Do two accounts share usage limits? No. Each account has its own usage limits. Your claude.ai chats count toward the same account's limits as its Claude Code.
Why does Claude Code keep using the wrong account? Usually an ANTHROPIC_API_KEY in your environment, which takes priority over your login. Check /status.
Related guides
- How to stop hitting Claude Code's usage limits
- Claude Code API errors, including sign-in errors
- How to install Claude Code on Windows
- How to run multiple Claude Code agents at once




