How to add headings in Markdown?

In Markdown, you add a heading using the hash symbol (#). Markdown supports six heading levels because, in HTML, there are six heading h1, h2, h3, h4, h5 and h6. The number of hash symbols corresponds to the heading number, which means to create an h1 heading, you have to use one hash symbol; for adding h3 heading, you use three hash symbols.

Markdown HTML Output
# I am a Heading level 1 <h1>I am a Heading level 1</h1>
## I am a Heading level 2 <h2>I am a Heading level 2</h2>
### I am a Heading level 3 <h3>I am a Heading level 3</h3>
#### I am a Heading level 4 <h4>I am a Heading level 4</h4>
##### I am a Heading level 5 <h5>I am a Heading level 5</h5>
###### I am a Heading level 6 <h6>I am a Heading level 6</h6>

In some text on other websites, you will find that a number sign is used instead of a hash symbol. It is valid to do this because the hash symbol is also known as the number sign. Don't get confused when you see the number sign.

What are the best practices of adding headings in Markdown?

It is necessary that a single space must follow hash symbols; otherwise, you won't be able to create a heading.

The correct way of adding heading Wrong-way of adding heading.
# This is a heading. #This is a heading.

What is the alternate syntax of adding headings in Markdown?

Markdown provides you with an alternate way of adding heading level 1 and level 2. Apart from using a single hash symbol, you can use any number of equal signs (=) to create heading level 1. Also, you can use any number of hyphens (-) for creating heading level 2.

Markdown HTML Output
I am a Heading level 1
==
<h1>It is Heading 1</h1>
I am a Heading level 2
--
<h2>I am a Heading 2</h2>