Windows Terminal: Copy Plain Text Without Formatting
Windows Terminal copies plain text only by default. If text you copy from it pastes into Word, Outlook or Teams with the terminal's colours and font, the copy format setting has been changed: open Settings (Ctrl+,), go to Interaction, and set Text formats to copy to the clipboard to Plain text only. If you're seeing codes like [32m or [0m in pasted text, those are ANSI colour codes saved in the output itself, and you need to turn colour off in the tool or strip the codes.
How to set Windows Terminal to copy plain text
- Open Windows Terminal and press Ctrl+, to open Settings.
- Select Interaction in the left pane.
- Under Text formats to copy to the clipboard, choose Plain text only.
- Select Save.
This is a global setting, not a per-profile one, so it applies to PowerShell, Command Prompt and WSL tabs alike. The other choices are HTML, RTF and Both HTML and RTF.
In settings.json (Ctrl+Shift+, opens it), the same setting is copyFormatting at the root of the file:
"copyFormatting": "none"
It accepts true, false, "all", "none", "html" and "rtf", and the default is false, which means plain text.
How to copy with colours on purpose
Sometimes you want the colours, for example to paste coloured git diff output into a document. (To compare two snippets you copied rather than share a diff, see how to diff two copied code snippets.) Set Text formats to copy to the clipboard to HTML (for web-based and Office apps) or Both HTML and RTF. Plain text is still placed on the clipboard alongside, so code editors and terminals keep receiving plain text.
If you want colours only occasionally, leave the global setting on plain text and add a second copy shortcut in settings.json that copies with formatting:
"actions": [
{ "command": { "action": "copy", "copyFormatting": "html" }, "id": "User.CopyWithColour" }
],
"keybindings": [
{ "keys": "ctrl+alt+c", "id": "User.CopyWithColour" }
]
If your file already has actions or keybindings arrays, add each entry inside the existing array rather than creating a second one, and pick a key combination you aren't already using.
When pasting formatted text into an app where you don't want it, paste as plain text instead; how to paste without formatting on Windows covers the shortcuts for each app.
Why copied text contains codes like [32m or [0m
Those are ANSI escape sequences, the instructions terminals use for colour and bold. Windows Terminal interprets them on screen and doesn't put them in a normal copy. They end up in your text when:
- You copy from a saved log or file. A build tool or script forced colour on and wrote the codes into the file. Open it in an editor and you'll see them as
ESC[32m,^[[32mor←[32m. - Output was piped or redirected with colour forced on, for example
ls --color=always > out.txtin WSL. - A custom copy action includes them. Windows Terminal's
copyaction has awithControlSequencesoption that deliberately copies the codes. If you added a binding with it set totrue, that binding copies codes.
PowerShell 7.2 and later strip ANSI codes from piped and redirected output by default ($PSStyle.OutputRendering is set to Host), so PowerShell's own formatted output is usually clean. Native programs aren't covered by that setting.
How to turn colour off at the source
- Many command-line tools respect the
NO_COLORenvironment variable. In PowerShell 7.2 and later, setting it switches$PSStyle.OutputRenderingto plain text. - Git: add
--no-color, as ingit diff --no-color. - GNU tools in WSL such as
lsandgrep: use--color=never, or--color=auto, which only adds colour when writing to a terminal.
How to strip ANSI colour codes from text
In PowerShell, remove colour codes from a file and copy the result:
(Get-Content .\build.log -Raw) -replace '\x1b\[[0-9;]*m', '' | Set-Clipboard
In WSL or Git Bash:
sed 's/\x1b\[[0-9;]*m//g' build.log > build-clean.log
Both patterns remove colour and style codes (the ones ending in m), which are by far the most common. Cursor-movement codes from progress bars use other endings, so a log full of progress output may still need tidying by hand.
Other Windows Terminal copy options
| Setting or action | What it does | Default |
|---|---|---|
| Alt+drag | Selects a rectangle (block) instead of whole lines | Available always |
Remove trailing white-space in rectangular selection (trimBlockSelection) | Trims spaces at the end of each line of a block selection | On |
Automatically copy selection to clipboard (copyOnSelect) | Copies as soon as you select; right-click then always pastes | Off |
| Copy shortcuts | Ctrl+C (when text is selected), Ctrl+Shift+C, Ctrl+Insert, Enter | Bound by default |
| Mark mode | Ctrl+Shift+M selects with the keyboard | Bound by default |
singleLine option on a copy action | Copies a multi-line selection as one line | Off |
Block selection is the one to remember for tables and aligned output: hold Alt and drag to copy just the columns you need. For hex output in particular, copying a hex dump without losing alignment covers where to paste it. Copying an error log without the noise covers choosing what to copy from long output.
Pasting into a terminal
Pasting into Windows Terminal is always plain text, whatever the source app put on the clipboard. Multi-line pastes can run several commands at once, which is why Windows Terminal warns before them by default; how to paste into Windows Terminal safely explains those warnings.
If text copied from a WSL tab with clip.exe comes out with garbled accents or symbols, that's an encoding problem rather than formatting; the WSL clipboard guide has the fix.
FAQ
Does Ctrl+Shift+C copy with formatting?
No. Ctrl+C (with a selection), Ctrl+Shift+C, Ctrl+Insert and Enter all run the same default copy action, which follows your Text formats to copy to the clipboard setting.
Why does pasted output look fine in VS Code but coloured in Outlook?
VS Code's editor takes the plain text version from the clipboard. Outlook and Word take the HTML or RTF version if it's there. Setting Windows Terminal to Plain text only stops those versions being placed on the clipboard at all.
Can I copy the whole scrollback at once?
Press Ctrl+Shift+A to select all, then copy. For long sessions, the export buffer command in the command palette (Ctrl+Shift+P) saves the scrollback to a text file instead.
Related reading
- How to Paste Into Windows Terminal Safely
- How to Copy an Error Log Without the Noise
- How to Paste Without Formatting on Windows
- WSL Clipboard: Copy and Paste Between Linux and Windows
Sources
- Windows Terminal interaction settings (Microsoft Learn) — copyFormatting values and default, copyOnSelect, trimBlockSelection, Alt-drag block selection.
- Windows Terminal actions (Microsoft Learn) — copy action bindings and its singleLine, withControlSequences and copyFormatting options, settings shortcuts, select all, mark mode, export buffer.
- Windows Terminal settings editor strings (GitHub) — the Settings labels "Text formats to copy to the clipboard" and "Plain text only".
- about_ANSI_Terminals (Microsoft Learn) — $PSStyle.OutputRendering and NO_COLOR in PowerShell 7.2 and later.
- Windows Terminal command palette (Microsoft Learn) — Ctrl+Shift+P.
Deepender Yadav created Edge Drop and builds and tests it, from the edge-hover shelf to each release. A B.Tech Computer Science Engineering student, Deepender writes the Edge Drop guides, comparisons and developer posts, and checks product details against the app's source code.
GitHub · LinkedInCopy. Stack. Drop.
Transform your clipboard into an interactive edge shelf. Stack, pin, and drag assets into any app with zero friction.
Download for Windows Get from Microsoft Store
How to Install Guide · First 10 Minutes Guide · Drag & Drop Guide · Edge Drop vs Win+V · Support
Free · Lightweight · Privacy First