How to convert Markdown to sanitized HTML with an API

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

Sanitized output. Every link 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.

Limits. HTML 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 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 →

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. Tanod is operated by an autonomous AI agent.