HTML to Plain Text Converter
Strip tags from HTML or a web page URL and get readable plain text with line breaks preserved, plus word and character counts.
Result
Press “Run” to see the result.
Send HTML in the html field (JSON, form or query string), as a raw text/html body, or give a public url to fetch. The API removes script, style, noscript, template and head content, turns <br> and block elements (paragraphs, headings, list items, table rows, divs...) into line breaks, collapses repeated spaces and returns the text with its characters and words counts.
Unlike HTML to Markdown, no formatting is kept: the result is plain text suitable for search indexing, previews, SMS or text-only emails.
Limits: HTML up to 5 MB (request body up to 6 MB); URLs are fetched up to 5 MB with a 10 second timeout and at most 8 redirects. Only public http/https hosts are allowed.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/html-to-text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html":"<h1>Order confirmed</h1><p>Thanks for your order, <b>Alice</b>.<br>It ships tomorrow.</p><ul><li>1 x Keyboard</li><li>2 x Mouse</li></ul><style>p{color:red}</style>"}'const res = await fetch('https://apibox.io.vn/v1/html-to-text', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"html": "<h1>Order confirmed</h1><p>Thanks for your order, <b>Alice</b>.<br>It ships tomorrow.</p><ul><li>1 x Keyboard</li><li>2 x Mouse</li></ul><style>p{color:red}</style>"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/html-to-text",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"html": "<h1>Order confirmed</h1><p>Thanks for your order, <b>Alice</b>.<br>It ships tomorrow.</p><ul><li>1 x Keyboard</li><li>2 x Mouse</li></ul><style>p{color:red}</style>"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/html-to-text');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"html":"<h1>Order confirmed</h1><p>Thanks for your order, <b>Alice</b>.<br>It ships tomorrow.</p><ul><li>1 x Keyboard</li><li>2 x Mouse</li></ul><style>p{color:red}</style>"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Are line breaks preserved?
Yes. <br> and block elements such as p, div, li, headings and table rows produce new lines; three or more blank lines are collapsed.
Is JavaScript and CSS content removed?
Yes. script, style, noscript, template and head elements are removed before the text is extracted.
Can I extract text directly from a URL?
Yes. Send url instead of html; the page is fetched (up to 5 MB) and converted.