How to convert Markdown to sanitized HTML with an API

Updated 2026-11-10

Use when an agent must render Markdown as sanitized HTML for display.

From an MCP client, add https://tanod.dev/mcp and call markdown_to_html; its free daily calls are applied automatically, no key or signup.

POST Markdown to /v1/markdown. It returns the rendered HTML after an allow-list sanitizer has removed scripts, event handlers, iframes, forms and javascript: or data: links.

Request

markdown is up to 200,000 characters. flavor is gfm (default; adds tables, strikethrough, autolinks and task lists) or commonmark.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/markdown \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"markdown": "# Title\n\n- [x] done\n- [ ] todo\n\n| a | b |\n|---|---|\n| 1 | 2 |", "flavor": "gfm"}'

Response

Response (example from the API spec, trimmed)
{
  "flavor": "gfm",
  "html": "<h1>Title</h1>\n<ul class=\"contains-task-list\">\n<li class=\"task-l…",
  "html_chars": 414,
  "sanitized": true,
  "removed_by_sanitizer": false,
  "source": {
    "library": "markdown-it-py + nh3 (ammonia)",
    "license": "MIT"
  }
}

Limits and caveats

Every link in the output gets rel="nofollow noopener noreferrer". removed_by_sanitizer tells you whether anything was stripped. Inline raw HTML that is not on the allow-list is removed, so do not use this to pass through custom HTML.

HTML output over 4 MB is a 422 output_too_large. Parsing runs in an isolated, resource-limited process with no network access; input too complex for its limits is a 422 and not charged.

Still treat the HTML as untrusted if the Markdown came from a user: sanitizing reduces risk, and your page's own Content Security Policy should remain in place.

Doing this by hand? Use the free Markdown to HTML converter in your browser.

Price and free allowance

USD 0.001 per call, paid in USDC on Base, Polygon, Solana, BNB Chain or Arbitrum with x402. 10 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared with FX rates, QR codes, geocoding, public holidays and the other utility endpoints (phone, validation, text, hash, convert and similar). MCP tool: markdown_to_html at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Use it from Claude without writing code: in claude.ai or Claude Desktop, add https://tanod.dev/mcp/text?via=markdown-to-html-api as a custom connector (steps), then ask in plain words, for example "Render this Markdown as safe HTML." The free daily allowance is applied automatically over MCP. Beyond it a call needs an x402 payment, which these clients can make.

Related guides: How to convert HTML to Markdown or plain text with an API, How to compare two texts and get a diff with an API, How to convert between JSON, YAML, CSV, TOML and XML with an API. Back to tanod.dev or the guide index. Results are automated and heuristic.