Convert Markdown or HTML to Word (.docx) Online
Convert Markdown or HTML to an editable Word .docx with real styles, lists, tables, code, images, page size, margins, page numbers and a Decree 30 preset.
Result
Press “Run” to see the result.
Send markdown (GitHub-flavoured: headings, bold / italic / strikethrough, inline code, links, nested bullet and numbered lists, task lists, tables with alignment, block quotes, code blocks, horizontal rules, images) or html and get a .docx built with real Word styles (Heading 1-6, List Paragraph, Quote, Source Code), so the navigation pane, table of contents and style changes work as in a hand-made document. Numbered lists keep their start number; table header rows repeat on each page.
Presets: default (Calibri 11, 2.54 cm margins), report (Arial, justified) and nd30 for Vietnamese administrative documents under Decree 30/2020/NĐ-CP: A4, Times New Roman 14 pt (13 with font_size=13), margins top / bottom 20 mm, left 30 mm, right 15 mm, justified text, first line indented 1.27 cm, 6 pt between paragraphs, page numbers centred in the top margin and hidden on the first page. Override any of font, font_size, line_spacing, margins (mm, "top,right,bottom,left"), page (a4, a5, a3, letter, legal), orientation, page_numbers, header_text, footer_text, first_line_indent; toc=true adds a table of contents field that Word fills when the file is opened.
Images can be data URLs or public http(s) URLs (PNG, JPEG, GIF; up to 20 fetched, 5 MB each) and are scaled to the text width. The output is a .docx file, or JSON with base64 (format=json). Files are generated in memory and not stored.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/md-docx" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown":"# Báo cáo tuần\n\nNội dung **chính**.\n\n- Việc 1\n- Việc 2\n\n| Hạng mục | Tiến độ |\n|---|---:|\n| API | 90% |","preset":"nd30","format":"json"}'const res = await fetch('https://apibox.io.vn/v1/md-docx', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"markdown": "# Báo cáo tuần\n\nNội dung **chính**.\n\n- Việc 1\n- Việc 2\n\n| Hạng mục | Tiến độ |\n|---|---:|\n| API | 90% |",
"preset": "nd30",
"format": "json"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/md-docx",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"markdown": "# Báo cáo tuần\n\nNội dung **chính**.\n\n- Việc 1\n- Việc 2\n\n| Hạng mục | Tiến độ |\n|---|---:|\n| API | 90% |", "preset": "nd30", "format": "json"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/md-docx');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"markdown":"# Báo cáo tuần\\n\\nNội dung **chính**.\\n\\n- Việc 1\\n- Việc 2\\n\\n| Hạng mục | Tiến độ |\\n|---|---:|\\n| API | 90% |","preset":"nd30","format":"json"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Does it follow Decree 30/2020 completely?
preset=nd30 applies the page, font, spacing, indentation and page-number rules of Annex I. The national motto block, document number and signature layout are content you write; check the final document against the decree.
Can I convert Word back to Markdown?
Yes, with /v1/docx-convert.
Why is the table of contents empty at first?
A TOC is a Word field: Word asks to update fields when the file opens (or press F9). Other editors may show the placeholder text.