WebToolsPlanet
Developer Tools

Markdown to HTML Converter

Convert Markdown into clean HTML with live preview. Use this converter for README files, documentation, blog drafts, release notes, and CMS content that needs semantic HTML output.

Live previewGFM support4 output modesHeading IDs & TOC

Last updated: July 1, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution
Runs in your browserNo file upload to a serverSanitized by default

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What Makes This Markdown to HTML Converter Useful?

Plenty of tools convert Markdown to HTML — the difference here is what happens after the conversion. This tool adds GitHub-style heading IDs with automatic duplicate handling, a nested table of contents generator, four purpose-built output modes (Clean HTML, WordPress HTML, Full HTML Page, and Tailwind Typography), a sanitization toggle backed by an allowlist sanitizer, and a lightweight Markdown issue checker — all running client-side with live preview, so nothing you type ever leaves your browser.

Markdown to HTML Converter Features

Live Preview

See rendered HTML update as you type, with GFM tables, task lists, and images rendered inline.

Four Output Modes

Clean HTML, WordPress HTML, Full HTML Page, or Tailwind Typography — switch modes without re-parsing your Markdown.

Heading IDs

GitHub-style slug ids on every heading, with automatic -1/-2 suffixing for duplicates and an optional custom prefix.

Table of Contents

Generates a nested H2/H3 table of contents linked to your heading ids, copyable on its own.

HTML Sanitization

Strips script tags, event handlers, and other unsafe markup by default — toggle it off only for trusted content.

File Upload & Drag-and-Drop

Upload a .md file or drag one straight into the editor.

Markdown Issue Checker

Flags missing/duplicate H1s, empty links, missing image alt text, and raw or unsafe HTML in your source.

Client-Side Processing

Parsing, sanitizing, and rendering all happen in your browser. Your document is never uploaded.

Clean HTML vs WordPress HTML vs Full HTML Page vs Tailwind Typography

Clean HTML

Semantic markup only — no wrapper, no extra classes, no inline styles. The default mode, best for CMS and blog content.

WordPress HTML

The same semantic markup with presentational classes (like GFM's task-list classes) stripped, so it pastes cleanly into the WordPress block or classic editor.

Full HTML Page

Wraps the content in a complete <!DOCTYPE html> document with charset, viewport, and title tags — a self-contained file that opens correctly in any browser.

Tailwind Typography

Wraps the content in <article class="prose prose-slate max-w-none">, matching the @tailwindcss/typography plugin's expected markup.

How to Convert Markdown to HTML

1

Type or paste Markdown into the editor, or upload/drag-and-drop a .md file.

2

Toggle GFM, Sanitize HTML, Heading IDs, and Generate TOC in Options as needed.

3

Pick an output mode: Clean HTML, WordPress HTML, Full HTML Page, or Tailwind Typography.

4

Check the Preview, HTML, Full Page, and TOC tabs, and review any warnings on the Issues tab.

5

Copy the HTML (or the TOC) with one click, or download it as a file.

Markdown to HTML for WordPress

WordPress's editors don't need — and often mangle — extra class attributes on pasted-in HTML. Switch to the "WordPress HTML" output mode before copying: it keeps your headings, paragraphs, lists, blockquotes, and tables intact but strips the presentational classes GFM adds (like contains-task-list and language-* classes), so the paste-in stays clean in both the classic and block editors. Sanitization still applies if enabled, so any raw HTML in your source is stripped the same way as in Clean HTML mode.

How Heading IDs Work

Enabling "Heading IDs" assigns a GitHub-style slug id to every heading in the document — lowercase, spaces replaced with hyphens, punctuation stripped, exactly like the anchors GitHub generates for README headings. So `## Getting Started` becomes `<h2 id="getting-started">Getting Started</h2>`.

If the same heading text appears more than once — three "Installation" sub-sections, for example — later occurrences get a -1, -2 suffix (installation, installation-1, installation-2) so every id in the document stays unique and every anchor link keeps working. An optional custom prefix (e.g. doc-) is prepended to every generated id, which is useful when embedding the output alongside other content that might already use an id like "introduction".

How to Generate a Table of Contents from Markdown

Enable "Generate TOC" (this also turns on heading IDs automatically, since the TOC links to them) and open the TOC tab. The tool walks the document's H2 and H3 headings and builds a nested `<nav class="table-of-contents"><ul>…</ul></nav>` block — H3 headings nest inside a sub-`<ul>` under their parent H2, so the structure mirrors your document outline.

Use "Copy TOC HTML" in the toolbar to copy just the TOC markup, independent of whatever output mode or tab you're otherwise using — handy for pasting a TOC above a long article separately from the article body.

Why HTML Sanitization Matters

Markdown allows raw HTML blocks inline, so pasted-in content from an untrusted source can carry a <script> tag or an onerror/onclick handler straight through to your page. With "Sanitize HTML" enabled (the default), this tool strips script, style, iframe, object, and embed tags along with any on* event attribute before the HTML reaches the preview or the copyable output. Only disable sanitization for Markdown you or your team wrote yourselves — the Issues tab will still flag raw or unsafe HTML in your source either way, as a reminder of what sanitization would have removed.

GFM Support: Tables, Task Lists, and Strikethrough

Tables

| Column | Column | header row, then | --- | --- | as the separator, then data rows — renders to a standard <table>/<thead>/<tbody> structure.

Task Lists

- [x] done and - [ ] pending render as <input type="checkbox" checked disabled> / <input type="checkbox" disabled> list items.

Strikethrough

~~text~~ renders as <del>text</del>, useful for changelogs and crossed-out completed items.

Autolinks

Bare URLs like https://example.com become clickable <a> links automatically, without needing [text](url) syntax.

Common Use Cases

  • Converting a GitHub README.md to HTML for embedding in a documentation website or email newsletter
  • Converting Markdown blog posts to HTML for pasting into a CMS like WordPress, Ghost, or Webflow
  • Generating static HTML from Markdown documentation for a project site or help center
  • Previewing how Markdown will render on GitHub before pushing to the repository
  • Converting Markdown meeting notes or project specs to an emailable HTML document
  • Transforming Markdown content from a headless CMS into HTML for rendering in a React/Next.js app
  • Producing clean semantic HTML from AI-generated Markdown responses for use in web UIs
  • Converting Markdown API documentation (like Swagger descriptions) to HTML for developer portals
  • Adding heading IDs and a table of contents to long-form Markdown documentation before publishing

Example: Table and Task List

Converting a GFM document section with a table and task list to HTML:

Markdown input (GFM)
## Release Checklist

| Task | Owner | Status |
|------|-------|--------|
| Code review | @alice | ✅ |
| QA testing | @bob | 🔄 |

- [x] Write release notes
- [ ] Update changelog
- [ ] Tag release
Generated HTML output
<h2 id="release-checklist">Release Checklist</h2>

<table>
  <thead>
    <tr><th>Task</th><th>Owner</th><th>Status</th></tr>
  </thead>
  <tbody>
    <tr><td>Code review</td><td>@alice</td><td>✅</td></tr>
    <tr><td>QA testing</td><td>@bob</td><td>🔄</td></tr>
  </tbody>
</table>

<ul class="task-list">
  <li class="task-list-item">
    <input type="checkbox" checked disabled> Write release notes
  </li>
  <li class="task-list-item">
    <input type="checkbox" disabled> Update changelog
  </li>
  <li class="task-list-item">
    <input type="checkbox" disabled> Tag release
  </li>
</ul>

Example: Heading IDs and Table of Contents

Duplicate H2 headings get automatically suffixed, and the TOC generator nests them in document order:

Markdown input
# Guide

## Installation

## Installation

## Installation
Generated heading IDs
<h1 id="guide">Guide</h1>
<h2 id="installation">Installation</h2>
<h2 id="installation-1">Installation</h2>
<h2 id="installation-2">Installation</h2>

Client-Side Processing

All Markdown parsing, sanitizing, and HTML generation runs in your browser using the unified/remark/rehype pipeline. Your document content is never transmitted to our servers.

Adding CSS to the Generated HTML

Raw HTML from Markdown has no styling. For a clean document look, add a typography stylesheet: GitHub's Primer CSS for GitHub-style Markdown rendering (@primer/css), Pico CSS for minimal elegant typography, or Pandoc's default CSS — or use the built-in Tailwind Typography output mode if your site already uses @tailwindcss/typography.

Server-Side Markdown Parsing

For production apps, parse Markdown server-side (not client-side) for better performance and centralized sanitization control. Recommended: remark/rehype (the unified ecosystem this tool is built on), marked (Node.js, fast), or pandoc (CLI, supports 50+ formats). Next.js + MDX (Markdown + JSX) is the modern standard for documentation sites, allowing React components inside Markdown files.

How This Tool Works

Markdown is parsed with `remark-parse` into an AST, extended with `remark-gfm` for tables, task lists, strikethrough, and autolinks, then converted to an HTML AST via `remark-rehype`. `rehype-raw` resolves any raw HTML blocks back into the tree, `rehype-sanitize` strips unsafe tags and attributes against an allowlist schema (when sanitization is enabled), and — when heading IDs are enabled — a `github-slugger`-backed step assigns unique heading ids after sanitization, so generated ids are never rewritten by the sanitizer's anti-clobbering rules. The table of contents is built from those same heading ids without re-parsing the Markdown. `rehype-stringify` produces the final HTML string, and output-mode wrapping (WordPress class-stripping, Tailwind Typography, or the full HTML page template) runs as a separate, cheap string transform so switching modes never re-parses your document.

Technical Stack

unified / remark / rehyperemark-gfmrehype-sanitizegithub-sluggerClient-side only

Frequently Asked Questions

What is the difference between CommonMark and GitHub Flavored Markdown?
CommonMark (spec.commonmark.org) is the strict, standardized Markdown specification resolving the many ambiguities in Gruber's original 2004 definition. GitHub Flavored Markdown (GFM) is a superset of CommonMark that adds: tables (| col | col |), task list items (- [x] done), strikethrough (~~text~~), autolinks (bare URLs become clickable), and disallowed raw HTML tags (XSS-risky tags are stripped). This tool implements GFM, which is the most widely used flavor for developer content.
Is it safe to use the generated HTML directly in my website?
If the Markdown source is from trusted authors (yourself, your team), yes. If the Markdown contains user-provided input or untrusted content, you MUST sanitize the HTML output to prevent XSS attacks. Markdown allows raw HTML blocks — a malicious author could embed <script> tags or JavaScript event handlers. Enable the "Sanitize HTML" option in this tool to strip dangerous tags (script, iframe, on* attributes, style) using an allowlist-based sanitizer before using output in production. The Issues tab also flags raw or unsafe HTML in your source even if sanitization is off.
How do I add syntax highlighting to code blocks?
In Markdown, fenced code blocks specify a language: ```javascript. The HTML conversion wraps this as <code class="language-javascript">. To add actual syntax highlighting, apply a client-side library like highlight.js (hljs.highlightAll()) or Prism.js to your page, or use a server-side highlighter like shiki or Chroma. This tool preserves the code class attributes in the output for you to integrate with your preferred highlighting library.
Can I convert Markdown to a full standalone HTML document?
Yes. Select the "Full HTML Page" output mode to wrap the converted HTML in a complete document: <!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport"...><title>...</title></head><body>...</body></html>. This produces a self-contained .html file that renders correctly when opened directly in a browser — useful for sharing formatted documents without a web server.
How do heading IDs and duplicate headings work?
Enable "Heading IDs" to add a GitHub-style slug id to every heading, e.g. ## Installation becomes <h2 id="installation">. If the same heading text appears more than once, later ones get -1, -2 suffixes (installation, installation-1, installation-2) so every id stays unique — the same scheme GitHub uses for README anchors. An optional prefix can be prepended to every generated id.
How do I generate a table of contents from my Markdown?
Enable "Generate TOC" and switch to the TOC tab. The tool walks your document's H2 and H3 headings and builds a nested <nav class="table-of-contents"> block linking to each heading's id, so H3s nest under their parent H2. Use "Copy TOC HTML" to copy just the TOC markup separately from the main output.
Why does my Markdown table not convert correctly?
GFM tables require a header separator row with pipe and dash syntax: | column | column | on the first row, then | --- | --- | on the second row, then data rows. Common mistakes: (1) Missing the separator row — without it, the parser treats the pipes as literal text. (2) Misaligned pipes — each row must have the same number of pipe-separated cells. (3) No space around the pipe: |col| is not valid, | col | is. The Issues tab does not check table syntax directly, but a broken table renders as plain text in the Preview tab, which is a quick way to spot the problem.
What does the Issues tab check for?
The Issues tab scans your Markdown source (independently of your current output settings) for: a missing or duplicated H1, empty links, images with no alt text, raw HTML blocks, unsafe HTML (script tags or on* event attributes), and heading text that would generate a duplicate id. It reports on the Markdown itself, so warnings still show even if you have sanitization turned off.
What is the difference between Clean HTML, WordPress HTML, Full HTML Page, and Tailwind Typography mode?
Clean HTML is plain semantic markup with no wrapper — the default for CMS and blog use. WordPress HTML is the same markup with presentational classes (like GFM's task-list classes) stripped, so it pastes cleanly into the WordPress editor. Full HTML Page wraps the content in a complete <!DOCTYPE html> document ready to save and open in a browser. Tailwind Typography wraps the content in <article class="prose prose-slate max-w-none"> for sites using the @tailwindcss/typography plugin.
Does this tool support Markdown with LaTeX/math equations?
Standard GFM does not include math equation support. LaTeX-style formulas ($E = mc^2$) are not part of the GFM specification. GitHub itself added math support (via MathJax) only in 2022 as a non-standard extension. This tool converts standard GFM only. For Markdown with math, use a library like markdown-it with the markdown-it-mathjax plugin, or KaTeX with a Markdown pre-processor that identifies math delimiters.