AltF Flow recipe
Strip HTML to plain text
To get readable text out of HTML, remove the tags and decode the entities. This recipe deletes script and style blocks and all tags, turning paragraph, heading, list item and line break tags into new lines. It then decodes entities such as &, " and ', trims each line, squeezes extra blank lines so paragraphs stay apart and trims the ends.
- Free, no sign-up
- Runs in your browser
- Nothing uploaded
- Share recipes as a link
5 steps · runs in your browser · nothing uploaded
Pipeline
Remove tags, scripts and styles, keeping the readable text.
10 → 16 lines (+6)HTML unescape
16 → 16 linesRemove leading and trailing spaces from each line.
16 → 16 linesKeep one between paragraphs
16 → 12 lines (-4)Remove spaces and blank lines from the start and end of the whole text.
12 → 10 lines (-2)
10lines34words342chars
10lines28words187chars
The 5 steps in this recipe
- 1
Strip HTML tags
Remove tags, scripts and styles, keeping the readable text.
- 2
Encode or decode - HTML unescape
URL, Base64, HTML entity and JSON string encoding, both directions.
- 3
Trim every line
Remove leading and trailing spaces from each line.
- 4
Remove empty lines - Keep one between paragraphs
Delete blank lines, or squeeze runs of blank lines down to one so paragraphs stay apart.
- 5
Trim whitespace
Remove spaces and blank lines from the start and end of the whole text.
Change any option in the workspace above, switch a step off to compare, or add your own steps. Save it to reuse it, or share the recipe as a link.
Worked example
<style>.promo { color: red; }</style>
<h1>Spring & Summer Menu</h1>
<p>Fresh dishes from our kitchen, served daily.<br>Book a table online.</p>
<ul>
<li>Tomato & basil soup</li>
<li>"House" salad with chef's dressing</li>
</ul>
<script>trackPageView();</script>
<p>Questions? Email hello@example.com today.</p>Spring & Summer Menu Fresh dishes from our kitchen, served daily. Book a table online. Tomato & basil soup "House" salad with chef's dressing Questions? Email hello@example.com today.
Why decode after stripping
If entities were decoded first, an escaped <b> in the text would become <b> and then be removed as if it were a tag. Stripping first, then decoding, keeps that text. The step decodes the common named entities (&, <, >, ", ', ) and every numeric entity such as –; rarer named ones like – are left as written.
Variations
- Add Straighten smart quotes after decoding if numeric entities produce curly quotes you do not want.
- Use Remove empty lines in Remove all mode for a compact list with no blank lines.
- Add Remove line breaks at the end to get the whole text on one line for a meta description draft.
Strip HTML to plain text: questions and answers
Are links kept?
The link text is kept and the URL is removed with the tag. Run the Extract links from HTML recipe on the same source if you need the URLs.
Is this a full HTML parser?
No. It uses pattern matching, which handles normal page and email markup well but can be fooled by unusual code such as > inside attribute values.
What about tables?
Each table row ends a line, but cells in the same row run together. Convert tables with a dedicated tool if layout matters.
More recipes like this
Writers and editors
- Trim every line
- Straighten smart quotes
- Find and replace
- Find and replace
- +1 more
- Straighten smart quotes
- Find and replace
- Collapse repeated spaces
- Trim every line
- +1 more
- Trim every line
- Remove empty lines
- Find and replace
- Add prefix / suffix
- Trim every line
- Remove empty lines
- Encode or decode
- Apply a line template
- +1 more
- Trim every line
- Remove empty lines
- Find and replace
- Number lines
Every step you can add (41)
Clean up
- Trim whitespace
- Trim every line
- Remove empty lines
- Collapse repeated spaces
- Remove line breaks
- Strip HTML tags
- Straighten smart quotes
- Remove accents
- Remove punctuation
- Remove emoji
- Remove non-ASCII characters
Change case
- Change case
- Make URL slugs
Lines
- Sort lines
- Remove duplicate lines
- Keep only duplicated lines
- Compare with another list
- Count repeated lines
- Reverse line order
- Shuffle lines
- Keep a range of lines
- Truncate long lines
- Wrap at a width
- Split into lines
- Join lines
Find and filter
- Find and replace
- Filter lines
- Remove words or characters
Extract
- Extract
Data and formats
- Format JSON
- Minify JSON
- CSV to JSON
- JSON to CSV
- Lines to JSON array
- JSON array to lines
Encode and decode
- Encode or decode
Build output
- Add prefix / suffix
- Quote each line
- Number lines
- Apply a line template
- Add timestamp
AltF Flow runs entirely in your browser. Your text is never sent to AltFTool; saved recipes stay in this browser and shared links carry the steps only.