Markdown to HTML
Render Markdown text as HTML.
POST
1 credit
/v1/convert/markdown-to-html
curl -X POST "https://convert.toolkitapi.io/v1/convert/markdown-to-html" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"markdown": "# Hello\n\nWorld!", "gfm": true, "sanitize": true}'
import httpx
resp = httpx.post(
"https://convert.toolkitapi.io/v1/convert/markdown-to-html",
json={"markdown": "# Hello\n\nWorld!", "gfm": true, "sanitize": true},
)
print(resp.json())
const resp = await fetch("https://convert.toolkitapi.io/v1/convert/markdown-to-html", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"markdown": "# Hello\n\nWorld!", "gfm": true, "sanitize": true}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
{
"html": "<h1>Hello</h1>\n<p>World!</p>",
"metadata": {"word_count": 2, "toc": [{"level": 1, "text": "Hello"}]}
}
Description
Render Markdown text as HTML.
How to Use
1
1. POST a JSON body with `markdown` (or `url`).
2
2. Optionally set `gfm` and `sanitize`.
3
3. Read the `html` string and `metadata` from the response.
About This Tool
Renders Markdown source as HTML. Supports CommonMark by default, with optional GitHub Flavored Markdown (tables, task lists, strikethrough, autolinks) via `gfm=true`. HTML sanitization is applied by default to strip scripts and unsafe handlers.
The response includes the rendered HTML plus metadata: word count and a generated table of contents.
Why Use This Tool
- CMS rendering — Render user-supplied Markdown in comments, posts, and docs
- Static site builds — Convert Markdown pages to HTML during deploys
- Newsletters — Render Markdown drafts to HTML for email composition
- Documentation — Produce HTML docs from Markdown source
Frequently Asked Questions
Is the HTML safe to render?
When `sanitize=true` (default), scripts, iframes, and unsafe attributes are stripped.
Are code blocks syntax-highlighted?
No — this endpoint produces semantic `<pre><code>` only. Apply client-side highlighting (Prism, highlight.js) if needed.
What Markdown extensions are enabled?
CommonMark by default. `gfm=true` adds tables, task lists, strikethrough, and autolinks.
Start using Markdown to HTML now
Get your free API key and make your first request in under a minute.