How to Exit Claude Code: Quit, Leave Plan Mode and Stop a Reply

How to Exit Claude Code: Quit, Leave Plan Mode and Stop a Reply

If you are wondering how to exit Claude Code, the short answer is to type /exit at the prompt and press Enter. You can also press Ctrl+C twice or Ctrl+D twice on an empty prompt. All three quit Claude Code and drop you back into your normal terminal.

If you only want to stop a reply that is still being written, press Esc once. If you want to leave plan mode, press Shift+Tab. Neither of those closes your session.

Quitting does not throw your conversation away. Run claude --continue in the same folder later and you are back where you left off.

This guide is part of our help series. Browse all our Claude Code tutorials for more fixes and how-tos.

Tested with Claude Code v2.1.325 on macOS on November 16, 2026. Every terminal capture below is real and comes from a small throwaway demo folder.

We tested on macOS; the Windows and Linux steps follow Anthropic’s official instructions. The keys are the same on all three, with two small differences that we point out along the way.

How to Exit Claude Code: Quick Summary

What you wantWhat to pressWhat happens
Quit Claude Code/exit then EnterSession closes, a resume command is printed
Quit with the keyboardCtrl+C twiceFirst press shows a hint, second press quits
Quit with the keyboardCtrl+D twice, quicklySame hint, then quits
Stop a replyEscClaude stops, the session stays open
Leave plan modeShift+TabSwitches to the next permission mode
Turn down a planEsc at the plan promptPlan is rejected, plan mode stays on
Pause Claude CodeCtrl+Z, then fgSuspends it to your shell (macOS and Linux)
Come back laterclaude --continueReopens the latest conversation in that folder
Diagram with three rows: stop a reply with Esc and the session stays open, leave plan mode with Shift+Tab and the session stays open, quit Claude Code with /exit or Ctrl+C twice or Ctrl+D twice and reopen it later with claude --continue
Three different exits. Only the bottom row closes Claude Code.

Why Leaving Claude Code Feels Confusing

Most terminal programs stop the moment you press Ctrl+C. Claude Code does not, and that is on purpose. Inside a session, the same key also interrupts running work and clears a half-typed prompt, so a single press quitting the whole thing would be easy to do by accident.

There is a second source of confusion. People say “exit” for three different things: closing the app, stopping an answer, and getting out of plan mode. Each one has its own key.

Before you press anything, ask what you want to leave: the reply, the mode, or the whole session.

If you are new to Claude AI in the terminal, our first session walkthrough shows what a normal session looks like from start to finish.

How to Quit Claude Code With the Exit Command

The clearest way out is the built-in command. Follow these steps:

  1. Make sure Claude is not in the middle of a reply. If it is, press Esc first.
  2. Type /exit at the prompt.
  3. Press Enter.

As you type, the command menu shows the match with the description “Exit the CLI”. That is how you know you have the right command before you press Enter.

Claude Code v2.1.325 prompt with /exit typed and the command menu showing /exit with the description Exit the CLI highlighted in a red box
Typing /exit brings up the command with its description, Exit the CLI.

The official commands page lists /quit as an alias. In our test, typing /quit showed the same entry in the menu, written as /exit (quit). Use whichever word you remember.

One detail from Anthropic’s docs is worth knowing. If you are attached to a background session, /exit detaches you and that session keeps running. To end a background session for good, the docs point to /stop instead.

How to Exit Claude Code in the Terminal With Ctrl+C or Ctrl+D

If you would rather not type a command, two keyboard shortcuts quit Claude Code. Both need two presses, and both show a hint after the first one.

Ctrl+C Twice

With an empty prompt, press Ctrl+C once. A line appears under the prompt that reads “Press Ctrl-C again to exit”. Press it again and Claude Code closes.

Claude Code prompt after one Ctrl+C press, with the line Press Ctrl-C again to exit highlighted under the prompt box
One press of Ctrl+C only shows this hint. Nothing has closed yet.

The hint does not stay forever. In our test it was gone a few seconds later, and the next Ctrl+C counted as a first press again. So press twice in a row, not once now and once later.

If your prompt has text in it, the first press does a different job: it clears your draft. In our run, the draft vanished and the exit hint appeared in the same moment. Anthropic’s docs say you can press Up to get a cleared draft back.

Ladder diagram of what Ctrl+C does in Claude Code: interrupts when Claude is working, clears the draft when the prompt has text, shows Press Ctrl-C again to exit when the prompt is empty, and quits on a second press while the hint shows
Ctrl+C has more than one job, which is why a single press rarely quits.

After the second press, Claude Code prints a short goodbye note: “Resume this session with:” followed by a ready-made command. Hold on to that line if you plan to come back to this exact conversation.

Terminal after pressing Ctrl+C twice in Claude Code, showing Press Ctrl-C again to exit and then Resume this session with: claude --permission-mode default --resume followed by a session ID
After the second Ctrl+C, Claude Code quits and prints the command that reopens this session.

Ctrl+D Twice

Ctrl+D works the same way, with one twist. The docs say the second press has to land within 800 milliseconds of the first. In practice that means a quick double tap.

We pressed it twice about a quarter of a second apart, and Claude Code quit and printed the resume command. When the prompt has text in it, the docs note that Ctrl+D deletes the character after the cursor instead, so clear the prompt first.

Terminal after pressing Ctrl+D twice in Claude Code, showing Press Ctrl-D again to exit followed by Resume this session with: claude --resume and a session ID
Ctrl+D gives the same hint and the same resume command on the way out.

Ctrl+Z to Pause Without Quitting

On macOS and Linux, the docs list Ctrl+Z as a way to suspend Claude Code to your shell. It is paused, not closed. Type fg to bring it back.

The docs mark this one as Unix only, so it is not an option in a native Windows terminal. We did not capture it for this guide. For the full list of keys, see the official interactive mode reference or our guide to Claude Code shortcuts.

How to Stop a Reply Without Quitting

Sometimes Claude heads in the wrong direction and you just want it to stop talking. That is what Esc is for. Press it once while Claude is working.

We asked for a 400-word story and pressed Esc about five seconds in. The text stopped mid-sentence and Claude Code added the line “Interrupted · What should Claude do instead?”. The prompt was ready for a new message right away.

Claude Code session where a story reply was cut off mid-sentence, with the line Interrupted, What should Claude do instead highlighted below the partial text
One press of Esc cut the story off mid-sentence. The session is still open.

According to the docs, Claude keeps the work done so far when you interrupt it. So stopping a reply is not the same as undoing it. If Claude already edited files and you want them back, use checkpoints and rewind.

Esc has a few other jobs listed in the docs:

  • When a dialog is open, it closes the dialog.
  • On a permission prompt, it declines the action.
  • Pressed twice with text in the prompt, it clears your draft.
  • Pressed twice on an empty prompt, it opens the rewind menu.

Ctrl+C also interrupts a running operation. We still suggest Esc for this job, because a stray extra Ctrl+C is how sessions get closed by accident. If Claude seems frozen and not just wrong, our guide on stuck on thinking covers that case.

How to Exit Plan Mode in Claude Code

Plan mode tells Claude to research and propose changes without making them. You can tell you are in it by the line “plan mode on” under the prompt. Getting out depends on where you are.

At the Normal Prompt

Press Shift+Tab. Each press moves to the next permission mode, and the line under the prompt changes to match. Keep pressing until you see the mode you want.

On our Mac, the cycle ran in this order: manual mode, accept edits, plan mode, auto mode, then back to manual mode. So one press from plan mode landed on auto mode, and a second press took us to manual mode. Your list can differ, because the docs say optional modes such as auto only appear where they are available.

Claude Code prompt after pressing Shift+Tab in plan mode, with the mode line now reading auto mode on, shift+tab to cycle, highlighted in a red box
One Shift+Tab from plan mode. The mode line now says auto mode on, so press again if you want manual mode.

At the Plan Approval Prompt

This is the spot that catches people. When Claude finishes a plan, it asks whether to proceed. Do not press Shift+Tab here to get out: the docs warn that at this prompt, Shift+Tab approves the plan.

Press Esc first. In our test, the prompt offered “Yes, and use auto mode”, “Yes, manually approve edits” and “Tell Claude what to change”. After Esc, the session showed “User rejected Claude’s plan” and no file was edited.

Claude Code plan approval prompt asking Would you like to proceed, with three options highlighted: Yes and use auto mode, Yes manually approve edits, Tell Claude what to change
The plan approval prompt. Esc turns the plan down; Shift+Tab here would approve it.

Turning the plan down does not switch modes. The line under our prompt still read “plan mode on” afterward. From there, Shift+Tab is safe again and takes you out.

Claude Code prompt after rejecting a plan with Esc, with the mode line plan mode on, shift+tab to cycle, highlighted to show plan mode is still active
After Esc, the plan is rejected but plan mode is still on. Now press Shift+Tab.

Approving a plan also ends plan mode, since Claude then starts editing in the mode that option names. For more on planning, read our plan mode guide and the overview of permission modes. The official permission modes page has the full rules.

One Windows note from the docs: if Shift+Tab does nothing in your terminal, Alt+M cycles the modes instead in some setups.

How to Resume After You Exit

Closing Claude Code does not delete the conversation. You have three ways back in, and we ran the first two.

Continue the Latest Conversation

Open a terminal in the same project folder and run this:

claude --continue

The short form is claude -c. The docs describe it as loading the most recent conversation in the current directory. In our test it reopened the plan-mode session we had just quit, with the rejected plan still on screen.

Claude Code started with claude --continue, showing the earlier conversation restored with the line User rejected Claude's plan and the full plan for hello.py above an empty prompt in manual mode
claude –continue brought back the session we quit a minute earlier, plan and all.

Pick a Session From a List

If the latest one is not the one you want, run claude --resume with nothing after it. Claude Code shows a picker with your sessions for that folder. Ours listed both demo sessions with short names and their age.

Claude Code Resume session picker listing two sessions for the exit-demo folder, Hello.py goodbye function from 1 minute ago and Lighthouse keeper story from 5 minutes ago, highlighted in a red box
claude –resume with no ID opens this picker. Esc cancels it.

Use the Command Printed at Exit

The line Claude Code prints when it quits is the third way. It looks like this, with your own session ID at the end:

claude --resume 845ed7d7-1696-4972-b882-aad85855c59d

We noticed the printed command can repeat a flag you started with. Our first sessions were launched with --permission-mode default, and the exit line included it. Our guide to resuming sessions goes deeper, and the CLI reference lists every flag.

Try It Yourself

The safest way to learn these keys is in a folder you do not care about. Make an empty folder, start claude in it, and send this prompt:

Write a 400-word story about a lighthouse keeper.

Then run through this drill:

  1. Press Esc while the story is being written and watch for the “Interrupted” line.
  2. Press Shift+Tab a few times and read the mode line after each press.
  3. Press Ctrl+C once, read the hint, and wait for it to fade.
  4. Type /exit and press Enter.
  5. Run claude --continue and check that your story is still there.

Common Mistakes

  • Pressing Ctrl+C once and assuming Claude Code closed. It only showed a hint.
  • Pressing Ctrl+C to clear a draft, then again out of habit, and quitting by accident.
  • Pressing Shift+Tab at the plan approval prompt to leave. That approves the plan.
  • Pressing Ctrl+D twice too slowly. The second press has to come within 800 milliseconds.
  • Closing the terminal window to get out. It works, but you miss the printed resume command.
  • Using /clear when you meant to quit. That starts a new conversation and keeps Claude Code open. See clear vs compact for the difference.
  • Running claude --continue from a different folder and wondering where the conversation went.

Pro Tips

  • Use /exit when you want to be sure. It does one thing and cannot be mistaken for an interrupt.
  • Reach for Esc, not Ctrl+C, to stop a reply. It never quits the session.
  • Glance at the line under the prompt before you send anything. It always names the current mode.
  • Copy the resume command before you close the terminal tab if the session matters.
  • If a shortcut clashes with your terminal, you can rebind the keys.
  • If Claude Code will not respond to any key at all, treat it as a crash. Our list of common errors is a good next stop.

Cheat Sheet

Cheat sheet for exiting Claude Code with two cards: Leave lists /exit, Ctrl+C twice, Ctrl+D twice, Esc, Shift+Tab and Ctrl+Z; Come back lists claude --continue, claude -c, claude --resume, claude --resume ID, /resume and Up
Ways out on the left, ways back in on the right. For every command in one place, see our commands cheat sheet.

Frequently Asked Questions

What is the command to exit Claude Code?

Type /exit and press Enter. The official commands list also gives /quit as an alias. Both close the CLI and return you to your shell.

Why does Ctrl+C not close Claude Code?

Because one press is treated as an interrupt or a clear, not a quit. On an empty prompt it shows “Press Ctrl-C again to exit”. Press it a second time while that hint is visible.

Does exiting Claude Code delete my conversation?

No. In our test, claude --continue brought the whole conversation back after we quit. You can also pick an older one with claude --resume.

How do I get out of plan mode without approving the plan?

If the approval prompt is open, press Esc to turn the plan down. Then press Shift+Tab to switch to another mode. Pressing Shift+Tab first would approve the plan, according to the docs.

How do I stop Claude Code from answering?

Press Esc once while it is working. The reply stops, the work done so far is kept, and you can type a new instruction right away.

Conclusion

Knowing how to exit Claude Code comes down to matching the key to the job: /exit, a double Ctrl+C or a quick double Ctrl+D closes the session, Esc stops a reply, and Shift+Tab leaves plan mode once any plan prompt has been dismissed with Esc. None of these lose your work, because claude --continue and claude --resume bring a conversation back. For the exact wording behind each key, check the official commands list.

Newsletter

New AI tools in your inbox

The best new tools and the AI news that matters, in one short email. Unsubscribe any time.

Free · No spam · Unsubscribe any time

✓ Looks like you’re subscribed

Loading Google’s sign-up form…

Looks like you’re already subscribed

Thanks for reading! New AI tools and the AI news that matters will land in your inbox.

Not subscribed yet? Refresh the page to load the sign-up form.

The sign-up form couldn’t load. If you use an ad or content blocker, allow news.google.com and reload the page.

Free instant check before you pay. Takes a few seconds.

Scroll to Top