Headers are the backbone of document structure in Markdown. They create hierarchy, improve readability, and help organize your content.
Markdown uses the #
symbol to create headers. The number of #
symbols determines the header level:
# Header 1 (Largest)
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6 (Smallest)
For H1 and H2, you can also use underlines:
# Header 1
## Header 2
Note: Most people prefer the
#
syntax because it's more explicit and supports all six levels.
Always follow a logical structure:
✅ Good structure:
# Main Title
## Section
### Subsection
#### Sub-subsection
# Another Main Section
## Another Section
❌ Poor structure:
# Main Title
### Skipped H2 - confusing!
##### Skipped H4 - also confusing!
Add consistent spacing around headers:
Previous paragraph content.
## New Section Header
First paragraph of new section.
Make headers descriptive and scannable:
✅ Good:
## Installation Requirements
## Step-by-Step Setup Guide
## Troubleshooting Common Issues
❌ Vague:
## Setup
## How To
## Problems
Many Markdown processors automatically generate tables of contents from headers:
# Document Title
## Table of Contents
- [Introduction](#introduction)
- [Getting Started](#getting-started)
- [Advanced Features](#advanced-features)
## Introduction
Content here...
## Getting Started
Content here...
## Advanced Features
Content here...
Headers automatically become anchor links:
## My Section Header
Becomes accessible via:
https://example.com/page#my-section-header
Some processors support custom header IDs:
## My Header {#custom-id}
# API Documentation
## Authentication
### Bearer Tokens
### API Keys
## Endpoints
### User Management
#### Get User
#### Create User
#### Update User
#### Delete User
### Data Operations
#### Query Data
#### Insert Data
#### Update Data
## Error Handling
### HTTP Status Codes
### Error Response Format
# Complete React Tutorial
## Prerequisites
### Node.js Installation
### Code Editor Setup
## Getting Started
### Creating Your First App
### Understanding Components
## Core Concepts
### State Management
### Props and Data Flow
### Event Handling
## Advanced Topics
### Hooks
### Context API
### Performance Optimization
## Deployment
### Build Process
### Hosting Options
# The Ultimate Guide to Remote Work
## Introduction
## The Remote Work Revolution
### Statistics and Trends
### Benefits for Companies
### Benefits for Employees
## Setting Up Your Home Office
### Essential Equipment
### Ergonomic Considerations
### Creating Boundaries
## Productivity Strategies
### Time Management
### Communication Tools
### Avoiding Distractions
## Challenges and Solutions
### Isolation and Loneliness
### Work-Life Balance
### Technical Issues
## Conclusion
Combine headers with other formatting:
## 🚀 **Getting Started** with Markdown
### ⚠️ Important: Prerequisites
#### 💡 Pro Tip: Best Practices
For very long headers, consider breaking them:
❌ Too long:
## How to Set Up a Complete Development Environment with Node.js, React, and All the Necessary Tools for Modern Web Development
✅ Better:
## Development Environment Setup
### Node.js and React Installation
### Essential Tools Configuration
Proper header structure helps with search engine optimization:
Headers help screen readers navigate content:
# Page Title (H1 - Main topic)
## Main Sections (H2 - Primary divisions)
### Subsections (H3 - Secondary divisions)
❌ Avoid:
# Introduction
# Getting Started
# Conclusion
✅ Better:
# Complete Guide to Markdown
## Introduction
## Getting Started
## Conclusion
❌ Avoid:
# Main Title
### Skipped H2
✅ Better:
# Main Title
## Section Title
### Subsection Title
❌ Don't use headers just for big text:
## This text just needs to be big
✅ Use headers for structure:
## Important Section
## 🎉 Celebration
Headers are your content's skeleton – use them wisely to create clear, navigable, and professional documents!