Markdown to HTML Converter

Convert Markdown to HTML code. See the rendered preview and copy the output.

Preview

Sample Markdown

This is a bold and italic text example.

Features
  • Converts Markdown to HTML
  • Live preview
  • Copy or download output
console.log("Hello, World!");

This is a blockquote.

Column 1 Column 2
Cell 1 Cell 2

How to Use This Tool

  1. Paste your MarkdownType or paste Markdown into the input pane, or click Try a sample to load an example document.
  2. Read the generated HTMLThe HTML output pane updates as you type, with headings, code blocks, tables, and callouts already converted.
  3. Check the rendered previewScroll to the preview below the panes to confirm the HTML renders the way you expect before you ship it.
  4. Copy or downloadUse Copy HTML to put the markup on your clipboard, or Download to save it as an .html file.

What HTML each Markdown element produces

Converters disagree about the details, so here is exactly what this one emits. Every row is the real output — no inline styles, no wrapper divs you did not ask for.

ElementMarkdownHTML output
Heading## Getting Started<h2 id="getting-started">Getting Started</h2>
Bold**bold**<strong>bold</strong>
Italic*italic*<em>italic</em>
Strikethrough~~gone~~<del>gone</del>
Inline code`value`<code>value</code>
Fenced code```js<pre><code class="hljs language-js">
Link[docs](https://example.com)<a href="https://example.com">docs</a>
Image![alt](a.png)<img src="a.png" alt="alt">
Task list- [x] Done<li><input checked disabled type="checkbox">Done</li>
Table| A | B |<table><thead><tr><th>A</th>…
Blockquote> quoted<blockquote><p>quoted</p></blockquote>
Callout> [!NOTE]<div class="markdown-callout markdown-callout-note">
Mermaid```mermaid<div class="mermaid">
Horizontal rule---<hr>

Four things that surprise people

Single newlines become <br> tags

This converter treats a single newline inside a paragraph as a line break, the way GitHub comments, Discord, and most note apps do. Strict CommonMark ignores it and needs two trailing spaces or a blank line. If your output has more line breaks than a reference implementation gave you, this is why.

Headings arrive with anchor ids already attached

## Getting Started becomes <h2 id="getting-started">. Duplicate heading text is de-duplicated with a numeric suffix, so two “Notes” headings become notes and notes-1 instead of colliding. In-page links and a generated table of contents both work without you editing the HTML.

The output is sanitized, so pasted HTML may not survive

Markdown allows raw HTML, but the result here is run through DOMPurify. Script tags, onclick-style handlers, and javascript: URLs are removed. That is what makes the output safe to publish when the Markdown came from somewhere you do not control — but it also means a deliberate embed can be stripped.

Syntax highlighting ships as classes, not colours

Fenced code blocks come out as <pre><code class="hljs language-js"> with highlight.js span classes already applied. Add any highlight.js theme stylesheet to your site and the colour appears; without one the code still renders correctly in a single colour.

Frequently Asked Questions

What Markdown features are supported?

GitHub Flavored Markdown: headings, bold, italic, strikethrough, links, images, ordered and unordered lists, task lists, tables, blockquotes, fenced code blocks, and horizontal rules. On top of GFM it also converts footnotes, GitHub-style callouts ([!NOTE], [!TIP], [!IMPORTANT], [!WARNING], [!CAUTION]), KaTeX math, and Mermaid diagram blocks.

Why did my single line breaks turn into <br> tags?

This converter runs with the "breaks" option on, so a single newline inside a paragraph becomes a <br> tag. That matches how Markdown behaves in GitHub comments, Discord, and most note apps. Strict CommonMark instead requires two trailing spaces or a blank line, so if you are comparing output against a CommonMark reference implementation, this is the difference you are seeing.

Do the headings get id attributes for anchor links?

Yes. Every heading is emitted with a slugified id — "## Getting Started" becomes <h2 id="getting-started">. Repeated heading text is de-duplicated with a numeric suffix so two "Notes" headings become "notes" and "notes-1", which keeps in-page anchor links unambiguous.

Is the HTML output safe to publish?

The generated HTML is sanitized with DOMPurify before it is shown, so script tags, event-handler attributes like onclick, and javascript: URLs are stripped out. That makes the output safe to inject into a page even when the Markdown came from an untrusted source. Sanitizing again on your own server is still good practice for defence in depth.

Why do my code blocks look unstyled when I paste the HTML into my site?

Code blocks are emitted as <pre><code class="hljs language-js"> with highlight.js span classes already applied, but the classes need a matching stylesheet to show colour. Add any highlight.js theme CSS to your page and the highlighting appears. Without it the code still renders correctly, just in a single colour.

Can I use the HTML output on my website?

Yes. The output is plain semantic HTML with no framework dependencies and no inline styles, so it drops into any site, CMS, or email template. You supply the CSS for tables, code blocks, and callouts to match your own design.

Is my Markdown uploaded to a server?

No. The conversion runs entirely in your browser using JavaScript. Your Markdown is never uploaded, stored, or logged, which means you can safely convert internal documentation and unreleased content.

Related Tools