← Back to Blog

Workflows & Productivity | Aug 16, 2026 | 7 min read

Why Does Pasting Into Terminals Strip Formatting?

By Khushi Yadav

Why Does Pasting Into Terminals Strip Formatting? — Edge Drop Guide

A terminal does not want a Word heading, a Slack message card, or an Excel cell’s currency format. It wants characters. Windows Terminal will paste the Unicode text flavor of the clipboard. Fonts and most HTML drop away. That is not the same as “safe.”

A hidden carriage return can execute a command. A trailing space can break a path. A smart quote from a blog can turn a legal flag into garbage. A 20-line paste can run 20 lines. Microsoft documents warnings for large pastes and multi-line pastes for exactly that reason.

This playbook covers Windows Terminal, Windows PowerShell / PowerShell 7, classic conhost, and WSL. The rule is the same in each: convert to plain text on purpose, look at it, then paste.

What actually lands in the shell

Windows apps put multiple formats on the clipboard at once. A copy from a browser may include HTML and plain text. A copy from Word may include RTF, HTML, and text. The terminal asks for text.

That text still contains:

  • Line endings (LF or CRLF)
  • Tabs
  • Non-breaking spaces
  • Smart quotes and em dashes
  • Escape sequences if the source was another terminal and “copy formatting” was on
  • Bidirectional marks from mixed RTL/LTR text

It does not contain a font, a hyperlink object, or a bitmap. A screenshot of a command is not pasteable as a command unless OCR is used. History can store a bitmap up to 4 MB, but the shell will not run a picture.

How to paste without formatting on Windows is the general desktop habit. In a terminal, “without formatting” is the default. The remaining risk is the characters themselves.

Windows Terminal settings that matter

Microsoft’s interaction settings (Settings > Interaction, or settings.json) include:

SettingDefaultWhy it matters
copyOnSelectfalseIf true, selecting text copies immediately and right-click always pastes. Easy to paste the wrong buffer.
copyFormattingfalseIf true or html/rtf/all, copies can include color and font. Pasting *into* another Terminal may look styled; pasting into a shell still uses text, but HTML copies pollute history.
trimPastetrueStrips trailing whitespace on paste. Useful. Does not strip a trailing newline in every case you care about.
trimBlockSelectiontrueRectangular (Alt+drag) copies drop per-line trailing spaces.
largePasteWarningtrueWarns when the paste is larger than 5 KiB. Keep this on.
multiLinePasteWarningtrueWarns when the paste contains more than one line. Keep this on.

Leave both warnings on, especially on machines that hop between docs and production shells. Turning them off to save a click is how a blog’s “copy” button plus a hidden newline becomes a command.

Default paste keys in Windows Terminal:

  • Ctrl+V pastes (bound in the terminal, not in every Linux program).
  • Ctrl+Shift+V is the traditional “paste in terminal” chord; both often work.
  • Right-click pastes unless the experimental right-click context menu is enabled.
  • Ctrl+Shift+C copies a selection when copyOnSelect is off.

Ctrl+V inside Vim, nano, or a remote app may mean something else. When in doubt, use the terminal’s Paste command from the palette rather than hoping the inner program agrees.

PowerShell, CMD, and WSL

PowerShell 7 and Windows PowerShell

Ctrl+V pastes into the PSReadLine prompt. A newline at the end of the clipboard can accept the line. Paste a single command without a trailing return when the command is destructive.

To inspect without executing:

Get-Clipboard -Raw

Get-Clipboard reads the text flavor. It will not show HTML. If the output looks like a command plus a blank line, trim before a real paste.

To copy from the shell without extra formats:

Set-Clipboard -Value $text

Do not Get-Clipboard a password and leave the console history sitting on a shared monitor.

CMD / conhost

Mark/paste with the window menu still exists. Windows Terminal is the better host in 2026. If a legacy conhost window is required, right-click paste inserts text; there is no HTML paste.

WSL

Windows Terminal hosts bash, zsh, or whatever the distro uses. Paste is still a Windows Terminal action: it injects the Unicode text into the PTY. The Linux program sees keystrokes, not CF_HTML.

From inside WSL, reading the Windows clipboard is a separate hop:

powershell.exe -NoProfile -Command Get-Clipboard

Writing:

printf '%s' "$var" | clip.exe

Those helpers are for scripts. They are not required for ordinary Ctrl+V into the WSL tab.

Line endings: Windows text often has CRLF. Many Linux tools treat CR as part of the token (

apos;\r'). If a pasted path “looks right” and still fails, run sed -n l on the file or printf '%q\n' "$var". Strip \r in the editor before pasting a script block.

The hidden-newline problem

This is the incident pattern:

  1. A documentation page has a copy button.
  2. The copied string is rm -rf /tmp/project plus a newline.
  3. The terminal warning is disabled, or the operator confirms it without reading.
  4. The shell executes on paste.

Mitigations that actually work:

  • Keep multiLinePasteWarning enabled.
  • Prefer bracketed paste (Windows Terminal and most modern shells enable it). The shell receives the block as a single edit, not as executed lines — until Enter is pressed. Do not assume every remote system supports it.
  • Paste into an editor first for anything longer than one short flag.
  • For one-liners, paste at the end of an existing harmless prefix (echo ) and delete the prefix after visual inspection — only when the command is not secret. A cleaner habit is still: editor first.

Never paste a command from an untrusted page into an elevated prompt. The clipboard is not an allow-list.

Rich copies that look plain

Sources that surprise people:

SourceTypical extra characters
Word / Outlook / Google DocsSmart quotes “ ”, em dashes, non-breaking spaces
Web “pretty” code blocksNon-breaking spaces instead of spaces, soft hyphens
Excel$, grouping commas, tabs between cells, a trailing newline
Slack / TeamsSoft line wraps, user mention markup as text
Another Terminal with copyFormatting onRTF/HTML in history; text may still include trailing spaces

Smart quotes, em dashes, and other paste traps covers the Word family. How to copy a number without the currency symbol covers Excel. Right-to-left text on the Windows clipboard covers marks that can reorder a path mixed with Arabic or Hebrew.

PowerToys Advanced Paste Paste as plain text is a good last hop from a rich app into the terminal. It still will not remove a newline. Look at the Advanced Paste preview if that option is enabled.

History, pins, and secrets

Win+V will store terminal copies as text if they are under 4 MB. That includes:

  • Connection strings
  • export AWS_... lines
  • git URLs with embedded tokens (rare, still seen)
  • One-time codes copied from a browser

Do not pin those. Pins survive restart. Unpinned items vanish at reboot, which is not a wipe policy for a laptop that stays open all week. Clear with Win+V > Clear all, or Settings > System > Clipboard > Clear clipboard data.

Leave Clipboard history across your devices off on any machine used for shells. Microsoft documents that sync as text to other PCs on the same account.

A local manager with a longer history is a larger secret store. If one is installed, ignore password windows and set a short retention. Should you enable history if you only copy passwords? and Pair programming: do not leave secrets in history are the policy versions of this paragraph.

Edge-Drop is optional for staging a script file or a screenshot of an error, not for holding live tokens. Prefer a file in the repo over a clip of a command that “worked last time.”

Safe paste playbook

  1. Copy the command.
  2. If it is more than one line, paste into VS Code or Notepad first. Save if it is worth keeping.
  3. Turn smart quotes into ASCII. Strip \r. Remove a trailing blank line.
  4. Copy the cleaned text once.
  5. In Windows Terminal, paste. Read the multi-line warning. Cancel if the line count is unexpected.
  6. For production, run echo or --dry-run variants first when the tool has them.
  7. Clear history if anything secret was copied.

Win+V is still useful for three short flags collected from a ticket. It is not a command library. Twenty-five items and a restart wipe are enough of a hint.

Pasting code into Word, email, and chat is the reverse direction: getting code *out* of a shell without Word “helpfully” changing dashes. Use a fenced editor or a gist, not a formatted email, as the source of truth.

A dedicated walkthrough is How to Copy a List and Keep the Bullets.

Related reading

Sources

Khushi Yadav
Written by Khushi Yadav · Author & Content Writer

Khushi Yadav is a B.Tech Computer Science Engineering student interested in technology, software, and exploring practical applications of computer science. She enjoys learning new concepts and contributing to technology-focused projects.

GitHub · LinkedIn

Copy. 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
Find us on CodeHype