HTML to Text
POST
/v1/convert/html-to-text
curl -X POST "https://convert.toolkitapi.io/v1/convert/html-to-text" \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Hello</h1><p>This is <strong>bold</strong> text.</p>"}'
# See curl example
// See curl example
Response
200 OK
{
"text": "Hello\n\nThis is bold text.",
"size": 27,
"word_count": 5
}
How to Use
1
Send a POST request to /v1/convert/html-to-text with an html string.
About This Tool
Strip all HTML tags and return plain text content. Preserves paragraph spacing, list formatting, and basic structure through whitespace.
Entities (e.g., &, <, ’) are decoded to their character equivalents. Script and style content is removed entirely.
Why Use This Tool
- Search Indexing — Extract plain text from HTML pages for full-text search indexing.
- Text Analysis — Strip HTML for NLP processing, word counting, or readability analysis.
- Email Preview — Generate plain text versions of HTML emails for preview and fallback display.
Frequently Asked Questions
Are script and style tags removed?
Yes — content inside <script> and <style> tags is completely removed, not just the tags.
How is whitespace handled?
Block elements (p, div, h1-h6, li) produce line breaks. Inline whitespace is normalised to single spaces.
Start using HTML to Text now
Get your free API key and make your first request in under a minute.