- Home
- Claude features
- Copy Code output
Copy Claude Code output without losing the text
Use response copying for an answer, the transcript for execution details, and an export when the whole conversation matters.
To copy Claude Code’s latest answer, run its native copy command; in the VS Code panel, hover over the answer and use Copy response. Use a transcript export when you need the whole conversation, or the transcript viewer when you need tool execution details. Those routes preserve different material, so choose the one that contains the evidence you actually want.
Choose the right piece to copy
A reply might explain a failed command without reproducing its full output. Copying that explanation is useful for a colleague, but it isn’t the same as handing them the log they need to diagnose the failure. Decide what the recipient must be able to verify.
| Material you need | Native route | Check before sharing |
|---|---|---|
| One assistant answer | Response copy command or Copy response | Correct answer and complete ending |
| One code block | Copy command’s block picker | Indentation and required surrounding context |
| Tool execution details | Transcript viewer | Command, result, and relevant error together |
| The full conversation | Conversation export | Beginning, ending, and sensitive output |
The full export guide covers saving a readable transcript. If your aim is to continue the work later, use the separate session-saving guide; a clipboard copy is a reading copy, not the session’s storage mechanism.
Copy an answer or code block
As of November 2026, Anthropic’s command reference describes the copy command as “Copy the last assistant response to clipboard.” Enter it at the start of a message inside Claude Code:
/copy
When the response contains code blocks or blockquotes, the command offers a picker for a block or the whole answer. A response number selects an earlier answer; this example selects the second-latest one:
/copy 2
Choose a block when you need source text to edit. Choose the complete answer when its explanation contains assumptions or warnings that affect how the code should be used. Removing surrounding prose is convenient, but it can remove the condition under which the proposed fix makes sense.
Paste into an empty editor buffer before using the result. Check the first and last lines, indentation, quotation marks, and whether prose or Markdown fences came along. Don’t paste an unfamiliar multiline command straight into a running shell just to see whether the copy succeeded.
Select the terminal output you need
For a visible log excerpt, select the relevant text and use your terminal’s copy command. In VS Code’s integrated terminal, Microsoft documents these platform defaults:
| Platform | Copy selected terminal text |
|---|---|
| macOS | Cmd+C |
| Windows | Ctrl+C |
| Linux | Ctrl+Shift+C |
Custom keybindings or a different terminal can change that behavior. Claude Code itself uses Ctrl+C to interrupt or clear input, so pressing it without a useful terminal selection can affect the running session. Check what has focus before trying the shortcut again.
A rectangular selection can omit the beginning or end of long lines. A narrow terminal can also make one logical line look like several lines on screen. Paste into an editor and examine the actual line breaks rather than judging completeness from the shape of the selection.
Include enough surrounding output to preserve meaning. A single error line may omit which command produced it, while an enormous terminal capture may contain unrelated credentials or customer data. Copy the command and the relevant result together, then remove private material from a separate sharing copy.
Open the transcript for missing details
Press Ctrl+O to open Claude Code’s transcript viewer when the normal display hides execution details. Anthropic’s interactive-mode reference documents a fuller view of tool use and results there. Search or navigate to the relevant operation before selecting an excerpt.
The viewer’s shortcuts depend on the renderer. In fullscreen rendering, the opening square bracket writes the conversation to native terminal scrollback, while the letter v opens it through a temporary file in your configured editor. Press the question-mark key in that viewer to check its available shortcuts before relying on a remembered key.
Use the native export dialog for a durable file or the whole conversation on the clipboard. Enter the command inside the session you want to copy:
/export
The command reference documents both destinations. For a long transcript, choose a file and check it before copying the relevant section onward. That gives you a stable original while you shorten the version intended for another person.
Copy from the VS Code panel
The graphical extension has its own control. Anthropic documents Copy response and the copy command in the panel for Claude Code version 2.1.277 or later.
- Hover over the response you need.
- Click Copy response.
- Paste into an empty text document.
- Compare the pasted ending with the response.
This copies the answer as written, including TeX source for equations. A rendered preview in the panel therefore isn’t a promise about how the destination app will display the clipboard contents. For finding an older response before copying, see VS Code chat history.
DocMyChat doesn’t work inside Claude Code or its VS Code extension. Use the native controls described here; the browser extension’s chat-export buttons belong to supported claude.ai chats in desktop Chrome.
Check one complete example before reuse
Suppose a fictional configuration review produces an explanation followed by a YAML block. The recipient needs the configuration, but the explanation also says that the address is a development-only value. Keep that qualification with the review note instead of silently treating the example as production configuration.
service:
name: garden-booking-demo
address: localhost
notifications:
enabled: false
Copy the block through the native picker, then compare its indentation and final line in the destination editor. If you copy the whole response instead, separate explanatory text from the YAML before saving it as configuration. The goal is a faithful transfer of the intended content, followed by an independent review of whether that content is appropriate.
Save the checked copy with its context. Ask the recipient to review that exact version before it replaces any working configuration.
Questions
How do I copy the previous Claude Code answer?
The native copy command accepts a response number, so you can select the second-latest answer instead of the most recent one. Check the selected text before pasting it into code or documentation.
Why does Ctrl+C stop Claude instead of copying?
Claude Code uses Ctrl+C to interrupt or clear input when the keystroke reaches its prompt. Terminal selection and copy shortcuts depend on the terminal and platform; select the text first and use the terminal’s copy action.
Can I copy a whole conversation to the clipboard?
Yes. The native export command without a filename offers clipboard or file output for the current conversation. A file is easier to check when the transcript is long.
Does Copy response include a rendered equation?
In the VS Code extension, Anthropic says response copying preserves the answer as written, including TeX source. Don’t expect the clipboard to contain an editable equation object from the visual rendering.