Strip HTML Tags: Tips, Settings and Common Pitfalls
The most common mistakes when stripping HTML are leaving entities undecoded so litters the text, losing all paragraph structure by skipping block line breaks, and being surprised by collapsed whitespace from the original markup. Each is easy to avoid once you know the settings. Here are the practices that give clean, readable plain text every time, plus how to troubleshoot output that does not look right.
Best practices
- Turn on entity decoding for human-facing text. Encoded sequences like &, and ' are correct in HTML but ugly in plain text. Decoding turns them into &, spaces and apostrophes so the result reads naturally.
- Keep block line breaks to preserve structure. Without it, a page full of paragraphs and headings collapses into one run-on block. With it, each block element becomes its own line.
- Strip first, then tidy whitespace. Run the output through a whitespace cleaner afterwards if the source had lots of indentation or repeated spaces.
- Trust it with private markup. Because it is fully in-browser, you can paste internal email templates or confidential content without it being uploaded.
Choosing your settings
| Goal | Decode entities | Block line breaks |
|---|---|---|
| Readable copy for reuse | On | On |
| Single-line value for a field | On | Off |
| Preserve raw entities on purpose | Off | Depends |
| Extract words for word count | On | Off |
Common pitfalls and fixes
A few things surprise people. First, collapsed whitespace: HTML ignores extra spaces and line breaks in the source, so text that looked spaced out in the markup can come through tightly packed. That is expected — the tool preserves the meaningful text, and you can re-space it afterwards. Second, missing structure: if your output is one long line, you forgot to enable block line breaks; turn it on and paragraphs separate. Third, leftover entities: seeing & in the result means decoding was off. Fourth, inline formatting loss: bold, italic and links are formatting, not text, so they disappear by design — plain text has no way to represent them.
Troubleshooting messy output
If the result still looks wrong, work through the source. Deeply nested or broken markup from a WYSIWYG editor can carry hidden non-breaking spaces ( ) that decode to odd-looking gaps — a follow-up pass to remove extra spaces cleans those up. Content pasted from a word processor sometimes includes smart quotes and special dashes as entities; decoding converts them to the real characters, which is usually what you want. And remember that script and style contents are removed entirely, so if you expected to see some inline data that lived inside a <script> block, it is gone by design to keep code out of your text.
Try the Strip HTML Tags — free and 100% in your browser.
FAQ
Why did my spacing disappear after stripping tags?
HTML collapses runs of whitespace, so spacing that came from indentation in the source is not preserved as text. Enable block line breaks for structure, then use a whitespace cleaner if you need to normalise gaps.
When should I leave entity decoding off?
Only when a downstream system expects the escaped form, or when you are inspecting exactly which entities the source used. For anything a person will read, decoding on is the right choice.
My bold and links are gone — is that a bug?
No. Plain text cannot represent bold, italics or hyperlinks, so that formatting is dropped intentionally. If you need to keep link targets, copy them separately before stripping.
How do I get a clean word or character count?
Strip with entities decoded and block breaks off to get continuous text, then read the live character count the tool shows on the output, or paste into a word counter.
Related free tools
- Remove Extra Spaces — clean up whitespace after stripping.
- Remove Line Breaks — collapse to a single line when needed.
- HTML Formatter — inspect the markup before stripping.
- URL Decoder — decode percent-encoded values from links.
Built by ByteVancer
ByteTools is a free product of ByteVancer, a software and web development studio building web apps, SaaS and custom software. If practical tools like this help you, explore what ByteVancer can build for your business.
Recommended reading
How to Strip HTML Tags and Convert to Plain Text
Step-by-step guide to removing HTML tags and converting markup to clean plain text online, with entity decoding and line breaks, all in your browser.
Strip HTML Tags: Use Cases and Real Workflows
Real scenarios for stripping HTML: cleaning copied web content, prepping email text, feeding plain-text fields and extracting copy for word counts.
HTML Entity Decoding: Tips and Pitfalls to Avoid
Pro tips for decoding HTML entities: handling double-encoding, mojibake, unknown entities and mixed references, plus the pitfalls that corrupt text.
How to Decode HTML Entities to Plain Text Online
Learn how to decode HTML entities to readable text: named, decimal and hex references, converted instantly and privately in your browser with no uploads.