Quick Answer
Markdown is a plain-text way to format writing using ordinary punctuation, so a hash makes a heading and asterisks make bold. You can learn the useful parts in twenty minutes. The catch is that Markdown is a family of languages, not one, and knowing which flavour you write saves real frustration.
Markdown lets you format text using punctuation you already type. A hash before a line makes it a heading. Asterisks around a word make it bold. A hyphen at the start of a line makes a bullet. The file stays readable as plain text either way, which is the whole point.
This guide does not list every symbol. Our Markdown cheatsheet already does that, with an example for every one. What this guide covers is the part that actually causes trouble: Markdown is not one language, and nobody tells you that until your carefully formatted table renders as a row of pipes and dashes.
What is Markdown and why does it exist?
John Gruber released Markdown in March 2004 with a simple goal. Formatted text should be readable as-is, before anything converts it.
RFC 7763, published by the IETF in March 2016, registered text/markdown. It includes an optional variant parameter, and a format that needs to declare which version of itself you wrote is a format with a problem.
Why does the same Markdown render differently everywhere?
Because the original spec was ambiguous, and everyone who implemented it made their own decisions about the gaps.
RFC 7763 describes Markdown as a family of related plain-text formatting syntaxes and sets up an IANA registry for variant identifiers. Its companion, RFC 7764, populated it with eight registered variants: MultiMarkdown, GFM, pandoc, Fountain, CommonMark, kramdown-rfc2629, rfc7328 and Extra.
The CommonMark specification, by John MacFarlane, version 0.31.2 dated 28 January 2024, is blunter. It states that Gruber's description does not specify the syntax unambiguously, and lists 14 numbered examples of where it falls apart, such as how far a sublist must indent. CommonMark fixes this with 652 worked examples, each pairing an input with the exact HTML a conforming parser must produce.
The consequence is stated plainly in the spec: implementations have diverged considerably, so the same document renders one way on a GitHub wiki and differently when pandoc converts it to docbook. When formatting breaks after pasting, you have moved between two members of a family who disagree.
Which flavour are you actually writing?
Three matter in practice.
- Original Markdown, Gruber's 2004 version. No tables.
- CommonMark, the strict specification that resolves the ambiguities. Its output is predictable. Still no tables, because tables were never in the base syntax.
- GitHub Flavored Markdown, CommonMark plus the extras most people assume are standard: tables, strikethrough, task list checkboxes and automatic linking of bare URLs.
The practical rule: if you write a table and it renders as literal pipes and dashes, you are in a CommonMark or original-Markdown environment. The feature was never in that dialect.
Why don't those note boxes work everywhere?
Alerts are the tinted panels you see in READMEs. The syntax is a blockquote with a marker on its own first line.
> [!NOTE]
> Useful information a reader should know.
> [!WARNING]
> Something that needs immediate attention.
There are five markers: NOTE, TIP, IMPORTANT, WARNING and CAUTION. On GitHub each renders as a styled panel. Anywhere that does not implement them, you get an ordinary blockquote starting with the literal text [!NOTE], usually run straight into your first sentence.
Alerts are not in the GFM spec either. That document is version 0.29-gfm dated 6 April 2019, and GitHub documents alerts in its own product docs instead, as an extension based on the blockquote syntax. So a parser can be fully GFM compliant and still not know what an alert is. GitHub also says alerts cannot be nested inside other elements.
If the file only lives on GitHub (or GitLab, which added the same syntax in version 17.10), use them. Elsewhere, a bold Note: at the start of a normal paragraph survives every renderer.
What is that block of dashes at the top of the file?
Front matter, and it isn't Markdown at all. It looks like this:
---
title: How to Repot a Fern
date: 2026-08-17
tags: [plants, indoor]
draft: false
---
# How to Repot a Fern
Ferns hate being moved. Here is how to do it anyway.
Everything between the two lines of three dashes is metadata, usually YAML, for the tool processing your file. RFC 7764 explains why it exists: the original syntax provides no means to include metadata in the content stream, so communities invented their own conventions.
Paste a file with front matter into a renderer that doesn't understand it and you'll see a horizontal rule at the top and every metadata line squashed into one big heading, because --- under a paragraph turns that paragraph into a heading. The keys are set by your tool, not a standard. Strip the block before pasting the content anywhere else.
How much Markdown do you actually need to learn?
Six things. Genuinely.
- Hash for headings. One hash is the biggest, six is the smallest.
- Asterisks for emphasis. One either side for italic, two for bold.
- Hyphen for bullets. A number and a dot for ordered lists.
- Square brackets then parentheses for links. Text in the brackets, URL in the parentheses.
- Backticks for code. One for inline, three on their own line to open and close a block.
- A blank line between paragraphs. The one people miss, and the cause of more mangled output than everything else combined.
Tables, footnotes and task lists are worth learning when you need them, and the cheatsheet has each one with an example. If you want to see the rendered output while you type, our free Markdown editor shows both panes side by side and runs entirely in your browser.
When should you use HTML instead?
When you need something Markdown deliberately does not do. Reach for HTML when you need:
- An attribute on an element, such as a class, an ID, or a target on a link
- A table cell spanning multiple columns or rows
- A specific image width or alignment
- A form, an embed, or anything interactive
Most processors let raw HTML pass straight through, though some platforms sanitise it out, so it may vanish on a comment form. And Markdown syntax generally stops working inside an HTML block, so do not expect asterisks to bold anything once you are inside a div.
MDN Web Docs wrote the rule down. Their writing guidelines name GitHub Flavored Markdown as the baseline and switch to HTML for tables GFM cannot express, or when the Markdown version of a table would run wider than 150 characters. Their principle: use the GFM syntax when you can, and fall back to raw HTML when you have to or when HTML is more readable.
Can you put diagrams and maths in Markdown?
On some platforms, yes. Neither is Markdown. Both are extensions layered on top by particular renderers.
Maths is usually LaTeX syntax, inline between dollar signs or as a block between double dollar signs. A plain CommonMark renderer will show you the dollar signs and the raw backslash commands. Diagrams are usually Mermaid, written inside a fenced code block tagged mermaid. Where it isn't supported, it renders as a code block showing the diagram's source.
For anything that must render everywhere, export an image, and write alt text for it.
Is it safe to render Markdown other people wrote?
Not on its own, no. Markdown passes raw HTML straight through. The CommonMark spec defines an HTML block as lines "treated as raw HTML (and will not be escaped in HTML output)". When the Markdown came from someone else, a script tag in their input becomes a script tag in your page.
If you render Markdown from users, do one of these:
- Turn on your parser's safe mode where it has one. It escapes or strips raw HTML, and usually blocks link URLs that do not match an allowlist of schemes.
- Or sanitise the HTML output afterwards with a dedicated sanitiser, rather than trying to filter the Markdown source with regular expressions.
Doesn't GitHub Flavored Markdown filter dangerous tags?
It filters nine of them, which is far less protection than it sounds. The GitHub Flavored Markdown Spec defines five extensions on top of CommonMark: tables, task list items, strikethrough, autolinks and Disallowed Raw HTML. That last one covers title, textarea, style, xmp, iframe, noembed, noframes, script and plaintext, replacing the leading < with < so the tag prints as text.
The spec's reason is that these tags change how the HTML around them is interpreted, not security. An onerror attribute or a javascript: URL is not filtered at all, so treat it as a parsing fix, not a sanitiser.
Does your Markdown produce accessible HTML?
Only if you write it carefully. Markdown compiles to HTML, so whatever you type becomes the structure a screen reader navigates.
Are you using headings for structure or just for size?
Picking ### because ## looked too big breaks the document outline. The W3C's page structure tutorial says to "nest headings by their rank (or level)" and that "skipping heading ranks can be confusing and should be avoided where possible," for example an h2 followed directly by an h4. In Markdown terms: don't jump from ## to ####.
This sits under WCAG 2.2 Success Criterion 1.3.1, Info and Relationships, at Level A. Pick the level by the outline, not the size, and use one # per document.
What else breaks accessibility in Markdown?
- Empty alt text on images. In
the bracketed part is the alt text.ships an image with nothing to announce. Leave it empty only when the image is purely decorative. - Link text that says nothing.
[click here](url)is useless when a screen reader lists every link out of context. Put the destination in the text:[the CommonMark spec](url). - Tables without header rows. A Markdown table needs the
---separator line to produce real headers. Skip it and you don't get a table at all, just a paragraph with pipe characters in it.
What trips people up most often?
Missing blank lines. Markdown uses blank lines to separate blocks. Two paragraphs on consecutive lines become one paragraph.
Inconsistent list indentation. CommonMark sets the indent a sublist needs at the width of the parent marker plus the spaces after it: 2 for - , 3 for 1. . Two spaces is enough to nest under a bullet, but under 1. it leaves the sub-item flat, because you need three.
Trailing whitespace as a line break. Two spaces at the end of a line means a line break in most flavours. It is invisible and editors strip it.
Where should you break lines in the source?
Wherever suits you. The CommonMark specification says a soft line break may be rendered "either as a line ending or as a space", and "the result will be the same in browsers". So choose the shape that helps the diff. With one sentence per line, changing a sentence shows as one changed line in version control, instead of the whole paragraph. Our text diff tool shows the difference on your own writing.
Why did your list suddenly get extra spacing?
Because you put a blank line in it. CommonMark calls a list loose if any of its items are separated by blank lines, otherwise tight, and "paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not." Those tags bring your paragraph margins with them, and one blank line changes the whole list, not one item.
Does Markdown work properly in Chinese, Japanese and Korean?
Mostly, but bold and italic break in one specific way. Put punctuation inside the emphasis and it silently stops working:
**テスト。**テスト does not render as bold
**テスト**。テスト renders fine
The cause sits in how CommonMark decides whether a run of asterisks can close emphasis. A right-flanking delimiter run is one that is "(1) not preceded by Unicode whitespace, and either (2a) not preceded by a Unicode punctuation character, or (2b) preceded by a Unicode punctuation character and followed by Unicode whitespace or a Unicode punctuation character."
In the failing line the closing asterisks follow a full-width full stop, so 2a is out. They are followed by another character, because Japanese doesn't put spaces between words, so 2b fails too. English rarely hits this because a space usually follows the closing asterisks. This is a known open issue on the CommonMark spec's tracker, discussed since 2020.
The reliable fix: move the punctuation outside the markers. Where it has to be exact, a literal <strong> tag has no flanking rules to satisfy.
Can you get a tool to fix your Markdown for you?
A linter tells you what is wrong. The standard one is markdownlint, which ships 53 rules numbered MD001 to MD060 with a few gaps. Trailing spaces are MD009, which by default lets exactly two through, because that's the line break. Bullet sublist indentation is MD007. Mixing hyphens and asterisks for bullets is MD004. Skipping from an H2 to an H4 is MD001.
A formatter just rewrites the file. Prettier normalises emphasis markers, list indentation and spacing on save, and Prettier 3.9 moved its Markdown parser to micromark v4 to improve CommonMark and GFM compliance.
For one-off writing, paste into our free Markdown editor and watch the preview. If you are assembling a wider toolkit, our guide to online developer tools and the free tools for developers roundup cover what else is worth bookmarking.
How do you get Markdown out into Word or PDF?
With pandoc, in one command. Pandoc describes itself as a universal document converter. It's free software under the GPL, reads CommonMark and GitHub Flavored Markdown, and writes Word docx, PDF, HTML5, LaTeX, EPUB, RTF and PowerPoint, among others.
- PDF needs a separate engine. Pandoc routes PDF through LaTeX or another engine, so PDF output fails until you install one.
- Word out is reliable, Word in is messy. Word carries styling and tracked changes that Markdown has no concept of, so expect to clean up a docx converted back to Markdown.
- Use a reference document for house styles. Hand pandoc an existing .docx and it takes its styles from that.
Pandoc's own Markdown has extensions plain CommonMark does not, so if the file has to work in more than one place, stay near the common core.
Why does AI chat output break when you paste it somewhere else?
Because the model wrote Markdown and you pasted it somewhere that does not render Markdown, or renders a different flavour. Chat assistants usually emit headings, bold, bullet lists and fenced code. Copy it out of the chat window and the raw text is all you get.
It survives anywhere that speaks CommonMark or GFM, including our Markdown editor, and breaks in plain-text fields such as an email body. In Google Docs, switch on Tools > Preferences > Enable Markdown and then use Paste from Markdown.
Slack is the one that catches people. Its formatting documentation says mrkdwn is "inspired by markdown, but uses different rules":
- Bold is
*bold*in Slack, not**bold**. - Strikethrough is
~strike~, not~~strike~~. - Links are
<url|text>, not[text](url).
The easiest fix is to ask the model for the format you need, such as "format that for Slack" or "give me that as plain text".
Why are AI tools asking for Markdown files now?
Because Markdown became the usual way to hand instructions to an AI model. These files usually aren't rendered at all: a model reads the raw text, so the question is whether the structure is clear.
What is an AGENTS.md file?
It's a README written for coding agents. The AGENTS.md project describes it as "a simple, open format for guiding coding agents" used by over 60,000 open-source projects. You put it in the root of your repository with install commands, how to run the tests and code style rules. There are no required fields, because "AGENTS.md is just standard Markdown".
In a monorepo, agents use the nearest AGENTS.md. Short and specific beats long and vague: "Run pnpm test before committing" is an instruction, "Please maintain high code quality" is noise.
What is llms.txt, and does your site need one?
llms.txt is the website version: a proposal by Jeremy Howard, first published in September 2024, to put a Markdown file at /llms.txt that tells an AI agent what your site is and where the useful pages are. Unlike AGENTS.md, it has a fixed shape so it can be parsed with ordinary code: a required H1 with the site name, a blockquote summary, then H2 sections holding lists of [name](url) links.
A skipped heading level or a broken link can stop a parser finding your sections, so lint it like code. You can draft one in our Markdown editor and check the heading structure before you publish it.
What else do people ask about Markdown?
Is Markdown a single standard?
No. RFC 7763, which registered the text/markdown media type with the IETF in March 2016, describes Markdown as a family of related plain-text formatting syntaxes rather than one language. Treat Markdown as a family and check which one your platform speaks.
Why does my Markdown look different on different sites?
Because implementations genuinely disagree. The CommonMark specification says John Gruber's original description does not specify the syntax unambiguously and notes that implementations have diverged considerably.
What is the difference between CommonMark and GitHub Flavored Markdown?
CommonMark is the strict base specification. GitHub Flavored Markdown is CommonMark plus extras: tables, strikethrough, task lists and autolinked URLs. A table in plain CommonMark will not render.
When should you use HTML instead of Markdown?
When you need control Markdown does not offer: specific attributes, classes, colspan in a table, or precise image sizing. Most Markdown processors let you drop raw HTML inline for the rest, though some sanitise it away.
Do you need to learn Markdown to use it?
Barely. Six pieces of syntax cover almost everything: hash for headings, asterisks for emphasis, hyphen for bullets, square brackets and parentheses for links, backticks for code, and a blank line between paragraphs.
Sources: IETF RFC 7763 and RFC 7764, Sean Leonard, March 2016. CommonMark Specification 0.31.2, John MacFarlane, 28 January 2024. GitHub Flavored Markdown Spec 0.29-gfm, 6 April 2019. GitHub Docs, Basic writing and formatting syntax. Mozilla, Markdown in MDN. W3C WAI headings tutorial and WCAG 2.2 Understanding 1.3.1. Pandoc documentation. Specifications and software are living things, so check the current version before relying on a detail.