Convert Markdown to HTML: marked + DOMPurify
To convert Markdown to HTML online, paste the text into a browser tool that runs marked and then DOMPurify.sanitize. Docify updates a live preview as you type. Load sample preview is <h1>Welcome to Markdown</h1> plus <strong>bold text</strong>, <em>italic text</em>, a Features list, a language-javascript fence with function hello(), <a href="https://example.com">Docify</a>, and a blockquote. Copy HTML or Download HTML (converted.html) use that sanitized fragment. Download PDF is a separate path: it strips heading hashes, emphasis, and the example.com URL; list dashes, fences, and > stay. Nothing is uploaded.
README files and notes are easier to write in Markdown, but websites expect HTML. You do not need a server for a common subset: the browser can parse the text locally. The steps below use that path, then point at the live Markdown converter.
How to convert Markdown to HTML in three steps
Step 1: Paste the Markdown
Type or paste into the left-hand box. There is no .md file upload. Load sample fills the live converter with the string below. Headings, lists, links, emphasis, fenced code, and the blockquote all render through marked.
# Welcome to Markdown
This is a **bold text** and this is *italic text*.
## Features
- Easy to write
- Easy to read
- Converts to HTML
## Code Example
```javascript
function hello() {
console.log("Hello, World!");
}
```
### Links
Visit [Docify](https://example.com) for more tools.
> This is a blockquote.Step 2: Check the sanitized preview
Open the Docify Markdown converter. Each keystroke runs marked() then DOMPurify.sanitize(). The right-hand pane shows that HTML. The page does not upload the text.
Step 3: Copy or download the fragment
Copy HTML writes the sanitized string to the clipboard. Download HTML saves it as converted.html (text/html). That file is a fragment — no doctype, head, or preview CSS. Load sample Copy HTML is the sanitized leftover below. marked writes " inside the fence; the sanitized fragment uses ". Headings stay bare — marked v11 defaults do not add header ids.
<h1>Welcome to Markdown</h1>
<p>This is a <strong>bold text</strong> and this is <em>italic text</em>.</p>
<h2>Features</h2>
<ul>
<li>Easy to write</li>
<li>Easy to read</li>
<li>Converts to HTML</li>
</ul>
<h2>Code Example</h2>
<pre><code class="language-javascript">function hello() {
console.log("Hello, World!");
}
</code></pre>
<h3>Links</h3>
<p>Visit <a href="https://example.com">Docify</a> for more tools.</p>
<blockquote>
<p>This is a blockquote.</p>
</blockquote>What the converter actually emits
Parser
The page uses marked v11 with that library's default parser (GitHub-flavored Markdown options on). Exact edge cases follow marked, not a custom spec. The preview is not a syntax-highlighted editor.
Sanitizer
DOMPurify strips unsafe tags and attributes before preview, copy, or HTML download. Typical headings, lists, links, and images that marked emits are kept when they are safe. The tool does not fetch or host image files for you.
PDF is a separate path
Download PDF does not render this HTML. It walks Markdown lines, strips heading hashes, emphasis, and link URLs, then draws leftover text with jsPDF. Load sample PDF leftovers: Welcome to Markdown; This is a bold text and this is italic text.; the three - list lines stay; ```javascript and the hello() lines stay; Visit Docify for more tools. (https://example.com dropped); > This is a blockquote. stays. See the Markdown-to-PDF guide for the strip rules.
Common Markdown that marked maps to HTML
Headings
Markdown:
## H2
### H3
Typical HTML:
<h2>H2</h2>
<h3>H3</h3>
Emphasis
Markdown:
*italic*
Typical HTML:
<em>italic</em>
Links
Markdown:
Typical HTML:
Convert Markdown in the browser
marked then DOMPurify.sanitize. Copy or download the HTML fragment. Nothing is uploaded.
Use Markdown Converter →FAQ
- Does Docify upload the Markdown I paste?
- No. Preview, Copy HTML, Download HTML, and Download PDF run in your browser. The page does not send the text to a server.
- How does Docify turn Markdown into HTML?
- Each change passes the textarea string to marked (v11, gfm true), then sanitizes the result with DOMPurify. Copy HTML and Download HTML use that cleaned fragment. Load sample fills # Welcome to Markdown, a bold/italic paragraph, a Features list, a javascript fence, [Docify](https://example.com), and a blockquote. The pane then writes <h1>Welcome to Markdown</h1>, <strong>bold text</strong>, <em>italic text</em>, a three-item <ul>, <pre><code class="language-javascript"> with function hello(), <a href="https://example.com">Docify</a>, and a <blockquote>. marked writes " inside that fence; the sanitized Copy HTML fragment uses ". Headings stay bare — marked v11 defaults do not add header ids. Unsafe tags and attributes are stripped.
- Is the downloaded HTML a full page with CSS?
- No. Download HTML saves a text/html blob named converted.html that contains only the sanitized fragment. There is no doctype, head, or the site’s preview CSS. Paste it into your own document if you need a complete page.
- Can I upload a .md file?
- Not on this page. Type or paste into the left-hand textarea. There is no file picker for Markdown.