Markdown to HTML
How to turn Markdown into HTML
- Paste or type Markdown in the first box, or click Open a Markdown file and choose a .md, .markdown or .txt file.
- Leave GitHub-style ticked for tables, task lists and strikethrough. Tick the line-break option to turn each new line into a line break.
- Keep the clean option ticked unless your own raw HTML must stay exactly as you wrote it.
- Look at the preview under the HTML box. Both update as you type.
- Click Copy HTML to paste it into a page or CMS, or Download .html to save a complete file.
What goes in and what comes out
The page uses marked to turn Markdown into HTML and DOMPurify to clean the result. Neither library is requested at load; each (50,548 and 29,828 bytes) is fetched once, after the first input. The result is an HTML fragment with no <html> wrapper, so it fits a CMS editor or a template.
Our 311-byte sample.md holds a heading, emphasis, a link, a two-row table, a task list, a code block and two pieces of hostile markup. With the defaults it gave 541 characters of HTML. The code block kept class="language-js", the task items became disabled checkboxes, and the table got thead and tbody.
What the clean option removes, and what it keeps
With clean ticked, the HTML passes through DOMPurify. On sample.md it removed the <script> tag and the onerror attribute and left <img src="x">. With clean off the same file gave 615 characters and kept both. In a second test a pasted div lost its onclick, an <iframe> was dropped, and a javascript: link kept its text but lost its address.
Clean does not remove <style> blocks or style attributes. A line reading <style>body{display:none}</style> stayed in the HTML with clean on, and it hid our own test page, because the preview shares the page's styles. Do not paste Markdown from a source you do not trust, and read the HTML box before you publish it.
Nothing ran in the preview in any run. It is cleaned even when the option is off, so only the HTML box and the download keep raw HTML in that case.
GitHub-style and line breaks
GitHub-style is ticked by default. With it on, a pipe table became a real <table>, and the row |:--|:-:|--:| gave align="left", align="center" and align="right". The text ~~gone~~ became <del> and a bare https://gramfile.com/ became a link. With it off, the table came out as one paragraph of pipes and the task list as plain [x] done items.
Line breaks are off by default, so two lines typed one under the other stay in one paragraph. Tick the option and the HTML gets a <br> between them.
Preview, Copy HTML and Download .html
The preview uses GramFile's styles, so it checks content, not how the HTML will look on your site. A remote image appears as text such as [image: logo] and the page makes no request for it, while the HTML keeps the image tag. An image written as a data: address is shown.
Copy HTML put exactly the contents of the box on the clipboard (541 characters in our run). Download .html saved converted.html, 657 bytes for the sample: a document with a doctype, a UTF-8 charset line and a title taken from the first heading ("Sample Markdown"). With no heading the title is "Document". Chromium read it back with its one table and two checkboxes. There is no stylesheet.
What it does not do
Front matter is not read. A --- block holding title: Hello came out as a horizontal rule and an <h2> reading "title: Hello". Headings get no id attributes. We did not test footnotes, math, definition lists, or pasting the output into a CMS or email program.
Limits and errors
A file over 2 MB is refused with That file is over 2 MB. Paste the part you need instead. and nothing is loaded (our test file was 2,306,949 bytes). Exactly 2,097,152 bytes converted. The code sets no limit on pasted text: 3,145,805 bytes converted in 16.4 seconds. In our sandbox a 1,992,309-byte file with 11,220 sections gave 4,640,235 characters of HTML in 7.0 seconds, so timings will differ.
Files named .txt are read as Markdown. Binary data renamed to .md is not detected and gave 17 characters of junk with no message.
Related conversions
For rows and records instead of documents, CSV to JSON and JSON to CSV do the work. To check or tidy JSON, use the JSON formatter. The rest are listed under File and data converters.
Measured results
| Input | Setting | What came out |
|---|---|---|
| sample.md, 311 bytes | Defaults | 541 characters; table, two task checkboxes and the code class kept; script and onerror removed |
| sample.md | Clean off | 615 characters; script tag and onerror kept in the box, nothing ran in the preview |
| div with onclick, plus an iframe | Clean on, then off | On: onclick and iframe removed. Off: both kept |
| style block with body{display:none} | Clean on and off | Kept both times and hid the test page |
When pandoc or a site generator is the better choice
Use pandoc or a static site generator for many files, front matter, templates or footnotes. They run on your own computer or a build server. This page suits one note or one snippet for a CMS. VS Code previews Markdown.
Frequently asked questions
Is my Markdown uploaded?
No. marked and DOMPurify run in your browser. In our runs no request had a body and none named the text we typed. The site's ad and analytics scripts were blocked in the test, so we can say only that none of the requests we saw carried a body.
Does the clean option make the HTML safe to publish?
In our tests it removed scripts, onclick and onerror attributes, iframes and javascript: links. It keeps style blocks and style attributes, so read the HTML first, and filter more strictly on your own site if other people wrote the text.
Which Markdown flavor does it use?
The GitHub-style option turns on marked's table, task list, strikethrough and bare-link rules. With it off you get plain Markdown rules. We did not compare the output with GitHub's own renderer, so edge cases can differ.
Can I convert a Markdown table to an HTML table?
Yes, with GitHub-style ticked. A header row plus an alignment row gave thead, tbody and align attributes. With the option off, the table stays as text.
Why do my line breaks disappear?
In Markdown a single new line stays inside the paragraph. Tick the line-break option to get a br tag, or leave a blank line to start a new paragraph.
Does it read front matter or add heading ids?
No to both. A front matter block came out as a rule and a heading, and headings had no id attributes in our test.