How to Strip Formatting and Convert Any Text to Clean Plain Text
By Khizar Tahir · Founder & Developer, Casetivo
Have you ever copied a paragraph from an email, a PDF, or a Google Doc, pasted it into your website's content management system (CMS), and watched your entire page layout break?
Maybe the font suddenly shrunk to 10 pixels, or the background turned gray, or huge erratic gaps appeared between your paragraphs.
Even worse: have you ever pasted a code snippet or SQL query into your terminal, only to get an infuriating syntax error caused by a single “curly quote” or an invisible zero-width space?
This happens because modern word processors and websites do not copy just your words—they copy hundreds of hidden styling tags, font definitions, and non-standard Unicode marks alongside them.
Here is a practical breakdown of why rich text creates so much friction, the hidden characters that cause errors, and the fastest ways to strip formatting down to clean, pure plain text.
What Actually Happens When You Copy Rich Text?
When you press Ctrl+C (or Cmd+C on Mac) inside a program like Microsoft Word, Google Docs, or a web browser, your operating system does not copy simple characters. Instead, it places multiple versions of your clipboard payload into memory:
- HTML Format (
text/html): Contains inline CSS styles (style="font-family: Arial; font-size: 11pt; color: #333333; background: #ffffff;"), nested<span>and<div>tags, and custom margin wrappers. - Rich Text Format (
text/rtf): Microsoft's legacy formatting language filled with proprietary font tables and paragraph specs. - Plain Text (
text/plain): The bare text without formatting.
When you paste into an application that accepts rich formatting—such as WordPress, Shopify, Notion, or Gmail—the receiving editor automatically grabs the HTML format. It drags in all the original colors, microscopic line heights, and font families from the source, overriding your destination styling.
The 4 Hidden Culprits That Break Formatted Text
Beyond visible fonts and colors, copying formatted text frequently injects four invisible or semi-invisible characters that wreck databases, code, and publishing pipelines:
1. Smart Quotes and Curly Apostrophes
Word processors automatically convert typewriter straight quotes (" and ') into typographical curved quotes (“ ” and ‘ ’). While visually appealing in printed books, curly quotes are completely invalid in code, JSON, SQL queries, CSV imports, and URL strings. A single curly apostrophe in a database insert statement will trigger an immediate syntax failure.
2. Non-Breaking Spaces ( / \u00A0)
Websites and word processors use non-breaking spaces to prevent words from splitting across line breaks. Visually, a non-breaking space looks identical to a regular space. However, computer compilers and spreadsheet parsers do not treat them the same way. If you paste a formula with non-breaking spaces into Excel or Google Sheets, the formula often throws a #VALUE! error.
3. Invisible Zero-Width Characters
Characters like Zero-Width Spaces (\u200B), Byte Order Marks (\uFEFF), and Soft Hyphens (\u00AD) are completely invisible to the human eye. They often sneak in when copying from PDFs, messaging apps like Slack, or foreign language websites. When saved to a database, they can cause search queries to fail (because "apple" with an invisible zero-width character does not match a search for "apple").
4. Stray HTML Tags and Entity Codes
Copying raw text from web pages frequently leaves behind lingering entity codes like &, ", <, and >, as well as orphaned <b> or <span> wrappers that clutter your database and inflate file sizes.
3 Ways to Convert Text to Plain Text
Depending on where you are working, here are the most reliable methods to clean your text:
Method 1: Use Casetivo's Free Plain Text Converter (Fastest & Most Complete)
If you have a document with mixed formatting, stubborn curly quotes, or strange spacing, simple paste shortcuts often fall short.
- Open Casetivo's Plain Text Converter.
- Paste your formatted content into the input box.
- Toggle your preferred cleanup filters:
- Strip HTML / XML Tags: Removes all styling spans, divs, and links.
- Straighten Smart Quotes: Automatically converts “smart quotes” into standard ASCII quotes (
"and'). - Normalize Dashes: Turns long em dashes (—) and en dashes (–) into standard hyphens.
- Remove Invisible Characters: Erases zero-width spaces, soft hyphens, and non-breaking spaces.
- Collapse Extra Blank Lines: Removes messy gaps created by double-spaced documents.
- Click Convert to Plain Text and copy your clean, sanitized output.
Because Casetivo processes everything locally inside your browser, none of your sensitive text or confidential company documents are ever sent to a remote server.
Method 2: The "Paste Without Formatting" Keyboard Shortcut
Most modern web browsers and desktop operating systems have a built-in shortcut that forces the clipboard to discard rich formatting:
- Windows & ChromeOS: Press
Ctrl + Shift + V - Mac: Press
Cmd + Shift + Option + V(orCmd + Shift + Vin Google Docs)
The limitation: While this shortcut strips visible colors and font sizes, it does not straighten curly quotes, convert em dashes, or remove invisible zero-width characters. If your text contains smart quotes or non-breaking spaces, they will carry right through into the destination.
Method 3: The Notepad or TextEdit Pass-Through
A classic developer trick is opening a bare-bones plain text editor:
- Open Windows Notepad or macOS TextEdit (make sure TextEdit is set to Plain Text Mode under
Format > Make Plain Text). - Paste your formatted text into the blank document.
- Select all (
Ctrl+AorCmd+A) and copy it again. - Paste it into your destination.
The limitation: This removes HTML tags, but like the keyboard shortcut, standard Notepad will preserve curly apostrophes and non-breaking spaces unless you manually search and replace them.
Best Practices for Clean Content Publishing
To save yourself from endless re-formatting headaches, build these habits into your daily writing workflow:
- Draft in Markdown or Plain Text: Writing your initial drafts in Markdown or clean text editors prevents font conflicts before they even start.
- Sanitize Data Before Importing: Always run CSV data, customer lists, or product catalogs through a Plain Text Converter or Duplicate Line Remover before importing them into production databases.
- Inspect Questionable Code Snippets: If a colleague pastes terminal commands into a Slack or Teams chat, never copy and run them directly into your production server. The chat client will often convert their hyphens into en dashes or inject non-breaking spaces that break command arguments.
Summary
Plain text is universal, lightweight, and indestructible. It opens flawlessly on every device, imports cleanly into any database, and renders consistently across every browser.
Whenever formatted copy misbehaves, take five seconds to run it through the Plain Text Converter—it will save you hours of debugging broken layouts and failed queries.