Solved.tools โ€” Free Online Calculators & Tools

We use cookies for analytics and advertising. Learn more about our cookie policy

Markdown to HTML Converter

Last updated: 22 August 2026

Reviewed by Gavin ยท Research and drafting assisted by AI

Markdown to HTML Converter

Convert Markdown to safe, copy-ready HTML with a live preview. Toggle between GitHub-Flavoured Markdown (tables, task-lists, strikethrough, autolinks) and strict CommonMark 0.30. The output pane shows the rendered HTML inside a sandboxed container so even pasted scripts and dangerous href attributes are visible after the parser, but the output you copy or download has those stripped by DOMPurify.

111 chars ยท 170 chars HTML
Presets:

Heading 1

Heading 2

Heading 3

Heading 4

A paragraph with bold, italic, and inline code.

Show sanitised HTML source
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<p>A paragraph with <strong>bold</strong>, <em>italic</em>, and <code>inline code</code>.</p>
Why sanitise? Untrusted Markdown can carry HTML or dangerous URL schemes (e.g. javascript:, vbscript:) that, when rendered, allow XSS (cross-site scripting). This tool strips <script>, inline event handlers (onerror=, onclick=โ€ฆ), and dangerous href / srcschemes before you see or copy the output. The original CommonMark 0.30 and GitHub-Flavoured Markdown specifications define what parsing should accept; the WHATWG HTML Living Standard plus the OWASP XSS Prevention Cheat Sheet define what sanitisation must remove. Together they let you paste Markdown into any CMS, README, or static-site generator with confidence.
Was this helpful?


Markdown to HTML Converter

The Markdown to HTML converter turns Markdown source text into clean HTML with a live preview. You paste Markdown on the left, read the raw HTML output on the right, and see the rendered, sanitised result in a preview pane below. A single toggle switches between two dialects: GitHub-Flavoured Markdown (GFM), which adds tables, task lists, strikethrough, and autolinks, and strict CommonMark 0.30. The output you copy or download has already been run through DOMPurify, so scripts, inline event handlers, and dangerous URL schemes are removed before they can do anything.

The tool is aimed at developers writing README files, GitHub issues, and documentation, and at anyone who needs to turn Markdown into HTML for a content management system or static-site generator. Everything happens in your browser, nothing is uploaded, and the sanitisation step means you can safely paste Markdown from an untrusted source without opening the door to cross-site scripting.

How to Use the Converter

  1. Type or paste Markdown into the Markdown source textarea, or load a preset.
  2. Pick a dialect with the Flavour dropdown: GitHub-Flavoured (GFM) or CommonMark (strict).
  3. Read the HTML output pane for the raw markup, or open the live preview below it.
  4. Use Copy HTML to copy the sanitised output to the clipboard, or Download .html to save a standalone page.
  5. Open the Show sanitised HTML source panel to inspect the exact string that was copied.

When to Use This Tool

This converter fits several everyday developer workflows. Use it to write a README for a repository and preview the rendered output before committing. Use it to prepare documentation for a content management system that accepts HTML but not Markdown. Use it to paste meeting notes or issue drafts into a blog editor that only takes HTML. Use it to sanitise Markdown that arrived from a third party before rendering it on your own site, because the DOMPurify step strips scripts and inline event handlers. The raw output pane is useful when you are learning how Markdown maps to HTML and want to see exactly which tags the parser produced, while the sanitised preview shows what a visitor would actually see. It is also a quick way to generate a standalone .html file you can open in a browser without any build step.

The Conversion Method

The conversion runs in two stages: parse, then sanitise.

The parse stage turns Markdown into HTML. The converter uses the marked library, which implements the CommonMark 0.30 specification, with GitHub-Flavoured Markdown extensions switched on by default. Those extensions add pipe tables with alignment, fenced code blocks with a language class, task-list items, strikethrough, and autolinking of bare URLs. With the flavour set to CommonMark strict, those extensions are disabled and the output follows the base specification only.

The sanitise stage removes anything dangerous. The raw HTML is passed through DOMPurify, which strips <script> and <style> elements, inline event handlers such as onerror and onclick, and any href or src attribute that uses a dangerous scheme such as javascript: or vbscript:. The result is HTML that is safe to embed in a page or paste into a CMS. This two-stage design matters because a Markdown document can legitimately contain raw HTML, and that HTML is exactly where a script can hide.

Worked Examples

Example 1, headings and emphasis. Input # Title becomes <h1>Title</h1>. Input **bold** becomes <p><strong>bold</strong></p>.

Example 2, a link. Input [example](https://example.com) becomes <p><a href="https://example.com">example</a></p>.

Example 3, a GFM table. Input with a header row, a separator row of dashes, and two data rows becomes an HTML <table> with <th> and <td> cells and the requested column alignment.

Example 4, a script is stripped. Input <script>alert(1)</script> parses to that same raw tag, but the sanitised output is empty. The script is removed, not escaped, so it never executes.

Example 5, a dangerous link. Input [x](javascript:alert(1)) becomes <p><a>x</a></p> after sanitisation. The anchor remains but the href is dropped.

One subtlety of Markdown is that it allows raw HTML to pass through unchanged. A line such as <div class="note"> is not escaped; it is handed to the output as HTML. That is by design in both CommonMark and GFM, and it is also why the sanitise stage is not optional. The parser produces HTML, and the sanitise stage decides which of it is safe to keep. Working developers rely on this pass-through to embed snippets of HTML they already trust, while the sanitisation stage protects them from the snippets they do not. This is the single most important thing to understand about the converter: parsing is about structure, and sanitisation is about safety, and the tool does both in order.

GFM Features in Detail

GitHub-Flavoured Markdown adds a handful of extensions on top of CommonMark, and each one changes the HTML the parser produces. Pipe tables let you write a table with a header row, a separator row of dashes, and data rows; the converter emits a <table> with <th> and <td> cells and preserves the column alignment you set with colons in the separator row. Task lists let you write - [ ] and - [x] to produce list items with checkboxes, which GitHub renders as tickable boxes. Strikethrough uses double tildes (~~text~~) to wrap text in a <del> element. Autolinks turn a bare URL or email address into a link without the square-bracket syntax. When you switch the flavour to CommonMark strict, these extensions are disabled, and a pipe table is treated as plain paragraph text rather than a table. Knowing which features belong to which dialect helps you decide which flavour to pick for a given document.

Understanding the Output

The converter shows three views of the same input, and each serves a different purpose. The raw output pane shows the parser's output before sanitisation, with every tag the Markdown produced, so you can learn how Markdown maps to HTML and debug why a construct rendered a certain way. The live preview renders the sanitised HTML inside a sandboxed container, showing what a visitor would actually see on a page. The Copy HTML button and the Download button both operate on the sanitised output, not the raw pane, so what you paste into a CMS or save as a file has already been cleaned. Keeping these three views distinct is what makes the tool useful for both learning and production work.

Common Issues

  • Forgetting that GFM features need the GFM flavour. Tables and strikethrough will not render under CommonMark strict.
  • Pasting raw HTML and expecting it to be escaped. The parser passes raw HTML through, and the sanitisation stage removes only the dangerous parts; safe raw HTML survives.
  • Assuming the raw output pane is safe to paste. Always copy from the sanitised output, not the raw pane.
  • Expecting the download to preserve JavaScript. The downloaded .html file wraps the sanitised body in a minimal HTML5 document, so scripts are already gone.
  • Using the wrong flavour for the content. A document full of tables will look broken under CommonMark strict; switch to GFM.
  • Confusing the raw pane with the trustworthy output. The raw pane is a debugging aid; the sanitised preview and the Copy HTML button are the safe results.

Frequently Asked Questions

Q: What is the difference between CommonMark and GitHub-Flavoured Markdown? A: CommonMark is the base specification. GFM is CommonMark plus extensions for tables, task lists, strikethrough, and autolinked URLs.

Q: Does the converter sanitise the output? A: Yes. The output is run through DOMPurify, which removes scripts, inline event handlers, and dangerous URL schemes before you copy or download it.

Q: Can I paste untrusted Markdown safely? A: Yes. The sanitisation step strips scripts and event handlers, so pasting Markdown from an unknown source will not execute code.

Q: What does the raw HTML pane show? A: It shows the output of the parser before sanitisation. This lets you see what the Markdown produced, but you should copy the sanitised result instead.

Q: Can I download the result as a file? A: Yes. The Download .html button wraps the sanitised body in a minimal HTML5 document and saves it as a standalone page.

Q: Does anything leave my browser? A: No. The conversion and sanitisation both run locally, and the Markdown you paste is never uploaded.

Q: Why is my table rendering as plain text? A: Tables are a GitHub-Flavoured Markdown extension. Set the flavour to GFM and check that the separator row uses dashes and colons for alignment.

Q: What happens to raw HTML I paste? A: Raw HTML passes through the parser and is then filtered by DOMPurify. Safe tags survive; scripts, styles, and event handlers are removed.

References