Skip to main content

Markdown Horizontal Rule

Three ways to draw a dividing line in Markdown — ---, ***, and ___ — with live examples and the one mistake that turns your line into a heading.

Jump to: Basic syntax · Variations · Common mistakes · Platform support · FAQ

Basic Syntax

Put three or more identical characters on their own line with a blank line before and after. All three produce the exact same <hr> HTML output.

Three hyphens (---) — most common

Markdown

Above the line

---

Below the line

Preview

Above the line


Below the line

Three asterisks (***)

Markdown

Above the line

***

Below the line

Preview

Above the line


Below the line

Three underscores (___)

Markdown

Above the line

___

Below the line

Preview

Above the line


Below the line

Variations That Also Work

You can use more than three characters, and spaces between them are allowed. As long as all characters are the same type, it is a valid horizontal rule.

Hyphens with spaces — also valid

Markdown

Above

- - -

Below

Preview

Above


Below

Many hyphens — also valid (minimum is 3)

Markdown

Above

----------

Below

Preview

Above


Below

Many asterisks with spaces — also valid

Markdown

Above

* * * * *

Below

Preview

Above


Below

Common Mistakes

The most common issue: forgetting the blank line before ---, which turns the preceding paragraph into a heading instead of creating a divider.

Mistake: no blank line before --- makes it a heading (Setext style)Incorrect

Markdown

Paragraph text
---
This looks like a horizontal rule but it's actually an H2 heading!

Preview

Paragraph text

This looks like a horizontal rule but it's actually an H2 heading!

Correct: blank line before and after ---Correct

Markdown

Paragraph text

---

This is a proper horizontal rule.

Preview

Paragraph text


This is a proper horizontal rule.

Mistake: only 2 hyphens — not a valid horizontal ruleIncorrect

Markdown

--

Not a horizontal rule — needs at least 3 characters.

Preview

--

Not a horizontal rule — needs at least 3 characters.

Quick Reference

SyntaxValid?Notes
---YesMost common — three hyphens
***YesThree asterisks
___YesThree underscores
- - -YesSpaces between characters allowed
------YesMore than 3 characters is fine
--NoMinimum is 3 characters
-*-NoCannot mix character types
Paragraph\n---NoNo blank line = Setext heading, not HR

Platform Support

Horizontal rules work in almost all Markdown environments. The main exception is Discord.

PlatformSupports ---?Notes
GitHubYesAll three variants work
VS Code previewYesAll three variants work
NotionYesUse --- in an empty line
ObsidianYesAll three variants work
SlackPartialRenders as text — use the divider block instead
DiscordNo--- renders as literal dashes, not a line
RedditYesHorizontal rule supported in new Reddit

Frequently Asked Questions

How do I add a horizontal line in Markdown?

Use three or more hyphens (---), asterisks (***), or underscores (___) on their own line. Always leave a blank line before the rule (otherwise --- is interpreted as a Setext-style heading underline).

What is the difference between ---, ***, and ___?

All three produce the same HTML output (<hr>) and render identically in most Markdown renderers. The choice is purely stylistic. Hyphens (---) are the most commonly used and least likely to be confused with bold/italic syntax.

Why is my --- creating a heading instead of a line?

If --- immediately follows a paragraph with no blank line between them, Markdown interprets it as a Setext-style H2 heading underline. Always add a blank line before your --- to ensure it renders as a horizontal rule.

What is the minimum number of characters for a horizontal rule?

Three. You can use exactly three (---) or more (------). Spaces between the characters are also allowed, so - - - and * * * are both valid. The characters must all be the same type on one line.

Can I mix hyphens, asterisks, and underscores on one line?

No. All characters on a horizontal rule line must be the same type. A line like -*- or --_ is not a valid horizontal rule and will be rendered as literal text.

Does a horizontal rule work on GitHub, Discord, and Notion?

Yes — all major Markdown platforms support horizontal rules using ---. GitHub Flavored Markdown, Notion, and most editors all support it. Discord does not support horizontal rules; they render as literal dashes.

What HTML does a Markdown horizontal rule produce?

Markdown renders a horizontal rule as <hr> in HTML. You can also write <hr> directly in your Markdown and it will work in most renderers. The visual appearance depends on the site's CSS.

Related Guides