The Decoder / One term

How do I exit Claude Code?

Type /exit and press Enter, or press Ctrl+D twice. Ctrl+C only stops whatever Claude is doing right now; it does not close the session. Nothing is lost on exit: claude --resume brings the conversation back.

By Mstimaj Numbers checked 6 November 2026 Updated 6 November 2026 Level Start Here Tool Claude

Sign in to save your place and mark this done. Free, no card.

A dark terminal window with a short slash command typed on the last line and the cursor resting after it

Type /exit and press Enter. Or press Ctrl+D twice. Either closes Claude Code and returns you to the ordinary terminal prompt. The key people reach for first, Ctrl+C, does something different: it cancels the action Claude is in the middle of and leaves the session open. Exiting does not throw the conversation away. Run claude –resume in the same folder and it picks up where you left it.

Key facts

  • 1command that exits: /exit
  • 2presses of Ctrl+D do the same thing
  • 1key that stops the current action without exiting: Ctrl+C
  • 0conversations lost on exit; claude –resume or claude -c continues the last one
  • code.claude.com Quickstart, session commands and shell commands tables, and the Troubleshooting page on hangs, read 6 November 2026

Exit, cancel and clear are three different things

People ask how to exit when they mean one of three things, and each has its own key. Exit means close Claude Code and go back to your normal prompt: /exit, or Ctrl+D pressed twice. Cancel means stop the thing it is doing right now, because it is running the wrong command or going on too long: Ctrl+C, and the session stays open for your next message. Clear means forget this conversation and start fresh inside the same session: /clear. If you only want to interrupt, Ctrl+C is the one. If you want to leave, /exit.

The keys and commands, and what each one does
Press or type What happens Session stays open
/exit then Enter Closes Claude Code No
Ctrl+D, twice Closes Claude Code No
Ctrl+C Stops the current action Yes
/clear Forgets the conversation, same session Yes
claude –resume, from the shell Reopens the last conversation Opens a new one

Will I lose my conversation?

No. Claude Code keeps every session on your machine. The next time you are in that folder, claude -c continues the most recent conversation and claude -r lets you choose from earlier ones. The documentation says it plainly for the case where the window froze and you had to close the terminal: restarting does not lose your conversation, run claude –resume in the same directory to pick the session back up. So exiting is safe, and closing the whole terminal is also safe. The thing you cannot do is resume from a different folder, because sessions belong to the project they ran in.

Keypresses to leave, by route KEYPRESSES TO LEAVE, BY ROUTE Ctrl+D twice 2 keys /exit and Enter 6 keys
Counting Enter. Both routes land on the ordinary prompt with the conversation saved.

What if it will not respond at all?

Press Ctrl+C once to cancel the current operation. If nothing happens, close the terminal window and open a new one; then claude --resume in the same folder. For the case where Claude Code is working but eating memory, /compact inside the session shrinks the conversation, and the documentation suggests exiting and restarting between large tasks anyway. None of these lose work that has been written to your files, because the files are on your disk, not inside the session.

Do I need to log out as well?

No. Your sign-in is stored after the first time and survives exiting, closing the terminal and restarting the computer. You only type /login again to switch accounts. Exiting is just closing the program, the same as quitting any other app.

Ask what did not make sense

Comments go through our own form and are read before they appear. Links are not allowed; describe it in words.

Comments are read before they appear.

The newsletter

Get the next term.

One email when something goes up. The argument, the film and the term, nothing else. One click to leave.

Have a question now? Ask Mstimaj, she knows the archive.