Markdown ⇄ HTML Converter

Convert Markdown to HTML and HTML back to Markdown in your browser, with a live preview. Pasted HTML is sanitised, never trusted.

Runs entirely in your browser — nothing is uploaded

Markdown in

HTML out

The rendered result appears here as you type.

Feeds the result into the opposite direction, so you can see exactly what survives a round trip.

About the Markdown ⇄ HTML Converter

Paste Markdown and get HTML; paste HTML and get Markdown back. Both directions render side by side with a live preview, so you can see the document as a reader will see it rather than guessing from the tags. The Markdown side covers CommonMark plus the GitHub extensions people actually use — pipe tables with column alignment, ~~strikethrough~~, - [x] task lists, fenced code with a language, reference links and images, setext and ATX headings, nested and loose lists, blockquotes with lazy continuation, hard line breaks and optional heading id anchors. The HTML side handles real-world markup: whole pages, fragments pulled out of a CMS, tables with thead, <pre><code class="language-js"> blocks, definition lists, <details>, and the tag soup that comes with unclosed elements and mismatched close tags.

The non-obvious pitfall in this problem area is ordering. A Markdown renderer that applies its inline transforms first and escapes afterwards will happily emit an attacker's <script> tag; one that escapes first and transforms afterwards cannot. This converter escapes the entire source chunk — &, <, >, ", ' — before a single inline rule runs, so every tag in the output was written by the converter and not one byte of your input ever lands in a tag position. The mirror problem in the other direction is that pasted HTML has to be assumed hostile, so it is tokenised into a tree and then re-serialised from that tree against an allowlist. Nothing round-trips as raw source: <script>, <style>, <iframe>, <svg>, on* handlers and style attributes are gone before anything reaches the page, and the tool tells you what it removed instead of quietly dropping it.

URLs get a pass of their own, because [click me](javascript:alert(1)) is the classic way a Markdown renderer becomes an XSS hole. Every destination is entity-decoded up to three times, stripped of the control characters and unicode spaces that are used to split a scheme in half, and then checked against a scheme allowlist. javascript:, vbscript: and non-image data: URLs are rejected — the link text survives, the destination does not, and a red banner names the URL that was dropped. Encoding tricks like &#106;avascript:, &#106avascript: and jav&#x0A;ascript: are all caught by the same check.

Round trips are lossy in one specific direction, and the honest thing is to say where. Markdown has no syntax for colspan, rowspan, <kbd>, <sub>, <sup>, <mark>, class names or any attribute at all. A table with merged cells is therefore kept as literal HTML rather than mangled into a pipe table that loses the merge, a table with no header row gets an empty one because pipe tables require a header, and <kbd>-style elements are preserved as inline HTML unless you turn that off. Each of these decisions prints a note explaining itself. In the other direction, raw HTML written inside Markdown is escaped and shown literally rather than passed through — a deliberate deviation from CommonMark that buys the safety guarantee above, and it means HTML comments (<!-- … -->) and character entities such as &amp; also appear as visible text. YAML and TOML front matter at the top of a file is skipped the way a static site generator skips it, instead of rendering as a stray horizontal rule and heading.

Everything runs inside your browser using standard web APIs. Your data is never uploaded, never stored on a server, and never leaves your device — you can confirm that by opening your browser devtools Network tab, or by switching off your Wi-Fi and using the tool offline.

Frequently asked questions

Does it support GitHub Flavored Markdown?

The parts most documents use, yes: pipe tables with :--- / ---: / :---: alignment, ~~strikethrough~~, - [x] task lists, fenced code with a language, and automatic linking of bare https:// and www. URLs. Turning off the 'GitHub flavour' switch drops back to plain CommonMark behaviour, where those become literal text. Footnotes, math, mermaid diagrams, admonition blocks and emoji shortcodes are not supported — they are non-standard extensions that differ between renderers, so anything relying on them will come out as plain text rather than silently half-working.

What happens to raw HTML written inside my Markdown?

It is escaped and shown as literal text, not passed through. CommonMark allows raw HTML in Markdown; this converter deliberately does not, because passing user HTML straight into a page that is then rendered in your browser is precisely how a Markdown renderer becomes an XSS vector. The practical consequence is that <br>, <details>, <sup> and HTML comments typed inside Markdown appear as visible text rather than as markup. If you need those, convert in the other direction: write the HTML in the HTML pane and take the Markdown out.

Is it safe to paste HTML I copied from a random website?

That is the case it is built for. The HTML is tokenised, built into a tree, and rebuilt from that tree against an allowlist of elements and attributes — the output shares no bytes with the input except escaped text. Scripts, styles, iframes, SVG, form widgets, every on* handler and every style attribute are removed, and a banner lists what went. The preview is assembled from real DOM nodes with escaped text rather than by setting innerHTML, so even a bug in the sanitiser could not produce a live tag.

Why are the images in my document showing as placeholders?

Because this page is not allowed to fetch them. The site sends a Content-Security-Policy that permits images only from its own origin or an embedded data: URI, so a request to a third-party image host would be blocked by your browser regardless. Showing a labelled placeholder with the URL is what actually happens, rather than a broken-image icon pretending something failed — and it means previewing a draft never signals to an image host that you opened it. Embedded data: images do render, and the <img> tag in the output is never modified.

Will HTML → Markdown → HTML give me back exactly what I started with?

Structure yes, presentation no. Headings, paragraphs, emphasis, links, images, lists, blockquotes, code blocks and simple tables round-trip cleanly. Anything Markdown cannot express is lost by definition: class names, ids, inline styles, data attributes, and the distinction between <b> and <strong>. Tables with colspan or rowspan and cells containing block content are kept as raw HTML instead of being flattened, and a note tells you which table it happened to. Use the 'Send the output back the other way' button to see the round trip for your own document rather than taking anyone's word for it.

Is there a size limit?

Only your device's memory. There is no upload, so there is no server-side cap. Conversion runs on the tab's main thread at roughly a megabyte of Markdown per quarter-second, and a warning appears above about 400 KB of input because the page will pause noticeably after each pause in typing. The rendered preview stops painting past 600,000 characters of generated HTML — Copy and Download always give the complete output regardless.

Does it handle YAML front matter?

Yes. A leading --- … --- block (or +++ … +++ for TOML) is treated as site-generator metadata and skipped, with a note saying how many lines went. Without that, the opening --- parses as a horizontal rule and the closing one turns your first metadata line into a heading, which is the single most common way a Markdown converter mangles a real file. A --- that is not closed is still treated as an ordinary thematic break.