Markdown to HTML Converter

Paste or type Markdown on the left and the rendered page appears on the right, updating about 300 milliseconds after you stop typing. Copy the sanitized HTML, or turn on Export a full HTML document to download a standalone .html file with charset, viewport and an optional built-in stylesheet. Everything runs in your browser.

Preview

The box is empty, so there is nothing here yet — paste or type Markdown and the preview and the source will follow as you go.

With this on, tables, fenced code blocks, task lists, strikethrough and autolinks render the GitHub way; with it off you get plain Markdown behavior. A table needs the |---|---| row under its header — without that row the whole block becomes an ordinary paragraph.

Markdown's original rule treats a single newline as whitespace: two lines with no blank line between them end up in the same paragraph. Turn this on and single newlines inside ordinary paragraphs render as a <br>, keeping your line breaks. This switch needs the GFM switch above to be on as well: marked 12.0.2 applies the rule only while GFM is enabled, so with GFM off it has no effect. Blank lines between paragraphs and newlines inside code blocks are unaffected and follow their own syntax.

Off, Copy and Download .html give you a body fragment (<h1>, <p>, <table> and the other content tags), ready to paste into a page that already exists; this tool adds no document wrapper and no typography styles of its own, though a <style> you wrote in the Markdown yourself stays in the fragment when the sanitizer keeps it. On, you get a complete page with <!doctype html>, a UTF-8 charset and a viewport line, which a browser can open on its own. The preview on the right always renders a full document and ignores this switch.

HTML source · 0 characters

Rendering happens inside your browser and the text is not uploaded; the HTML output is sanitized with DOMPurify, and the preview runs in a sandbox.

How to use

  1. Paste your Markdown: Select the sample that is already in the Markdown (live render) box and paste your own text over it. There is no file picker here: open a .md file in an editor, select all, and paste. The preview starts updating about 300 milliseconds after you stop typing.
  2. Set GFM and line breaks: Leave GFM on for tables, fenced code blocks, task lists, strikethrough and autolinks. Turn on Single newlines to <br> if you want every newline to survive as a line break — that switch only works while GFM is on.
  3. Choose a fragment or a full page: Leave Export a full HTML document off to copy a body fragment for a page that already exists. Turn it on for a standalone file with doctype, charset, viewport and a <title>, then fill in Document title, which also names the download.
  4. Copy or download the HTML: The source panel under the preview shows the HTML and its character count. Press Copy to put it on the clipboard — the button reads Copied for a moment — or Download .html to save the file to your device.

How this Markdown to HTML converter works

This Markdown to HTML converter turns pasted text into sanitized HTML in your browser. Rendering starts about 300 ms after you stop typing. Copy a body fragment or export a complete .html document with optional CSS. To convert a .md file, open it in an editor and paste its contents; direct file upload is not supported.

Each render parses the text with marked 12.0.2, cleans the result with DOMPurify, and updates three things together: the rendered page in the preview, the HTML source panel underneath it, and the character count above that panel. There is no Convert button and no progress bar, and if you type again before a render finishes, that older result is dropped instead of overwriting the newer one.

Your Markdown is not sent to a server. marked and DOMPurify are plain JavaScript files the page fetches once, and after that the parsing, the sanitizing, the document wrapper and the download are all built in your own browser, with the text you typed never part of a request. One exception is worth knowing: images you reference by URL are fetched by the preview, exactly as they would be in any web page, so an image host can see that its image was requested. Your Markdown itself stays local, and nothing is stored — the page uses no local storage, so a refresh brings back the starting sample and the default switches.

The preview is an iframe with an empty sandbox attribute, so scripts inside it do not run: in testing, a beacon script placed in the preview produced no request at all, while the same script in an unsandboxed frame fired immediately. Sanitizing has already stripped scripts before that point, so the sandbox is a second layer rather than the only one. The preview also always renders the full document with the built-in stylesheet, whatever the export switches say — it shows you typography, while the source panel is the authority on the exact characters you are about to copy.

Still have the text locked inside a document? PDF to Text hands the words back as plain text you can tidy up as Markdown and paste here.

Fragment or full document: what you actually copy

By default the source panel holds a body fragment: the content tags marked produced — headings, paragraphs, lists, tables — with no doctype, no head element and no charset line. That is what you want when the HTML is going into a page, template or CMS field that already has a head and a stylesheet of its own. This tool adds no typography styles to a fragment. A style block you wrote in the Markdown yourself is a separate matter and usually survives sanitizing, so a fragment is not guaranteed to be style-free.

Turn on Export a full HTML document and the same sanitized content is wrapped into a page a browser can open on its own: a doctype, an html tag whose lang is set to en on this English page, a UTF-8 charset declaration, a viewport line for phones, and a title taken from the Document title field. With the title Document, the localized wrapper adds 1,027 characters with the built-in stylesheet, or 188 without it. Other titles change these totals. Watching the character count jump is the quickest way to confirm which mode you are in.

The Document title field only appears while Export a full HTML document is on, but its value is in use the whole time, because it is also the name of the downloaded file. Characters a file system rejects — backslash, slash, colon, asterisk, question mark, quotation mark, the angle brackets and the vertical bar — become underscores, the name is cut to 80 characters, and an empty field falls back to document.html. So a fragment downloaded without ever opening the full-document switch is still named after the default title.

SwitchesWhat Copy and Download .html give youLength against the fragment
Export a full HTML document off (default)The sanitized body fragment: content tags only, with no head element and no charset line—
Full document on; Inline basic typography styles offA complete page with doctype, lang, UTF-8 charset, viewport and your title, without the built-in stylesheet; a retained <style> from your input remains+188 characters
Full document on; Inline basic typography styles on (its default)The same complete page with the built-in stylesheet inside its head+1,027 characters

Measured with the default title Document; the stylesheet block on its own accounts for 839 of those characters.

Which Markdown features render, and which quietly do not

GitHub Flavored Markdown (GFM) is on by default, so tables, fenced code blocks, task lists, strikethrough and bare URLs that turn themselves into links all behave the way they do in a GitHub README. Switch GFM off and you get plain Markdown instead: strikethrough stays as the tildes you typed, a bare URL stays as text, and a table degrades into an ordinary paragraph.

A GFM table also needs its separator row — the |---|---| line directly under the header. Without that row the whole block is paragraph text rather than a table. If a table appears as paragraph text, check its separator row and make sure GFM is on.

Single newlines to <br> is off by default, matching Markdown's original rule that one newline counts as whitespace: two lines with no blank line between them end up in the same paragraph. Turning it on renders those newlines as line-break tags — but only while GFM is on as well. marked 12.0.2 applies the rule only with GFM enabled, so with GFM off the switch has no effect at all. The two checkboxes never disable each other; the hint under the line-break switch is what tells you GFM has to be on as well. Blank lines keep splitting paragraphs either way, and the newlines inside a code block stay exactly as you typed them.

Three kinds of content pass through as plain text instead of being rendered. Fenced code blocks arrive as a pre and code pair carrying a language class, with no coloring at all — there is no syntax highlighter on this page, so add one such as highlight.js in whichever page the HTML ends up in. A mermaid block is just another code block; no diagram is drawn. LaTeX such as $E=mc^2$ comes out as the characters you wrote, because no math typesetter is loaded here.

What the sanitizer removes, and what it keeps

Markdown lets you write raw HTML, and marked passes it straight through, so the parser's output can contain anything at all — including a script tag. Every render therefore goes through DOMPurify 3.1.6 with its default configuration before it reaches the preview or the source panel. A script or iframe element is deleted whole. An event attribute such as onerror, onclick or onload is deleted while its element stays, so an image tag with an onerror handler becomes a plain image tag. A link whose target starts with the javascript scheme loses its href and keeps its text, leaving an anchor with no destination.

When something is dropped, a line above the source panel reports how many items were removed. That number counts elements and attributes together, and only the ones deleted from the body: in a test, a script tag plus an onerror attribute plus a javascript link reported three removals. It is not a tally of everything missing from the output — a style block or an HTML comment written at the very start of your Markdown is parsed into the head by the browser, so it is neither in the fragment nor in the count.

Plenty of raw HTML survives, which surprises people expecting a stripped-down result. Ordinary tags such as div, span, table and img are kept, the srcset attribute included. So are form, input and button elements: they are no longer wired to any script, but the markup is there. GFM task-list checkboxes survive as disabled checkbox inputs, which is why task lists are visible in both the preview and the export. A style block that lands inside the body — anything after your first heading or paragraph, for instance — is kept as it was and is not counted as a removal, because style is an allowed tag in DOMPurify's defaults. HTML comments inside the body are deleted, and those are counted.

One detail about the source panel: sanitizing re-serializes the HTML, so entity spellings can differ from what marked wrote. A quotation-mark entity inside a code block came back as a literal quotation mark in testing, while the less-than entity was left alone. The meaning is identical, but the source is not a character-for-character copy of the parser's output.

Images, styling and the limits of the preview

Image paths are never rewritten. A relative path such as img/photo.png stays exactly that in the source, which is right for the file's eventual home and wrong for the preview: the preview document resolves relative URLs against the address of this tool page, so it requests something like /en/text/markdown-to-html/img/photo.png — a real request that normally comes back empty and leaves a broken image. Your browser has no access to the folder on your disk where the picture sits next to the Markdown, so a preview cannot show it. Download the HTML, put it in the directory those images belong to, and the paths resolve. Images written as data URIs display in the preview right away, and absolute links to an image on the web load normally.

The built-in stylesheet is one fixed block of CSS with no options: an 820px content column, line height 1.7, bordered tables, a grey background behind code, blue links and a light color scheme. You either include it or you do not. To change the look, edit that style block after downloading, or write your own style block in the Markdown — one that lands in the body is kept, it comes after the built-in rules, and at equal specificity it wins. This page offers no dark theme, no font size control and no width control.

The preview has no open-in-a-new-tab button, no zoom and no width switch, so the way to see the real thing is to download the file and open it. There is no size limit anywhere in this tool, neither on the page nor underneath it, so how much Markdown you can paste depends on your device's memory; rendering runs on the page's main thread, with no progress bar and no cancel button. For scale, a 1.2 MB input of 200,000 paragraphs rendered in about 216 milliseconds in a desktop test run outside the browser. Phone performance has not been measured; rendering time depends on the device and the Markdown structure. Extremely deep nesting can make the parser give up: 5,000 levels of nested blockquote threw a stack overflow in testing. When a render fails you get a single error line, and the preview and the source keep showing the last version that worked.

How this tool is checked

  • The logic behind this tool is covered by 27 automated test cases (hand-checked examples, edge cases and invalid input), and they run again before every release.
  • Formulas, figures and definitions are checked against the sources listed at the end of this page.

How we build and test our tools →

Frequently asked questions

Can I upload a .md file instead of pasting?
No — this page has no file picker and no drop zone. Open the .md file in any text editor, select everything and paste it into the box. The result is identical either way, because the textarea is the only input this tool has.
Is my Markdown uploaded anywhere?
No. The parsing, the sanitizing and the download all happen in your browser, and your text is never part of a request. The page does fetch the marked and DOMPurify code once, and the preview loads any image you point it at by URL, so an image host can see that request — but not your document.
Why does my table render as a single paragraph?
The separator row is missing, or GFM is off. A GFM table needs the |---|---| line directly under its header row; without it the block is ordinary paragraph text. Check that the GFM switch is on as well.
I turned on Single newlines to <br> and nothing changed. Why?
That switch needs GFM on as well. marked 12.0.2 applies its line-break rule only while GFM is enabled, so with GFM off a single newline is still just whitespace and your two lines stay in one paragraph. The checkboxes remain independent; the hint below the line-break switch explains that GFM must also be on.
Why are the images broken in the live preview?
Relative paths cannot resolve there. The preview resolves a path like img/photo.png against this tool page's address rather than against your disk, so the request usually returns nothing and you see a broken image. The source itself is correct: download it next to your images and they appear.
What does the removed-items notice mean?
It counts the elements and attributes DOMPurify deleted from your content. A script tag counts as one, an onerror attribute as one, a javascript link's href as one. It is not a list of everything absent from the result: a style block or comment at the very top of your Markdown is parsed into the head and is never counted.
Can I change the fonts or colors of the exported page?
Yes, but not with a setting here. The built-in CSS is one fixed block with no options, so either edit that style block after downloading, or write your own style block in the Markdown — one inside the body is kept, and it overrides the built-in rules at the same specificity.
Can this convert HTML back to Markdown?
No, this page goes one way only: Markdown in, HTML out. It also produces nothing but .html — there is no Word or PDF export, no hosting and no shareable link, just a file saved to your own device.

Add this tool to your website

Free for any website, personal or commercial. Paste the code where you want the tool to appear — it works on WordPress, Blogger, Google Sites, Notion and plain HTML.

<div class="gingertool-widget" data-embed="https://gingertool.com/embed/en/text/markdown-to-html/" data-height="640" style="font-size: 13px; line-height: 20px; margin: 6px 0 16px; text-align: left">Markdown to HTML Converter &#183; <a href="https://gingertool.com/en/text/markdown-to-html/">Gingertool</a></div>
<script src="https://gingertool.com/embed.js" async></script>

Please keep the credit link below the tool. Embedded tools show no ads.

Step-by-step: Google Sites · Blogger · WordPress · Notion

Cite this tool

Using a result in a report, paper or assignment? Copy a ready-made reference.

APA
Gingertool. (2026). Markdown to HTML Converter [Online tool]. Retrieved November 30, 2026, from https://gingertool.com/en/text/markdown-to-html/
MLA
“Markdown to HTML Converter.” Gingertool, November 30, 2026, https://gingertool.com/en/text/markdown-to-html/. Accessed November 30, 2026.
BibTeX
@misc{gingertool-markdown-to-html,
  author = {{Gingertool}},
  title = {Markdown to HTML Converter},
  year = {2026},
  url = {https://gingertool.com/en/text/markdown-to-html/},
  note = {Accessed: 2026-11-30}
}