Skip to content
Back to Journal
GuideMay 2, 2026·2 min read

How to Create Headings in Markdown

All six heading levels in markdown explained. Hash syntax, alternative syntax, and SEO best practices.

The quick answer: Start a line with one or more hash symbols (#) followed by a space and your heading text.

The Six Heading Levels

# Heading 1 — the largest, usually the page title (use once per document) ## Heading 2 — major sections ### Heading 3 — sub-sections #### Heading 4, ##### Heading 5, ###### Heading 6 — deeper levels (use sparingly)

The number of # symbols determines the heading level. H1 is the largest, H6 is the smallest.

The Space is Required

#Heading will not render as a heading. The space between the # and the heading text is required in CommonMark. Always write # Heading, not #Heading.

Alternative Syntax (Setext Style)

H1 and H2 can also be written by underlining with = or -: Heading 1 ========= Heading 2 ---------

This is the older Setext style. Most people use the # hash style today — it's clearer and supports all six levels.

Heading Anchors

Every heading automatically gets an anchor ID for internal linking. ## Getting Started gets the anchor #getting-started. Use this in links: [Go to Getting Started](#getting-started).

Need to generate a full table of contents from your headings? Try the free TOC generator.

Best Practices

  • Use only one H1 per document (the main title)
  • Don't skip levels — go H2 → H3, not H2 → H4
  • Keep headings short and descriptive — they appear in tables of contents and anchor links

Full reference: Markdown Headings.

MT

MarkdownTools Team

May 2, 2026

Try it free

Make your AI output beautiful

Paste markdown from ChatGPT or Claude. Pick a theme. Export as PDF or HTML in seconds.

Open App — It's Free