HTML to plain text

Extract readable plain text from HTML: headings, paragraphs, list bullets and table rows, without scripts or menus.

Input

The HTML to convert.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/html-to-text \
  -H 'Content-Type: application/json' \
  -d '{"input":{"text":"<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href=\"/docs\">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>","links":true}}'
import json, urllib.request

body = {'input': {'text': '<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href="/docs">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>', 'links': True}}
request = urllib.request.Request("https://setget.net/v1/tools/html-to-text", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/html-to-text", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"text":"<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href=\"/docs\">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>","links":true}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "html-to-text",
  "input": {
    "text": "<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href=\"/docs\">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>",
    "links": true
  }
}
{
  "input": {
    "text": "<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href=\"/docs\">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>",
    "links": true
  }
}

Endpoint: POST /v1/tools/html-to-text. Over MCP: run_tool with slug: "html-to-text". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
text string yes The HTML to convert.
links boolean no Add each link address in brackets after its text. Default: false.

Examples

Input
{
  "text": "<html><head><title>Demo</title><style>p{color:red}</style></head><body><nav>Menu</nav><h1>Hello &amp; welcome</h1><p>Read the\n <a href=\"/docs\">docs</a>.</p><ul><li>One</li><li>Two</li></ul></body></html>",
  "links": true
}
Result
{
  "title": "Demo",
  "text": "Hello & welcome\n\nRead the docs (/docs).\n\n- One\n- Two"
}

Table rows become tab-separated lines

Input
{
  "text": "<table><tr><th>Name</th><th>Age</th></tr><tr><td>Sam</td><td>31</td></tr></table>"
}
Result
{
  "title": null,
  "text": "Name\tAge\nSam\t31"
}

Questions

What is left out?
Everything inside head, script, style, noscript, template, svg, canvas, iframe, object, nav and footer.
Does it fetch the page?
No. Paste the HTML itself. Nothing is downloaded.
How are images handled?
An image is replaced by its alt text, if it has one.