Markdown to HTML Converter
Convert online Markdown to sanitized HTML, preview structure, count blocks, add heading IDs, secure links, and review warnings before publishing.Markdown to HTML Converter
- {{ warning }}
{{ outputHtml }}
| Check | Value | Detail | Copy |
|---|---|---|---|
| {{ row.check }} | {{ row.value }} | {{ row.detail }} |
{{ resultJson }}
Markdown keeps structured writing readable as plain text, while HTML gives browsers and publishing systems explicit elements. Conversion decides how headings, lists, tables, code blocks, links, raw tags, and line breaks become markup.
Markdown is not one universal behavior. CommonMark core is stricter, while GitHub-flavored Markdown adds tables, task lists, strikethrough, and related extensions. Raw HTML handling also changes the risk and final output.
A preview catches structure problems before markup is pasted elsewhere. It can show missing table cells, unexpected heading levels, unsafe raw HTML, duplicate anchor IDs, or external links that need safer attributes.
Technical Details:
The conversion path normalizes the source text, applies the selected raw HTML policy, parses Markdown, post-processes headings and links, formats the HTML, and builds a preview that remains sanitized. When the full parser is unavailable, a limited fallback parser handles common blocks and inline marks.
The HTML policy is the most important safety choice. Sanitizing keeps allowed markup while removing unsafe parts. Escaping turns raw tags into visible text. Stripping removes raw tags before parsing. Keeping trusted raw HTML preserves raw tags in the generated output, while the rendered preview is still sanitized.
| Setting | Available choices | Effect |
|---|---|---|
| Markdown flavor | GitHub-flavored Markdown, CommonMark core. | Controls tables, task lists, strikethrough, and stricter core parsing. |
| HTML safety | Sanitize, escape, strip, or keep trusted raw HTML. | Controls how raw tags in the source affect generated output. |
| Output scope | HTML fragment or full HTML document. | Adds document wrappers only when a standalone file is needed. |
| Output format | Pretty or compact. | Changes whitespace and readability, not the parsed content. |
| Heading IDs | On or off. | Adds slugged, de-duplicated IDs to headings. |
| Secure external links | On or off. | Adds target and rel attributes to external HTTP and HTTPS links. |
Conversion Ledger counts source lines, words, bytes, headings, paragraphs, lists, tables, task items, code blocks, links, images, heading anchors, and warnings. It is the best place to verify whether the output matches the source structure.
Everyday Use & Decision Guide:
Start with GitHub-flavored Markdown when the source uses tables, task lists, or strikethrough. Use CommonMark core when the destination follows stricter Markdown rules and you want fewer extension assumptions.
Keep Sanitize generated HTML as the default for untrusted or mixed-source content. Choose Keep trusted raw HTML only when you control the source and the destination expects those tags.
- Use HTML fragment for CMS fields, component snippets, and documentation blocks.
- Use Full HTML document when you need a complete standalone file.
- Turn on Add heading IDs for table-of-contents handoffs and anchor links.
- Leave Secure external links on for public content with outbound links.
- Check Warnings when raw HTML, parser fallback, or sanitizer fallback appears.
Generated HTML can be valid and still render differently in another platform if that platform uses a different Markdown flavor, strips attributes, or applies its own sanitizer.
Step-by-Step Guide:
Convert a Markdown source, then compare the preview and ledger before copying.
- Paste into Markdown source, or load one
.md,.markdown, or.txtfile under 2 MB. The summary should show HTML characters, source lines, links, and code blocks. - Choose Markdown flavor. Select GitHub-flavored mode for tables and task lists, or CommonMark core for stricter parsing.
- Set HTML safety. If raw HTML appears and you do not trust it, keep sanitize, escape it as text, or strip the tags.
- Open Advanced and choose Output scope, Output format, Add heading IDs, Secure external links, and Soft line breaks.
- Review HTML Preview for the rendered structure, then check Generated HTML for the markup to paste or save.
- Open Conversion Ledger. If the warnings row shows notes, resolve the parser, sanitizer, raw HTML, or empty-source issue before publishing.
If the file loader rejects the source, use a Markdown or text file under 2 MB or paste the content directly.
Interpreting Results:
Generated HTML is the exportable markup. HTML Preview is the rendered safety check. Conversion Ledger explains what the converter detected and whether warnings are active.
A warning does not always mean the conversion failed. For example, Trusted raw HTML is preserved in the output means the code artifact keeps raw tags, while the preview still runs through sanitization. Treat that as a review gate before pasting into a public CMS.
Do not assume external publishing systems will preserve every attribute. Test a small sample in the destination when heading IDs, task-list checkboxes, table markup, or external-link attributes matter.
Worked Examples:
A release note with # Version 2.1, a task list, a table, and a fenced code block should be checked in GitHub-flavored mode. Conversion Ledger should count one heading, table rows, task-list items, and one code block before the HTML is copied.
A CMS snippet with raw <aside> markup should stay on Sanitize generated HTML unless the source is trusted and the CMS expects that tag. If Keep trusted raw HTML is selected, the warning row should be kept with the review notes.
A source with repeated headings such as ## Pricing and ## Pricing can use Add heading IDs. The generated IDs are slugged and de-duplicated, so repeated headings receive distinct anchors.
FAQ:
Why does another site render the same Markdown differently?
Markdown flavors differ. GitHub-flavored mode supports tables, task lists, and strikethrough when the parser supports them, while CommonMark core is stricter.
Should I allow raw HTML?
Use Sanitize generated HTML, Escape raw HTML as text, or Strip raw HTML tags unless the source is trusted and the destination requires raw tags.
Why does the preview differ from the generated HTML?
The preview is always sanitized for rendering. In trusted raw HTML mode, Generated HTML can preserve raw tags while HTML Preview displays a safer rendered version.
What file types can I load?
The file loader accepts one .md, .markdown, or .txt file under 2 MB. Other files should be opened elsewhere and pasted as source text.
Glossary:
- Markdown flavor
- The rule set used to parse Markdown syntax and extensions.
- HTML fragment
- Reusable markup without a doctype, html, head, or body wrapper.
- Sanitize
- Remove unsafe or unwanted HTML while preserving allowed markup.
- Heading ID
- A slugged anchor attribute added to a heading for linking.
- Conversion Ledger
- The result table that counts detected structure and warnings.
References:
- GitHub Flavored Markdown Spec, GitHub, version 0.29-gfm, April 6, 2019.
- Cross Site Scripting Prevention Cheat Sheet, OWASP Cheat Sheet Series.
- Using the HTML Sanitizer API, MDN Web Docs, March 13, 2026.