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.
| 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 |



