Short answer: in Claude Code, Enter sends your message. To start a new line instead, press Ctrl+J, or type \ and then press Enter. Both work in every terminal with no setup. Shift+Enter works too in most modern terminals (Windows Terminal, iTerm2, Ghostty, Kitty, WezTerm, Warp); in VS Code's or Cursor's terminal, run /terminal-setup once to turn it on.
Everything here is from Anthropic's Claude Code documentation, checked on November 17, 2026.
Every way to add a line break
| Keys | Where it works |
|---|---|
| Ctrl+J | Every terminal, no setup |
\ then Enter | Every terminal, no setup |
| Shift+Enter | Windows Terminal 1.25 and later, iTerm2, Ghostty, Kitty, WezTerm, Warp, Alacritty 0.16 and later; after /terminal-setup in VS Code, Cursor, Zed and older Alacritty |
| Option+Enter | macOS, once your terminal sends Option as Meta |
| Paste | Pasted text keeps its line breaks, so code and logs come in whole |
In the Claude Code extension's panel in VS Code, the prompt is a normal text box: Shift+Enter adds a line there with no setup.
Shift+Enter sends instead of adding a line?
It depends on your terminal:
- VS Code, Cursor, Devin Desktop, Zed, Alacritty before 0.16: run
/terminal-setuponce inside Claude Code. It adds a Shift+Enter key binding to the terminal's settings (you'll seeInstalled VSCode terminal Shift+Enter key binding). In VS Code it also turns off the terminal's GPU rendering, which stops garbled text. Run it in the editor's own terminal, not inside tmux. - Windows Terminal before 1.25, gnome-terminal, and the terminal in JetBrains IDEs (IntelliJ, PyCharm, Android Studio): Shift+Enter isn't available. Use Ctrl+J or
\then Enter, or update Windows Terminal. - Inside tmux: Shift+Enter sends even when the outer terminal supports it. Add these lines to
~/.tmux.conf, runtmux source-file ~/.tmux.conf, then detach, attach again and restart Claude Code:
set -s extended-keys on
set -as terminal-features 'xterm*:extkeys'
Option+Enter on a Mac
macOS terminals don't send Option as a modifier by default, so Option+Enter does nothing until you turn it on: in Apple's Terminal, Settings → Profiles → Keyboard → Use Option as Meta Key; in iTerm2, Settings → Profiles → Keys → General, Left and Right Option key to Esc+; in VS Code, "terminal.integrated.macOptionIsMeta": true. That also makes Claude Code's other Option shortcuts work, like Option+P to switch models.
Make Enter add a line and Shift+Enter send
If you write long prompts and keep sending them too early, swap the two. Claude Code's keys live in ~/.claude/keybindings.json; map the chat:newline and chat:submit actions:
{
"bindings": [
{
"context": "Chat",
"bindings": {
"enter": "chat:newline",
"shift+enter": "chat:submit"
}
}
]
}
Any other key works the same way for chat:newline. In a terminal where Shift+Enter doesn't come through (see above), pick a different key for sending.
Moving around a long prompt
- Ctrl+A and Ctrl+E go to the start and end of the current line.
- ↑ and ↓ move between the lines of your prompt first, and only then through your earlier messages.
- Ctrl+U deletes to the start of the line; pressed again, across lines.
- Esc twice clears the prompt (↑ brings it back).
For a really long prompt, it's often easier to write it in a file and point Claude at it with @prompt.md.
And in Codex?
The Codex CLI works the same way: Enter sends, and Shift+Enter or Ctrl+J add a line (Ctrl+J in any terminal). The same terminal limits apply to Shift+Enter. More on Codex in Codex vs Claude Code.
In Morphy
In Morphy, Claude Code runs as chats with a normal text box, so Shift+Enter starts a new line on Windows, Mac and Linux with nothing to set up, the same for Codex and every other AI. See Keyboard shortcuts.
Questions
How do I add a new line in Claude Code? Press Ctrl+J, or type \ and press Enter. Shift+Enter works in most terminals, and in VS Code after /terminal-setup.
Why does Shift+Enter send my message in Claude Code? Your terminal doesn't pass Shift+Enter on. Run /terminal-setup in VS Code, Cursor or Zed; in tmux, turn on extended keys; elsewhere, use Ctrl+J.
How do I add a new line in Claude Code on Windows? Shift+Enter in Windows Terminal 1.25 or later, or Ctrl+J in any terminal, PowerShell and CMD included. New to it on Windows? Here's how to install Claude Code on Windows.
How do I add a new line in Claude Code in VS Code? In the Claude Code extension's panel, Shift+Enter just works. In VS Code's terminal, run /terminal-setup once.
Can I make Enter add a new line? Yes: map enter to chat:newline and shift+enter to chat:submit in ~/.claude/keybindings.json.
Related guides
- Claude Code voice mode, for when typing a long prompt is the slow part
- Claude Code not working? How to fix it
- How to install Claude Code on Windows
- The best Claude Code GUIs
References
- Anthropic: terminal configuration, multiline prompts, interactive mode shortcuts, keybindings, VS Code
- OpenAI: Codex CLI's composer, on GitHub
- Morphy: Keyboard shortcuts




