How to Clean Text Copied From Microsoft Word and Google Docs
To clean Word formatting out of copied text, work in two stages. First paste without formatting, which drops fonts, colours, sizes and styles. Then clean the characters that a plain-text paste cannot drop because they are part of the text itself: non-breaking spaces, manual line breaks, tabs from lists and indents, soft hyphens, doubled spaces and spare blank lines. The same two stages work for Google Docs.
Skipping the second stage is why text that supposedly “has no formatting” still misbehaves in a content management system, a form field, a spreadsheet or a code file.
What Word and Docs put on the clipboard
A copy from a word processor places more than one version of the selection on the clipboard. There is a rich version, typically HTML, which describes fonts, colours, spacing, list styles and tables. And there is a plain-text version that contains only characters. The application you paste into decides which to take: another word processor or a rich email editor takes the rich one, while a plain-text editor or a text box on a web page takes the plain one. Plain text versus rich text covers that mechanism in detail.
The plain-text version is where the surprises are. It has no styles, but it is written by the word processor, which has to turn every visual feature into characters or throw it away.
What survives in the plain-text version
| In the document | In the plain-text copy |
|---|---|
| Curly quotes, dashes, ellipsis | The same characters: “ ”, ‘ ’, –, —, … |
| Non-breaking space | U+00A0, which looks like a space and is not one |
| Manual line break (Shift+Enter) | A line break. Word’s own character for it is the vertical tab, U+000B, which can come through unchanged |
| Tab key used for indents and alignment | A tab character each time |
| Bulleted or numbered list | Markers may arrive as typed characters, often followed by a tab, or not at all |
| Table | The cell text without the grid, typically separated by tabs and line breaks |
| Soft hyphens already in the text | U+00AD, still invisible |
| Empty paragraphs used for spacing | Blank lines, sometimes several in a row |
| Two spaces after a full stop | Two spaces |
| Bold, italics, headings, colours, link addresses | Nothing; only the words remain |
Two details are worth knowing. A list number that arrives is typed text and will not renumber when you delete the item above it. And indentation set with the ruler or a paragraph style is not a character, so it does not survive, while indentation typed with the Tab key does.
The non-breaking space causes the most confusion of these, because nothing about it looks wrong. The guide to what a non-breaking space is lists everything it breaks.
Stage 1: paste without formatting
How you do this depends on where the text is going:
- Google Docs: Ctrl+Shift+V, or ⌘+Shift+V on a Mac, is “Paste without formatting”.
- Word: paste, then choose “Keep Text Only” from the paste options. Microsoft describes it as discarding all formatting and non-text elements such as pictures and tables.
- Mac applications: many offer “Paste and Match Style”, Option+Shift+Command+V.
- Other applications: look for a command named “paste as plain text” or “paste without formatting”.
- The Text Cleaner: an ordinary paste is enough. Its Input Text box holds plain text only, so the rich version is never used.
Pasting into a CMS or web editor
A rich editor on a web page takes the HTML version when one is available. With word-processor content, that means the source document’s fonts, sizes and colours arriving as markup in your page, where they can override the site’s own typography. All of that comes from the rich version. Paste as plain text and none of it arrives; then apply headings, links and emphasis with the editor’s own controls.
If the markup is already in your text as visible tags, the Text Cleaner’s Strip HTML tags and Decode HTML entities options reduce it to plain text.
Stage 2: clean the characters that are left
- Paste the text into the Input Text box.
- Select the Word / Docs preset.
- Press Clean Text. Nothing is processed before you press it, and the text stays in your browser.
- Read the summary of what changed, then use Copy or Download .txt.
The preset does everything General Clean does: it converts non-breaking spaces to ordinary spaces, trims trailing spaces from each line, collapses repeated spaces inside lines while leaving leading indentation alone, reduces runs of blank lines to a single blank line, and trims the start and end of the whole text. On top of that it removes zero-width spaces, byte order marks, soft hyphens and stray control characters. Word’s manual line break character, U+000B, is not deleted; it becomes a normal line break, and the summary reports it as a control character converted to a line break.
It does not touch words, letter case or punctuation. Smart quotes and dashes are left exactly as they are, and tabs are not converted.
A worked example
Here [VT] is Word’s manual line break, [TAB] a tab, [NBSP] a non-breaking space, [SHY] a soft hyphen, and each · an extra space.
Before
Project Update[VT]Week 12
•[TAB]Budget approved··for Q3
•[TAB]Launch moved to 14[NBSP]March··
[TAB]“We’re on track,” said the co[SHY]ordinator.
After
Project Update
Week 12
•[TAB]Budget approved for Q3
•[TAB]Launch moved to 14 March
[TAB]“We’re on track,” said the coordinator.
The summary reports 1 control character converted to a line break, 1 non-breaking space converted, 1 soft hyphen removed, 1 line trimmed, 1 extra space removed and 1 blank line collapsed. The tabs and the curly quotes are still there, because whether to keep them depends on where the text is going.
Optional extras
Open Advanced Cleaning Options to go further. Once you have cleaned once, changing an option updates the result straight away, except on very long texts, where you press Clean Text again.
- Tabs → spaces replaces each tab with one space, which turns
•[TAB]Budgetinto• Budget. Leave it off for table data you plan to paste into a spreadsheet, where the tabs are what separate the columns. - Trim each line removes leading indentation as well as trailing spaces.
- Remove empty lines deletes blank lines entirely, for when you want one paragraph per line with nothing between.
- The five Typography options convert smart quotes, apostrophes, dashes and the ellipsis character to their plain equivalents. They are off by default; smart quotes versus straight quotes explains when converting is the right call.
Be careful with the Line Breaks setting. Join wrapped lines but preserve paragraphs treats a blank line as the paragraph boundary. Many documents separate paragraphs with spacing, not with an empty paragraph, so in the plain-text copy each paragraph is a single line with no blank line after it. Joining would merge consecutive paragraphs into one. Leave the setting on Keep line breaks unchanged unless the text really is hard-wrapped.
What cleaning cannot bring back
Plain text has no record of what was a heading, which words were bold or where a link pointed. Anything that was only formatting, such as a superscript, is now an ordinary character, and no option can tell it apart from its neighbours. A read-through at the end is still part of the job.
Sources
- Clipboard API and events — W3C
- Control the formatting when you paste text — Microsoft Support
- Keyboard shortcuts for Google Docs — Google Docs Editors Help
- How Can I Insert a Manual Line Break into a Microsoft Word Document? — Microsoft Scripting Blog (archived)
This guide was drafted with AI assistance and reviewed by the publisher. See the editorial policy for how guides are written and corrected.