Markdown is the easiest way to write structured text: a README, release notes, documentation or a blog draft. Sooner or later, though, the text has to go somewhere that only understands HTML: an email template, a CMS field without a Markdown editor, a static page or a help-centre article. At that point you need to know what HTML your Markdown will actually produce.
This guide maps common Markdown syntax to its HTML output, explains what GitHub Flavored Markdown (GFM) adds, covers the line-break rule that confuses almost everyone, and shows how to convert a document and use the result safely.
Markdown is a shorthand for HTML
Markdown was designed so that plain text reads well and converts predictably into HTML. Each piece of syntax has a direct HTML equivalent:
| Markdown | HTML output |
|---|---|
# Title |
<h1>Title</h1> |
## Section |
<h2>Section</h2> |
**bold** |
<strong>bold</strong> |
*italic* |
<em>italic</em> |
`code` |
<code>code</code> |
[text](https://example.com) |
<a href="https://example.com">text</a> |
 |
<img src="chart.png" alt="alt"> |
- item |
<ul><li>item</li></ul> |
1. step |
<ol><li>step</li></ol> |
> quote |
<blockquote><p>quote</p></blockquote> |
--- |
<hr> |
Paragraphs are separated by blank lines, and each becomes a <p> element. Fenced code blocks become <pre><code>, with a language hint added as a class:
```js
const total = 42;
```
becomes:
<pre><code class="language-js">const total = 42;
</code></pre>
The class does not colour anything on its own. A syntax highlighter on the destination page uses it to apply colours.
What GitHub Flavored Markdown adds
The original Markdown had no tables, no strikethrough and no task lists. GitHub Flavored Markdown is a widely used extension that adds them:
- Tables with pipes and a separator row. Colons in the separator (
:---,:---:,---:) set left, centre or right alignment. - Task lists:
- [ ] todoand- [x] donebecome list items with checkboxes. - Strikethrough:
~~old price~~becomes<del>old price</del>. - Autolinks: a bare
https://…address becomes a clickable link.
If your destination platform supports only basic Markdown, tables written in GFM will appear as raw pipes. Converting to HTML first avoids that problem, because HTML tables work everywhere.
The line-break rule
In standard Markdown, a single newline inside a paragraph does not create a line break. These two lines:
Line one
Line two
render as one paragraph, "Line one Line two". To force a break you end the line with two spaces or a backslash, or you leave a blank line to start a new paragraph. Some platforms (chat apps, GitHub comments) treat every newline as a break instead. Neither is wrong; they are different settings, which is why the same text can look different in two places.
Convert Markdown with our tool
The Markdown to HTML Converter turns Markdown into HTML as you type and shows both the code and the rendered result.
- Open the Markdown to HTML Converter. A sample README demonstrates headings, lists, a table, a task list and a code block.
- Paste your text into the Markdown box, or click Open .md file to load a
.md,.markdownor.txtfile. - Choose your options:
- GitHub Flavored Markdown (on by default) enables tables, task lists, strikethrough and autolinks.
- Line breaks turns every single newline into a
<br>, matching chat-style behaviour. - Full HTML document wraps the output in
<!DOCTYPE html>,<head>and<body>, and uses your first#heading as the page title.
- Read the result in the HTML code tab, or switch to Preview to see it rendered with simple readable styles.
- Click Copy HTML to paste it into a CMS or template, or Download .html to save it as
document.html.
The character count under the output helps when a destination field has a size limit.
Other ways to convert Markdown
Pandoc
Pandoc is a free command-line converter that handles Markdown, HTML, Word, PDF and many other formats:
pandoc notes.md -o notes.html --standalone
It is the best choice for batch jobs, footnotes, citations and custom templates. It needs installing and some familiarity with the terminal.
Your editor
VS Code, Typora, Obsidian and similar editors show a Markdown preview, and several can export HTML. Their output often includes the editor's own CSS, which may or may not be what you want.
Static site generators
If you publish many Markdown pages, a static site generator converts them all during the build and applies your site's layout. That is the right approach for documentation sites; a converter is better for one-off pieces of content.
Tips and pitfalls
Raw HTML passes through
Markdown allows inline HTML, and most converters, including ours, copy it into the output unchanged. That is useful for things Markdown cannot express, but it means converted output is not sanitised. If the Markdown came from untrusted users, run the HTML through a sanitiser on your server before displaying it, or a <script> in the input could end up on your page.
Nested lists need consistent indentation
Indent sub-items by at least two spaces (four is safest) under the text of the parent item. Mixed tabs and spaces are the usual reason a nested list flattens.
Tables need a separator row
A GFM table without the | --- | line underneath the header is just text with pipes. If building tables by hand is tedious, use the Markdown Table Generator.
Tidy the output
The generated HTML is compact. Run it through the HTML Formatter if you need to read or edit it, and use Markdown Preview while you are still writing. Going the other way, HTML to Markdown converts existing pages back into Markdown.
Frequently asked questions
Why are my line breaks missing in the HTML?
Standard Markdown joins lines within a paragraph. Switch on the Line breaks option, end lines with two spaces, or separate them with a blank line.
Does the converter support tables?
Yes, when GitHub Flavored Markdown is enabled. Tables need a header row and a separator row of dashes, with optional colons for alignment.
Is the HTML output safe to publish?
It is safe for content you wrote yourself. Raw HTML inside the Markdown is passed through, so sanitise output that comes from untrusted users before publishing it.
How do I get a complete web page instead of a fragment?
Turn on Full HTML document. The output then includes a doctype, head, title and body and can be opened directly in a browser.
Will code blocks be syntax highlighted?
The output marks code blocks with a language-… class. Colours appear only if the page where you publish includes a syntax highlighting script or stylesheet.