Why pasting into VS Code makes a mess
When you copy from a web page, the clipboard holds the page's full HTML fragment — inline styles, spans, smart quotes, tracking attributes. What happens on paste depends on where you land:
Into a .md file
VS Code inserts the raw HTML verbatim. Markdown renderers tolerate some inline HTML, so nothing errors — but your clean document fills up with <p style="..."> noise that is painful to edit later.
Into source code
Smart quotes and non-breaking spaces are invisible in the editor but break string literals, YAML values and regexes at runtime. Classic source of "works on my machine".
Into commit messages or docs
Hidden markup bloats diffs and makes documentation inconsistent with hand-written Markdown around it.
The fix is to convert the clipboard between copy and paste — ideally with one keyboard shortcut, without leaving the editor.
Your options today
| Option | What it does | Catch |
|---|---|---|
| Built-in paste | Inserts clipboard as-is (rich HTML kept when target accepts it) | No conversion at all — the whole problem |
| Paste as plain text | Strips all formatting via the command palette (Paste as plain text) | Loses everything — no headings, no links, no lists |
| Manual cleanup | Paste, then find-and-replace the worst offenders | Slow, error-prone, different every time |
| Clean Copy for VS Code | Converts clipboard HTML to proper Markdown or spotless plain text on paste | Free extension install — one time |
The fix: Clean Copy for VS Code
Clean Copy brings the converter behind the Clean Copy browser extension into your editor. Same core, same output — so text you copy to research and text you paste into docs behave identically.
- Install the extension (see the Clean Copy page for the current install options).
- Copy any content from the web.
- In VS Code, press Ctrl+Shift+V (Cmd+Shift+V on Mac) — the clipboard lands as clean Markdown.
- Want zero formatting instead? Run Clean Copy: Paste as Clean Text from the command palette.
- Already typed something messy? Select it and run Clean Copy: Convert Selection to Markdown.
# Headings preserved
H1–H6 map to the right number of # characters, so document structure survives the trip.
[Links](intact)
Links become standard Markdown references with the original URL — no relative-path surprises.
Tables → pipe tables
Simple HTML tables convert to Markdown pipe tables, including alignment.
Local only
Conversion happens inside the editor. Nothing is uploaded, nothing is tracked.
Want to see the same engine before installing anything? It also runs in the browser, right here in this page:
The VS Code extension in this guide is free. Pro is for the two jobs a single paste shortcut does badly.
Everything in this guide — the install, the paste shortcut, the convert-selection command, the plain-text mode — is free, and it stays free: no account, no key, no expiry, and no limit on what you paste. If your workflow is copy in VS Code, paste in VS Code, you never need to pay for anything.
What one editor shortcut cannot do is the work that happens before you reach the editor: collecting pages, stripping a site's inline styles, and converting a pile of snippets in one go. Pro covers the web tool and the browser extension, and adds the two things that actually cost you time there — converting a whole batch of pasted snippets at once, and cleanup rules you write once and reuse everywhere.
| What you get | Free | Clean Copy Pro — $19/year |
|---|---|---|
| The VS Code extension in this guide | included, forever — paste as Markdown, paste as clean text, convert selection | included |
| Conversion modes in the extension and on the web tool | every conversion mode in the extension and on the web tool | included |
| How much text you can convert | no limit on how much text you paste | included |
| Many snippets at once, one per line | — | batch conversion on the web tool |
| Your own cleanup rules, defined once | — | custom cleanup rules in the browser extension |
| Devices covered by one licence | — | 5 |
One licence covers 5 machines or installs. If the editor shortcut already does everything you need — and for most documentation work it does — the free version is the whole answer, and it is not a trial.
Frequently asked questions
Can VS Code paste HTML as Markdown?
Not natively. Pasting rich text into a Markdown file inserts raw HTML tags. You need an extension such as Clean Copy for VS Code, which converts the clipboard HTML to Markdown (Ctrl/Cmd+Shift+V) before it lands in your editor.
What is the shortcut to paste without formatting in VS Code?
By default there is none. With Clean Copy installed, Ctrl+Shift+V (Cmd+Shift+V on Mac) pastes the clipboard as clean Markdown, and the command palette offers a paste-as-plain-text command as well.
Does the conversion keep links, headings and tables?
Yes. Headings map to # levels, links become [text](url), lists stay lists, bold and italic survive, code blocks become fenced blocks, and simple tables convert to pipe tables.
Does anything get uploaded to a server?
No. Clean Copy runs entirely inside your editor. The clipboard content is converted locally and never leaves your machine.
Related: Copy as Markdown in Chrome · Paste Without Formatting · HTML to Markdown Converter · HTML to Markdown from the Terminal · HTML to Markdown API
Free e-book: Build Your First Chrome Extension
The complete guide is available as a free EPUB — no signup required.
Get the free e-book →Want all six guides? Complete EU Compliance Bundle — all six listed together, each a free EPUB.
Keeping websites online? DeskUptime is a free desktop uptime & SSL-expiry monitor for macOS, Linux and Windows.