{
  "id": 7787369,
  "title": "Stop Sending Raw HTML to LLMs",
  "url": "https://urgent.news/2026/09/16/stop-sending-raw-html-to-llms",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-16T12:31:42.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/decodo_official/stop-sending-raw-html-to-llms-2h0k"
  },
  "original_language": "en",
  "account": "Sending raw HTML strings to language models (LLMs) can be inefficient and costly. HTML includes markup, inline styles, scripts, and other elements, which contribute significantly to the number of tokens used. A comparison of 10 web pages revealed that HTML used 3 to 24 times more tokens than the same pages in Markdown format. For example, a product page arrived as 267,361 tokens, with only 3,393 being visible text. The guide explains where those tokens go, the cost involved, and how to avoid sending them.\n\nVisible text constitutes only 0.3% to 18.5% of the tokens when HTML is used, while the remaining 81.5% to 99.7% is made up of markup. This surplus of tokens translates to increased costs, latency, and potential issues with rate limits. The model's response time increases when processing raw HTML, up to 5.7 times longer than when processing Markdown. Additionally, some models impose limits on the token size, causing rejections for large HTML pages.\n\nDecodo's Web Scraping API can convert HTML to Markdown before sending it to an LLM, reducing the number of tokens significantly. For example, it returned 3,644 tokens for a Hacker News front page, compared to 11,817 tokens in raw HTML. The API keeps essential elements such as headings, lists, tables, and link URLs while removing unnecessary markup. Markdown conversion ensures that the model receives relevant information without the excess baggage of HTML.\n\nWhen you need specific data like product prices, ratings, or review counts, HTML provides all the information, but Markdown extracts only the necessary data. In cases where ratings, stock status, or publication dates are missing from the Markdown output, an HTML parser can be used to retrieve the required information. In all tested scenarios, the LLM correctly answered questions based on both the raw HTML and Markdown versions. However, sending raw HTML can lead to higher costs, slower response times, and potential rate-limit issues, highlighting the benefits of converting HTML to Markdown before processing with LLMs.",
  "summary": "A scraper gives you a page as one HTML string: markup, inline styles, scripts, and somewhere inside it the text you wanted. Many pipelines send that string directly to an LLM. That works, so the cost rarely gets measured. But on the 10 pages I measured, the HTML used 3 to 24 times more tokens than the same pages as Markdown. A product page arrived as 267,361 tokens, of which 3,393 were visible…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}