HTML to Markdown Converter – Clean HTML & Datasets for LLMs avatar

HTML to Markdown Converter – Clean HTML & Datasets for LLMs

Pricing

from $0.30 / 1,000 page converteds

Go to Apify Store
HTML to Markdown Converter – Clean HTML & Datasets for LLMs

HTML to Markdown Converter – Clean HTML & Datasets for LLMs

Convert HTML you already have to clean Markdown: pasted HTML, JSON documents, the html field of any scraper dataset, or HTML file URLs. Removes nav, footers and cookie banners, keeps tables and code, makes links absolute. Optional RAG chunks. No page fetching. $0.30 per 1,000 documents.

Pricing

from $0.30 / 1,000 page converteds

Rating

0.0

(0)

Developer

Cemal Atakli

Cemal Atakli

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

9 days ago

Last modified

Categories

Features

Limited permissions

Share

Convert HTML you already have to clean Markdown: pasted HTML, a JSON list of documents, the html field of any scraper dataset, or HTML files at a URL. The Actor removes navigation, headers, footers, sidebars and cookie banners. It keeps headings, lists, GFM tables and fenced code blocks, and makes relative links absolute. Optional RAG chunks with token counts.

It does not crawl or fetch web pages. That is the difference from our other Markdown listings (see below). Cost: $0.30 per 1,000 HTML documents.

What this listing does that our others do not

You have…Use
HTML already (a string, a scraper dataset, an exported .html file)This Actor – converts only, never visits the site
A list of URLs or a whole site to crawlFast Website Content Crawler (website-to-markdown)
One URL for an AI agent, as Markdown, text or HTMLWeb Fetch
DOCX, PPTX, XLSX or PDF filesDocument to Markdown
News or blog URLs, as structured article JSONArticle Extractor
A dataset to merge, dedupe or filter (not convert)Merge, Dedup & Transform Datasets

What it does

  • Four input sources (use one or several in the same run):
    • html: one HTML document or fragment, pasted.
    • htmlDocuments: a JSON array of HTML strings or {id, html, url} objects.
    • datasetId: any Apify dataset. Pick the HTML field (dot paths such as response.body work), the URL field, and fields to copy to the output.
    • fileUrls: direct links to HTML files (S3, GitHub raw, an Apify key-value store record). Max 10 MB per file. Private and internal network addresses are refused.
  • Boilerplate removal (on by default): scripts, styles, forms, nav, header, footer, aside, cookie/consent banners, share bars, "related posts". The main block is found from <main>, <article> and common content containers, with a text-density fallback. Turn it off to convert the whole body.
  • Good Markdown: headings, nested lists, GFM tables, fenced code with the language, blockquotes, bold/italic, links. Images optional.
  • Absolute links from the item's own URL, a <base href>, or the baseUrl you give.
  • Metadata: title, meta description, language, canonical URL, word count, estimated tokens, SHA-256 of the Markdown.
  • RAG chunks (optional): chunks[] with {index, headingPath, text, tokens}, split on headings and paragraphs.
  • Fair charging: empty HTML, JavaScript app shells with no text, missing fields and failed downloads are listed in the output but not charged.

Use cases

  • You scraped pages with a browser-based scraper and stored the rendered html: turn the whole dataset into Markdown for an LLM or vector database.
  • Clean up HTML e-mails, CMS exports, help-centre dumps or saved .html files.
  • An AI agent already holds HTML and needs compact Markdown (fewer tokens than raw HTML).
  • Run it after a scraper with an integration: datasetId = {{resource.defaultDatasetId}}.

Input example

{
"datasetId": "abc123XYZ",
"htmlField": "html",
"urlField": "url",
"keepFields": ["title"],
"mainContentOnly": true,
"chunkSize": 800
}

With no input at all, the Actor converts a small built-in sample document so you can see the output format.

Output example

{
"source": "input.html",
"url": "https://example.com/blog/",
"status": "converted",
"title": "Release notes 2.4 | Example Blog",
"description": "What changed in version 2.4: faster exports, a new CLI flag and two fixes.",
"lang": "en",
"markdown": "# Release notes 2.4\n\nVersion 2.4 makes **exports about 3x faster** and adds a `--dry-run` flag. Read the [export guide](https://example.com/docs/export) …\n\n| Rows | 2.3 | 2.4 |\n|---|---|---|\n| 10,000 | 4.1 s | 1.3 s |\n…",
"wordCount": 85,
"tokenCount": 140,
"htmlChars": 1568,
"markdownChars": 560,
"error": null
}

status is converted (charged), empty, jsShell or error (not charged). A run summary is saved as OUTPUT in the key-value store.

Pricing

Pay per event, you pay only for documents that were converted:

EventPrice
HTML document converted (page-converted)$0.0003 ($0.30 per 1,000)
Actor start$0.00005
ActorConverts supplied HTMLPrice per document
This Actoryes (string, JSON, dataset, file URL)$0.0003
web.harvester/html-to-markdownyes$0.002
Our website-to-markdownno, fetches URLs$0.0004 per page

Your maximum charge per run is respected: the Actor stops cleanly when it is reached and says so in the status message and OUTPUT.

Limits (honest)

  • No JavaScript is run. If your HTML is an empty app shell (<div id="root">), save the HTML after rendering and convert that. Such documents are marked jsShell and free.
  • Boilerplate removal is heuristic. On unusual layouts, turn off mainContentOnly or add removeSelectors.
  • Token counts are an estimate (4 characters ≈ 1 token).
  • Documents over 10 million characters (or files over 10 MB) are cut, and the row says so.
  • File URLs must be public http(s) links; private, loopback and cloud-metadata addresses are refused.

FAQ

Does it visit the URLs in my dataset? No. The url field is only used to make relative links absolute. Only fileUrls are downloaded, once each.

Can I keep my scraper's other fields? Yes, list them in keepFields; they appear under sourceFields.

My HTML sits in a nested field. Use a dot path, e.g. response.body or data.0.html.

Use with AI agents / Apify MCP

Add this Actor to the Apify MCP server (gazidev/html-to-markdown-converter). An agent can send htmlDocuments: [{"html": "...", "url": "https://..."}] and read markdown from the dataset. It is a cheap way to shrink HTML before it goes into a context window.