How to Stop or Cancel Claude Code While It's Running

To stop Claude Code while it’s working, press Esc.

Claude stops the current response or tool call and keeps the work it has done so far, so you can type a new instruction. Ctrl+C also interrupts a running operation.

Stopping Claude doesn’t undo anything. If you want to reverse the changes Claude already made, see how to undo changes in Claude Code.

This article covers every way to stop, cancel, or redirect Claude, including messages you’ve queued.

Stop Claude with Esc

Press Esc once while Claude is working. It stops the response or tool call in progress, and the conversation stays as it is.

This is the best way to redirect Claude. For example, if you see it heading in the wrong direction, press Esc and type:

Stop, don't change the database schema. Only update the API handler.

If a dialog is open, such as a permission prompt, Esc closes the dialog instead.

Ctrl+C: interrupt or exit

Ctrl+C works differently depending on what’s happening:

SituationWhat Ctrl+C does
Claude is running somethingInterrupts it
Nothing is running, prompt has textClears the prompt
Nothing is running, prompt is emptyPress twice to exit Claude Code

If you cleared a prompt by accident, press Up to get it back from your history.

Cancel a message you queued

You can keep typing while Claude works. When you press Enter, your message is queued instead of interrupting Claude, and it shows in gray until Claude reads it.

To take back what you queued, press Up from the first line of the input box. Your queued messages move back into the input box, one per line. Edit them and press Enter to queue them again, or clear the input box to drop them.

Send a queued message right away

Queued messages normally wait until Claude finishes its current tool calls. To send them immediately, press:

Ctrl+Enter

If your terminal doesn’t support Ctrl+Enter, use Ctrl+X then Ctrl+S instead. This needs Claude Code version 2.1.275 or later.

You can also press Esc. Claude stops the current turn, and your queued messages are sent next.

Stop background tasks

Long commands and subagents can run in the background. To stop all background subagents in the current session, press Ctrl+X then Ctrl+K, and press it again within 3 seconds to confirm.

To see what’s still running, use:

/tasks

Cancel a usage limit wait

When you hit a usage limit, Claude Code can wait and continue automatically after the reset. You’ll see a line like this:

Continuing automatically at 3:45pm · Esc to cancel

Press Esc to cancel the wait. See Claude Code rate limit reached for more about limits.

How to exit Claude Code

To close Claude Code completely, use any of these:

  • Type /exit
  • Press Ctrl+C twice on an empty prompt
  • Press Ctrl+D twice quickly

Your conversation is saved, so you can pick it up later with claude --continue.

What if Claude Code is frozen?

If Esc and Ctrl+C both do nothing, close the terminal window. Then start Claude Code again from the same folder and resume your session:

claude --resume

Conclusion

Press Esc to stop Claude and redirect it, and Ctrl+C to interrupt a command or exit. Press Up to take back queued messages, or Ctrl+Enter to send them right away.