Copied or exported content often arrives full of HTML tags, angle brackets wrapping your actual words. Here is how to strip the markup and keep the text.
Where HTML tags come from
You get raw HTML when you:
- copy from "view source" or a code view
- export content from a CMS or email tool
- paste from an app that puts HTML on the clipboard
The result is your text buried in tags like <p>, <div>, <span>, and inline styles, which you do not want in a plain document.
Method 1: a cleaner
Paste the content into a cleaner that understands structure. A good one strips the tag soup, keeps the readable text, and preserves the meaningful structure (turning <ul><li> into a real list, for example) rather than leaving raw markup. textscrubr sanitizes pasted HTML this way: it removes the messy span-and-style clutter that Word, web pages, and email tools bring along, keeps the real structure, and cleans the invisible characters at the same time.
Method 2: regex in an editor
For a quick strip in a regex-capable editor:
- Search for
<[^>]+>(any HTML tag). - Replace with nothing.
This deletes the tags and leaves the text. Two cautions:
- It also removes tags you might have wanted as structure (like list items), leaving a wall of text.
- It does not decode HTML entities like
&or , so you may need a second pass to turn those back into normal characters.
Method 3: paste into a plain-text field
Pasting HTML into a plain text editor sometimes shows the tags as literal text rather than rendering them, which lets you see and remove them. This is fiddly for large content, so a cleaner is usually faster.
Keep structure or go fully plain?
Decide what you want:
- Readable text with structure: use a cleaner that converts real HTML lists and headings into clean equivalents.
- Pure plain text: strip all tags and flatten, then clean the entities and invisible characters.
A cleaner gives you both options and handles the entity decoding and hidden-character removal that regex alone misses.