Skip to content
FeaturesPricingBlogDownload
Home / Markdown syntax / Markdown headings

Markdown headings

A Markdown heading is a line that starts with one to six # signs followed by a space. One # makes the largest heading (H1) and six make the smallest (H6). This style is called an ATX heading in the CommonMark spec, and it works the same way in GitHub, VS Code and other Markdown editors.

# Project plan
## Goals
### Phase one
#### Tasks
##### Notes
###### Smallest heading

Do you need a space after the # sign?

Yes. CommonMark requires at least one space or tab between the # signs and the heading text, so #Title stays a plain paragraph. The original 2004 Markdown accepted #Title, which is why some older files look different in current apps.

Other rules from the CommonMark spec:

  • Seven or more # signs are not a heading. ####### Text renders as plain text.
  • Up to three spaces of indentation are allowed before the #. Four spaces turn the line into an indented code block.
  • Closing # signs are optional and ignored, so ## Goals ## is the same as ## Goals.
  • A # heading fits on one line. Text on the next line starts a new paragraph.
  • A heading does not need a blank line above or below it, but adding one keeps the source readable and avoids surprises in older converters.

What is the underline heading style?

You can also underline a line with = signs for H1 or - signs for H2. CommonMark calls these setext headings. They only cover two levels, so most people use # for every level and keep one style throughout a file.

Project plan
============

Goals
-----

The underline can be any length. One side effect catches people: a line of --- directly under a paragraph turns that paragraph into an H2 instead of drawing a horizontal rule. Leave a blank line above --- when you want a rule.

How should you structure headings?

Use one H1 for the document title, H2 for its sections and H3 for subsections inside them. Skipping from H2 to H4 still renders, but screen readers and generated tables of contents use the levels to describe the outline, so a skipped level reads like a missing section.

Keep heading text short and specific. Headings are what readers scan first and what a table of contents lists.

How do you link to a heading?

Link to the heading's anchor with # in the URL. Neither CommonMark nor GitHub Flavored Markdown (GFM) defines heading anchors; the app that renders the file creates them. GitHub lowercases the text, replaces spaces with hyphens, removes other punctuation, and adds -1, -2 and so on to repeated headings (GitHub Docs, checked November 2026).

## Setup guide

See the [setup guide](#setup-guide) before you start.

Other renderers can build anchors differently, so test heading links in the app your readers will use. The links page covers the link syntax itself.

How do you start a line with # without making a heading?

Put a backslash in front: \# not a heading. Because CommonMark needs a space after #, a hashtag such as #todo at the start of a line is already plain text. The full list of characters you can escape is on the escape characters page.

Headings in Noteline

Noteline shows headings at their size as you type and hides the # signs until the cursor reaches them. In the desktop app, the Format menu sets Heading 1 to Heading 3 with Cmd+1 to Cmd+3 on a Mac and Ctrl+1 to Ctrl+3 on Windows and Linux, and Cmd+Shift+O (Ctrl+Shift+O) opens a Table of Contents panel built from the note's headings. The file still stores plain # headings, so it reads the same in any other Markdown app.

Common questions

How many heading levels does Markdown have?

Six, from # for H1 to ###### for H6. The underline style only produces H1 and H2.

Why does my heading show the # signs?

Check for a missing space after the # signs, four or more spaces of indentation, or more than six # signs. Any of these makes the line plain text or code.

Can a heading contain bold text, links or code?

Yes. Inline formatting works inside heading text, for example ## The **main** idea or ## Using `git log` . Most renderers already show headings in bold, so bold inside a heading adds little.

Noteline

Download Noteline↓See pricing→

Related

  • Markdown links
  • Markdown escape characters
  • Live preview
  • Bold, italic and strikethrough
  • Markdown for beginners: the 15-minute guide
  • Markdown syntax

A Markdown note editor with everything you need

We’re listening

Tell us what you need or what gets in your way. If something isn’t working, write to us any time.

contact@noteline.io→

Product

  • Download
  • Pricing
  • Features
  • Changelog

Learn

  • Markdown syntax
  • Use cases
  • Blog

Compare

  • vs Obsidian
  • vs Notion

Support

  • Help
  • Support
  • Privacy
  • Terms

© 2026 Notelinecontact@noteline.io