Syntax Reference
Markdown Syntax Guide
Markdown syntax is plain-text symbols that convert to HTML. This guide maps 6 element groups, headings, emphasis, lists, links and images, code, and tables and task lists, to their HTML output, with a dedicated page for each.
Key facts
- Element groups covered
- 6: headings, emphasis, lists, links & images, code, tables & task lists
- Specification
- CommonMark plus GitHub Flavoured Markdown (GFM)
- Output
- Semantic HTML elements (h1-h6, strong, em, ul, ol, a, img, code, pre, table)
- Heading levels
- 6 (one to six hash characters)
How does Markdown syntax convert to HTML?
Each Markdown symbol maps to one HTML element. A parser reads the plain-text marks, such as hashes, asterisks, and pipes, then outputs semantic HTML. Paste any example into the converter to see the result.
Markdown is a lightweight markup language. You write plain text with symbols, and the parser produces HTML elements like <h1>, <strong>, and <ul>. The Markdown to HTML Converter runs this conversion in the browser. The 5 sections below cover every core element group, each linked to its dedicated syntax page.
How do you write headings in Markdown?
Markdown headings use 1 to 6 hash characters followed by a space. One hash converts to <h1>, two to <h2>, through six to <h6>. The hash count sets the heading level.
Headings define the document outline. For all 6 levels and rules, see Markdown Headings.
# Title
## Section
### Subsection<h1>Title</h1>
<h2>Section</h2>
<h3>Subsection</h3>How do you make text bold or italic and build lists in Markdown?
Two asterisks convert to <strong> (bold), one to <em> (italic). For lists, a hyphen starts a <ul> and a number with a period starts an <ol>, each item becoming an <li>.
Emphasis is inline; lists are block-level. For emphasis rules see Markdown Bold & Italic, and for the 3 list types and nesting see Markdown Lists.
**bold** *italic*
- First
1. One<strong>bold</strong> <em>italic</em>
<ul><li>First</li></ul>
<ol><li>One</li></ol>How do you add links and images in Markdown?
Links wrap text in brackets followed by a URL in parentheses, converting to an <a> element. Images use the same syntax preceded by an exclamation mark, converting to an <img> with alt text.
Links and images share one bracket-and-parenthesis pattern. For link titles and image attributes, see Markdown Links.
[text](https://example.com)
<a href="https://example.com">text</a>
<img src="photo.png" alt="alt">How do code blocks, tables, and task lists work in Markdown?
Backticks convert code: single for <code>, triple for <pre><code> blocks. Pipes and a dashed divider build GFM <table> elements. The marks - [x] and - [ ] create checkbox inputs in task lists.
Code blocks are core Markdown; for fences and language labels, see Markdown Code Blocks. Tables are a GFM feature, detailed in Markdown Tables. Task lists and other GitHub additions are covered in GitHub Flavored Markdown.
```js
const x = 1;
```
| A | B |
| --- | --- |
| 1 | 2 |<pre><code class="language-js">const x = 1;
</code></pre>
<table><thead><tr><th>A</th><th>B</th></tr></thead><tbody><tr><td>1</td><td>2</td></tr></tbody></table>Where can you find every Markdown syntax element in one place?
The 6 element groups above, headings, emphasis, lists, links and images, code, and tables and task lists, make up the complete Markdown syntax set. The cheat sheet lists all of them with HTML output on one page.
For a single-page quick reference covering every element and its HTML output, see Markdown Cheat Sheet.
Frequently Asked Questions
- What is Markdown syntax?
- Markdown syntax is a set of plain-text symbols, such as hashes, asterisks, and brackets, that a parser converts to HTML elements. It lets writers format content without typing HTML tags directly.
- What is the difference between CommonMark and GitHub Flavoured Markdown?
- CommonMark is the standardised core Markdown specification. GitHub Flavoured Markdown extends it with tables, task lists, strikethrough, and autolinks. Both convert to standard semantic HTML.
- How many Markdown syntax elements are there?
- Core Markdown covers roughly 9 element groups: headings, emphasis, lists, links, images, code, blockquotes, horizontal rules, and (in GFM) tables and task lists. This guide groups them into 6 sections.
- Does Markdown produce valid HTML?
- Yes. Markdown parsers output valid, semantic HTML5 elements such as h1-h6, strong, em, ul, ol, a, img, pre, code, and table. Most parsers also pass raw inline HTML straight through to the output.