Claude Code

Claude Code Logout & Switch Accounts

9 min read This article cites 5 primary sources

Claude Code logout usually means clearing the current Claude account session in the Claude Code CLI so you can sign in again or switch to another account, and this guide explains the practical ways to do that, what to expect, and when you may need the full Claude Code guide first. c-ai.chat is an independent guide to Claude by Anthropic, not Anthropic itself.

Claude Code Logout & Switch Accounts — hero illustration.
Claude Code Logout & Switch Accounts

The short answer

Illustration about claude code logout
Illustration about claude code logout

If you searched for claude code logout, the practical answer is simple: you sign out of the current Claude Code session, remove or refresh the stored authentication state, then sign back in with the account you want to use. The exact command or prompt can vary by Claude Code version, so the reliable pattern is to use the built-in auth flow first, then fall back to clearing the local session if needed.

This page is for developers, students, and teams who use Claude Code in the terminal and need to switch between personal and work accounts, fix an expired login, or reset a broken sign-in state. If you are still deciding whether Claude Code fits your workflow, see Claude features and the broader Claude API guide for context.

  • What it does · signs out the current Claude Code account session
  • Where it runs · local terminal on macOS, Linux, or Windows environments
  • What it costs · depends on your Claude plan or API usage, not on logout itself
  • Who it’s for · developers switching accounts or fixing auth problems

How it works

Abstract scene of using Claude AI
Abstract scene of using Claude AI

Claude Code typically authenticates your terminal session against your Claude account or a related authorization flow, then stores local state so you do not have to log in every time you open a shell. Logout reverses that state. In plain terms, it disconnects the current local CLI session from the account that was previously authorized.

That matters because the CLI session is often separate from your browser session. You might still be logged into claude.ai in a browser while the terminal has stale credentials, or the opposite: your browser is using one account while Claude Code is using another. When people say “Claude Code won’t switch accounts,” this mismatch is often the real issue.

For engineers, the useful mental model is: Claude Code keeps a local auth token or session reference, and logout clears or invalidates it. After that, the next authenticated command should trigger a fresh sign-in flow. If your machine has multiple shells, multiple OS users, or remote development containers, each environment may keep its own state. That is why one terminal can appear signed out while another still works.

  1. Try the built-in sign-out flow first

    Open the same terminal environment where you use Claude Code and run the CLI help command, such as claude --help, to find the current auth or logout command supported by your installed version.

  2. Run the logout or auth reset command

    If your version exposes a logout command, use it. If it uses an auth subcommand instead, follow that path to sign out or clear the current session cleanly.

  3. Confirm the session is gone

    Run a command that requires authentication. A successful logout usually causes Claude Code to ask you to sign in again rather than proceeding silently.

  4. Sign in with the intended account

    Start the login flow again and complete it with the personal, work, or team account you actually want attached to that CLI environment.

  5. Only then use manual cleanup if needed

    If Claude Code still appears tied to the old account, inspect local config or credential storage for leftover auth data and remove it carefully. Back up config files first if you are unsure.

If you are in a managed team environment, account switching can also interact with SSO, admin policies, or workspace controls. Anthropic’s paid plans differ here: Free is $0/month, Pro is $20/month or $17/month annual, Max starts at $100/month, Team Standard is $25/seat/month or $20/seat/month annual, Team Premium is $125/seat/month or $100/seat/month annual, and Enterprise uses a $20/seat base plus usage at API rates. You can compare those in our independent Claude pricing guide.

What you’d actually do with it

Most logout questions are not about the word “logout” itself. They are about one of four jobs: switching from a personal account to a work account, removing a broken session, verifying which account a terminal is using, or isolating development environments so they do not share credentials. Here are the common real-world cases.

1) Switch from your personal account to your employer’s team account.
You installed Claude Code on your laptop before joining a company. Later, your team gives you a managed Claude workspace. In that case, you want to sign out of the personal session in the CLI, then authenticate again through the work flow so code assistance, permissions, and workspace context align with the right account.

claude --help
# look for auth, login, logout, or signout commands

# after logout, run an authenticated command again
claude

2) Reset an expired or broken terminal session.
You launch Claude Code and it fails with an authentication error even though your browser session still works. That often means the local CLI token is stale. Logging out and signing back in is faster than trying to debug every possible credential edge case.

3) Keep work and side-project environments separate.
Instead of switching the same terminal back and forth every day, many developers create separate OS users, containers, or dev environments. Each environment gets its own Claude Code login. That reduces the chance of sending a work prompt from the wrong account or inheriting the wrong project context.

Worked example

Switch a laptop from a personal Claude session to a team-managed one

Current stateCLI still tied to personal account
Action 1Run Claude Code logout or auth reset
Action 2Re-run Claude Code and start fresh login
Action 3Complete sign-in with team account or SSO
ResultTerminal now uses the correct workspace

This is the cleanest fix when prompts, permissions, or workspace access do not match the account you expect.

4) Check whether the CLI is really logged out.
A lot of users assume logout failed because the command line tool still opens. That is not enough to prove anything. The better test is to run a command that requires active authentication. If Claude Code prompts you to sign in again, the logout worked. If it proceeds normally, the machine still has valid auth state somewhere.

# Example verification pattern
claude
# expected after successful logout:
# prompts for login or opens authentication flow

5) Handle remote development carefully.
If you use SSH, a dev container, WSL, or a cloud workstation, the credentials may live in that remote environment rather than on your main desktop. Logging out in your local macOS terminal does not necessarily log out the CLI inside a Linux container. Treat each runtime as separate unless you have verified shared credential storage.

Pick when

  • You need to switch between personal and work Claude accounts
  • You are seeing auth errors in Claude Code
  • You want to verify which account your terminal is actually using
  • You manage separate local and remote development environments

Skip when

  • Your issue is model selection, not account authentication
  • You are only trying to log out of the browser app at claude.ai
  • You need billing changes rather than a CLI sign-out
  • You have not checked the CLI help output for the current auth commands

If your real problem is cost control rather than account switching, Claude usage depends on plan and API model choice. Anthropic’s current API pricing includes Opus 4.7 at $5/M input tokens and $25/M output tokens, Sonnet 4.6 at $3/M and $15/M, and Haiku 4.5 at $1/M and $5/M. Official pricing also notes 90% off cached input tokens with prompt caching and 50% off both input and output with the Batch API.

90% off

cached input tokens with prompt caching

Vs. the alternatives

If you are comparing Claude Code logout with tools like Cursor, GitHub Copilot, or Sourcegraph Cody, the core difference is not that one of them can log out and another cannot. All of them need some way to switch accounts or refresh auth. The trade-off is where the account state lives, how visible the auth controls are, and whether the tool is browser-linked, editor-linked, or terminal-first.

ToolTypical environmentHow account state usually behavesMain trade-off
Claude CodeTerminal / CLI workflowOften tied to local CLI auth state in that environmentFlexible for engineers, but less obvious if you expect a browser-style profile switcher
CursorStandalone editorAccount switching is usually surfaced in app settingsSimpler UI, but you are working inside Cursor rather than a plain terminal flow
GitHub CopilotIDE integrationsOften linked to GitHub identity in the editorConvenient in IDEs, but auth can be spread across IDE, plugin, and GitHub account layers
Sourcegraph CodyIDE / enterprise environmentsCan depend on workspace or enterprise auth setupGood for managed environments, but switching can be policy-driven rather than user-driven

For a terminal-heavy workflow, Claude Code’s approach is reasonable. The downside is discoverability. Developers often expect a visible “switch account” button, but CLI tools more often expose auth through commands and local config. That is efficient once you know the pattern, but less friendly when you are in a hurry.

On the model side, Claude remains competitive because Anthropic offers a clear spread: Opus 4.7 for highest-end work, Sonnet 4.6 as the default balance, and Haiku 4.5 for fast and cheap usage. If you are evaluating tools based on coding quality rather than auth ergonomics, start there, then look at environment fit second.

Other questions readers ask

The honest take

Claude Code logout is usually straightforward once you think of it as a local CLI authentication problem, not a general Claude account problem. The clean path is to use the built-in auth or logout command for your installed version, verify that the session is really gone, and only then remove local credential state manually if the tool still clings to the old account.

The weak spot is discoverability. Terminal tools are efficient, but they are not always explicit about where login state is stored or how account switching works across shells, containers, and browser sessions. If you use Claude Code often, the best habit is to separate work and personal environments and keep one account per environment whenever possible.

Need the official product? — Use the Claude web app for account access, billing, and sign-in flows.

Try Claude →

Independent guide. Not affiliated with Anthropic. For the official Claude product, visit claude.ai.

Last updated: 2026-05-12