Markdown to HTML Converter

Convert Markdown to HTML with live preview, or export to HTML/PDF files.

Docify's Markdown converter transforms Markdown text into HTML using marked.js (v11, GFM enabled) with DOMPurify sanitization. The preview updates in real-time as you type. Supported syntax includes headings, bold/italic, lists, code blocks with language hints, GFM tables with alignment, task lists, strikethrough, links, and blockquotes. Export options: Copy HTML, Download HTML (sanitized fragment), or Download PDF (plain text, no HTML rendering). Nothing is uploaded.

Markdown
Preview

How it works

  1. Real-time preview: Type or paste Markdown on the left and see the HTML preview update instantly. No separate Convert button needed.
  2. Parsing: Uses marked() with GitHub Flavored Markdown enabled. Supports tables, task lists, strikethrough, and fenced code blocks with language hints.
  3. Sanitization: Output is cleaned with DOMPurify.sanitize() to remove potentially unsafe HTML while preserving formatting.
  4. PDF export: Downloads plain text stripped of Markdown syntax using jsPDF. This is not a full HTML-to-PDF renderer — tables and formatted elements appear as raw text.

Supported syntax

MarkdownResult
# Heading 1<h1>
**bold**<strong>
*italic*<em>
[text](url)<a href="url">
- item<ul><li>
~~strikethrough~~<del>
| A | B |<table> (GFM)

Markdown to HTML in Node

The live preview on this page is marked v11, then isomorphic-dompurify. Node can run that same pair. There is no POSIX Markdown-to-HTML converter, and CPython has no stdlib Markdown parser. The PyPI markdown package is a different parser — not this page. HTML back to Markdown is the markdownify block below, not this path. Download PDF is jsPDF plain text, not this HTML.

Node.js with marked 11 and isomorphic-dompurify

This page calls marked(markdown). In marked v11 that is the same function as marked.parse. Defaults are gfm: true, breaks: false, pedantic: false. Headings have no id — headerIds was removed in marked v8. null or undefined throws; an empty string writes an empty string. Then sanitize, the same as this page's preview and Download HTML fragment:

import { marked } from 'marked';
import DOMPurify from 'isomorphic-dompurify';

const markdown = '**bold** and *italic*';
const raw = marked(markdown);
const html = DOMPurify.sanitize(raw);
// <p><strong>bold</strong> and <em>italic</em></p>

What marked leaves in, and what sanitize removes

marked does not sanitize. A literal <script> or a javascript: href is still in the raw HTML. This page's preview runs DOMPurify.sanitize so those tags and hrefs do not survive. In fenced code, marked writes &quot;; the sanitizer writes a quote character. GFM tables, task-list checkboxes, and ~~strike~~ as <del> pass through both steps. Pass { gfm: false } and ~~gone~~ stays literal tildes:

marked('Hello <script>alert(1)</script>')
// <p>Hello <script>alert(1)</script></p>

DOMPurify.sanitize(marked('Hello <script>alert(1)</script>'))
// <p>Hello </p>

marked('[x](javascript:alert(1))')
// <p><a href="javascript:alert(1)">x</a></p>

DOMPurify.sanitize(marked('[x](javascript:alert(1))'))
// <p><a>x</a></p>

marked('~~gone~~')
// <p><del>gone</del></p>

marked.parse('~~gone~~', { gfm: false })
// <p>~~gone~~</p>

marked('| A | B |\n| --- | --- |\n| 1 | 2 |')
// <table> with <th>A</th><th>B</th> and <td>1</td><td>2</td>

marked CLI

The marked package ships a CLI. It writes the unsanitized marked() HTML and adds a second trailing newline. It is not this page's sanitizer, and it is not POSIX:

printf '%s' '**bold**' | npx marked
# <p><strong>bold</strong></p>
#
# (blank line from the extra CLI newline)

printf '%s' 'Hello <script>alert(1)</script>' | npx marked
# <p>Hello <script>alert(1)</script></p>

Single newlines inside a paragraph stay newlines here and in marked (breaks: false). marked.parse('a\nb', { breaks: true }) inserts <br>. That is GitHub comment behavior, not this preview. For named HTML entities after you already have a string, see the HTML encoder. The Markdown-to-HTML walkthrough is Convert Markdown to HTML: marked + DOMPurify.

markdownify: HTML to Markdown

The Python markdownify library converts HTML back to Markdown—the reverse of what this tool does. It parses HTML tags and outputs equivalent Markdown syntax (e.g., <strong> becomes **bold**).

This tool converts Markdown to HTML using marked.js, not the other way around. If you have HTML and need Markdown, use markdownify in Python:

from markdownify import markdownify as md

html = '<h1>Hello</h1><p>This is <strong>bold</strong>.</p>'
markdown = md(html, heading_style="ATX")
# '# Hello\n\nThis is **bold**.\n\n' (approx.)

FAQ

Does this tool upload my Markdown?
No. All conversion happens in your browser using marked.js for parsing and DOMPurify for sanitization. Nothing is sent to a server.
What Markdown syntax is supported?
This tool uses marked v11 with GitHub Flavored Markdown (GFM) enabled. It supports headings, bold/italic, lists, code blocks, tables, task lists, strikethrough, links, images, and blockquotes.
Is the HTML output safe to use?
Yes. The HTML is sanitized with DOMPurify before display and download. This removes potentially dangerous scripts while preserving safe formatting.
How does the PDF export work?
The PDF export strips Markdown formatting (headings, bold, italic, link URLs) and renders plain text using jsPDF. It does not render the HTML preview — tables and code blocks appear as raw text.
Does the preview update as I type?
Yes. The HTML preview updates in real-time as you edit. There is no separate Convert button — the preview is always synchronized with your input.
Can I use GFM tables?
Yes. GitHub Flavored Markdown tables are supported. Use | for columns, --- for the header separator, and :--- / :---: / ---: for left/center/right alignment.

Related