Mantravali / PasteFix / Guide
How to Paste Text Without Formatting on Mac (and Fix Messy Text)
You copy a paragraph from a web page, paste it into an email, and it arrives in a different font with a stray background colour. Or you copy from a PDF and every line ends in a hard break. This guide covers the built-in ways to paste text without formatting on a Mac, then the messy-text problems that a formatting shortcut does not fix.
Paste and Match Style
The fastest method is Paste and Match Style. Copy your text as usual with Cmd C, click where it should go, and press Option Shift Cmd V. The text takes on the font, size and colour of the document you are pasting into instead of bringing the source's styling along.
Two things to know. First, the result depends on the app, so glance at what you get. Second, not every app has this command. If the shortcut does nothing, check the Edit menu as described next.
In a plain-text field, such as a Terminal window, there is no formatting to carry over, so an ordinary Cmd V already pastes plain text.
Use the Edit menu
If you cannot remember the shortcut, or it does not work, open the app's Edit menu in the menu bar and look for Paste and Match Style. The shortcut is shown next to it, which also confirms whether the app supports it.
Some apps word it differently. Google Docs, for example, calls it Paste without formatting under its Edit menu. If you find neither, the app probably has no dedicated command, and the TextEdit method below works everywhere.
Plain-text mode in TextEdit
TextEdit comes with every Mac and makes a reliable scrubber for any text, because a plain-text document cannot hold formatting.
- Open TextEdit and create a new blank document.
- Choose Format > Make Plain Text. If the menu says Make Rich Text instead, the document is already plain text.
- Paste with Cmd V, then select everything with Cmd A and copy it again with Cmd C.
- Paste into your destination. The clipboard now holds plain text only.
Do this in a new, empty document, because converting a document that already has formatting removes that formatting. To make plain text the default, open TextEdit > Settings, go to New Document and set the format to Plain text.
If you are comfortable in Terminal, pbpaste | pbcopy does the same job in one step: it reads the clipboard as text and writes it back as plain text.
Notes for common apps
- Mail: use Edit > Paste and Match Style. To make a whole message plain, choose Format > Make Plain Text.
- Notes and Pages: both list Paste and Match Style in the Edit menu.
- Safari and Chrome: in an editable field, the Edit menu offers Paste and Match Style. Chrome also accepts Shift Cmd V.
- Google Docs: Edit > Paste without formatting, or Shift Cmd V.
- Microsoft Word: after you paste, a small Paste Options button appears next to the text. Open it and choose Keep Text Only.
For anything not listed, open the Edit menu and see what the app offers rather than guessing at a shortcut.
Fix line breaks from PDFs
Text copied from a PDF often pastes with a line break at the end of every visual line, so a paragraph turns into a ragged column. Plain-text pasting does not fix this, because the breaks are real characters in the text.
The cleanest fix is a find-and-replace that joins lines but keeps the blank lines between paragraphs. In an editor that supports regular expressions, such as BBEdit or Visual Studio Code, replace a newline that is not next to another newline with a single space. The Mac's built-in tools can do it too. With the text on your clipboard, run this in Terminal:
pbpaste | perl -0pe 's/(?<!\n)\n(?!\n)/ /g' | pbcopy
The cleaned text replaces what is on the clipboard, with paragraphs still separated by a blank line. If you only have a single paragraph, pbpaste | tr '\n' ' ' | pbcopy is a simpler alternative.
Check the result. Words hyphenated at the end of a line, such as "informa-" followed by "tion", will not be rejoined, and headings or bullet lists that sit on their own lines will be merged into the text around them.
Fix smart quotes and extra spaces
Curly quotes and dashes
Word processors and web pages often use curly quotes and long dashes. They look good in a document but can break things in code, spreadsheets, search boxes and some web forms, which expect straight quotes. To straighten them, copy the text and run this in Terminal:
pbpaste | perl -CSD -pe "s/[\x{201C}\x{201D}]/\"/g; s/[\x{2018}\x{2019}]/'/g" | pbcopy
The same pattern works for dashes: add another substitution that replaces \x{2013} and \x{2014}, the en and em dash, with a hyphen.
If your Mac keeps turning your own typing into curly quotes, that is a separate setting. In recent versions of macOS, open System Settings > Keyboard > Text Input, click Edit and turn off Use smart quotes and dashes. It only changes what you type from then on, not text you paste.
Extra and invisible spaces
Pasted text can carry double spaces, trailing spaces and non-breaking spaces. A non-breaking space looks like a normal space but is a different character, so an ordinary find-and-replace for a space will not catch it. This command swaps non-breaking spaces for normal ones and collapses runs of spaces:
pbpaste | perl -CSD -pe "s/\x{00A0}/ /g; s/ {2,}/ /g" | pbcopy
All of these commands read the clipboard as plain text, so they also drop formatting. Run them on a copy, and press Cmd Z in your document if the paste is not what you wanted.
PasteFix is a Mac menu bar app that can tidy copied text for you, including curly quotes, odd spacing and bullet characters, with no commands to remember. It's coming soon.
Get notified