
HTML to Markdown Converter API
Content
Free HTML to Markdown converter with full formatting control. Transform web content for blogs, documentation, and more.
Authentication
All API requests require a valid API key passed in the Authorization header as a Bearer token.
Rate Limit
120 requests per minute
Endpoints
1 endpoint available
Overview
Convert HTML to Markdown with Turndown, the same converter the web page uses. Send an HTML string and optional formatting options, and get the Markdown back.
Options
Every key in options is optional. The defaults match the web page.
headingStyle: "setext" (default, underlined headings, only for levels 1 and 2) or "atx" (# headings)hr: how a horizontal rule is written, up to 20 characters. Default "* * *".bulletListMarker: "*" (default), "-" or "+"codeBlockStyle: "indented" (default) or "fenced"fence: "```" (default) or "~~~". Used when codeBlockStyle is "fenced".emDelimiter: "_" (default) or "*"strongDelimiter: "**" (default) or "__"linkStyle: "inlined" (default) or "referenced"linkReferenceStyle: "full" (default), "collapsed" or "shortcut". Used when linkStyle is "referenced".preformattedCode: true to treat whitespace inside code as preformatted. Default false.
Notes
htmlis limited to 500,000 characters.- The HTML is parsed as text and never rendered or run. Tags Markdown has no equivalent for are dropped but their text is kept, so the text inside script and style blocks may show up in the output. Strip those blocks first if you do not want that.
- Relative links and image paths are kept as they are.
Endpoints
POST
https://opentools.ca/api/v1/tools/html-to-markdownConvert HTML to Markdown
Request Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| html | string | Required | The HTML to convert, 1-500,000 characters |
| options | object | Optional | Conversion options. All keys are optional. |
| options.headingStyle | string Enum: setext, atx | Optional | Heading styleDefault: setext |
| options.hr | string | Optional | Horizontal rule textDefault: * * * |
| options.bulletListMarker | string Enum: -, +, * | Optional | Bullet list markerDefault: * |
| options.codeBlockStyle | string Enum: indented, fenced | Optional | Code block styleDefault: indented |
| options.fence | string Enum: ```, ~~~ | Optional | Fence for fenced code blocksDefault: ``` |
| options.emDelimiter | string Enum: _, * | Optional | Emphasis delimiterDefault: _ |
| options.strongDelimiter | string Enum: **, __ | Optional | Strong delimiterDefault: ** |
| options.linkStyle | string Enum: inlined, referenced | Optional | Link styleDefault: inlined |
| options.linkReferenceStyle | string Enum: full, collapsed, shortcut | Optional | Reference link style, used when linkStyle is "referenced"Default: full |
| options.preformattedCode | boolean | Optional | Treat code whitespace as preformattedDefault: false |
Response Example
{
"success": true,
"markdown": "Title\n=====\n\nHello **bold** and [a link](https://opentools.ca)",
"length": 62
}Error Codes
400
Bad Request - Missing or oversized html, invalid options, or HTML that could not be converted401
Unauthorized - Invalid or missing API key403
Forbidden - API key is inactive or expired, or the request IP is not allowed429
Too Many Requests - Rate limit exceeded500
Internal Server ErrorCode Examples
curl -X POST https://opentools.ca/api/v1/tools/html-to-markdown \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"html": "<h1>Title</h1><p>Hello <strong>bold</strong> and <a href=\"https://opentools.ca\">a link</a></p>",
"options": { "headingStyle": "atx" }
}'Rather use it in your browser? Open the HTML to Markdown Converter