← Back to blog/Guides

Markdown Horizontal Line: Syntax, Spacing, and Common Fixes

Create a Markdown divider, avoid accidental headings, and understand how blank lines and indentation change the result.

F
Faizan Khan
• 5 min read

To add a horizontal line in Markdown, put ---, ***, or ___ on a line by itself. Use a blank line before and after the divider to avoid ambiguity, especially with hyphens. The result is a thematic break, normally rendered as an HTML hr element rather than a row of printed characters.

Markdown
1The setup procedure ends here.
2
3---
4
5The next section covers recovery.

The meaningful HTML is:

HTML
1<p>The setup procedure ends here.</p>
2<hr />
3<p>The next section covers recovery.</p>

Choose a consistent divider syntax

These three forms have the same structural purpose:

SourceResultPractical consideration
---Thematic breakCan also underline a heading when directly below text
***Thematic breakAvoids the hyphen heading conflict
___Thematic breakCan be visually subtle in a source editor

More markers do not make a thicker line. Ten hyphens and three hyphens produce the same kind of element. Its appearance comes from the site's stylesheet.

Spaces between matching markers are also valid, such as * * *. Do not mix marker types: *-* is not a thematic break. The CommonMark thematic-break rules define the parser behavior; your site's styles determine the visible border, margins, and color.

For a team reference, choose one spelling and use it consistently. *** is a useful choice if authors frequently confuse dividers with heading underlines or frontmatter boundaries.

Why three hyphens sometimes create a heading

Compare these two inputs:

Markdown
1Recovery options
2---
HTML
1<h2>Recovery options</h2>

Without the blank line, the hyphens underline the preceding paragraph as a level-two Setext heading. This is not a broken divider. It is a different Markdown construct taking precedence.

Now separate the text from the hyphens:

Markdown
1Recovery options
2
3---
HTML
1<p>Recovery options</p>
2<hr />

A single soft newline is therefore not interchangeable with an empty line. For the related distinction between a paragraph and a hard break, use the Markdown line-break guide.

At the very start of a document, a pair of --- boundaries may instead be consumed as YAML frontmatter by the publishing system. Frontmatter is a processing convention, not a reason to place a decorative divider above the article's first paragraph.

Put a divider inside a quote or list deliberately

A divider inside a blockquote needs the quote prefix:

Markdown
1> Previous release behavior.
2>
3> ***
4>
5> Current release behavior.

The output contains an hr inside the blockquote. Without the > prefix, you can end the quote and create a page-level divider instead. See blockquote nesting when the quote also contains lists or multiple paragraphs.

For a divider belonging to a numbered step, align it with that item's text:

Markdown
11. Review the recovery options.
2
3 ***
4
5 Choose the option that preserves the required data.
62. Record the decision.

The three spaces correspond to the width of 1. in this example. Arbitrary indentation can move the divider outside the item or turn content into code. The list guide explains how the required offset changes with the marker width.

Fix a divider that does not appear

Start by distinguishing parsing from presentation. Inspect the rendered page or HTML before adding more punctuation.

SymptomLikely causeFix
The preceding text becomes largeHyphens formed a heading underlineInsert a blank line before the divider
Literal markers appear in a shaded boxThe source is in a code blockRemove the fence or unintended code indentation
Only two hyphens appearToo few markersUse at least three matching markers
A divider appears outside a stepContainer indentation is wrongAlign with the parent item's content
An hr exists but no line is visibleTheme CSS hides or restyles itAdjust the approved stylesheet, not the Markdown spelling

To show the syntax rather than render it, use inline code: ---. In a teaching example, a fenced block makes the intended whitespace easier to inspect than a series of escaped markers.

Use a thematic break for a real transition

A divider can separate a worked example from commentary or distinguish two phases of a procedure. It should not replace headings throughout a long article. A heading names the next subject and participates in document navigation; an hr only marks a transition.

For a troubleshooting article, prefer named sections such as "Check connectivity" and "Reset credentials" rather than six unlabeled horizontal lines. If readers need to navigate directly to those sections, build a table of contents.

FAQ

How many hyphens make a Markdown horizontal line?

Three or more matching hyphens can form a thematic break. Put them on their own line and separate them from preceding text with a blank line.

Can I change a Markdown divider's thickness?

Not with standard Markdown syntax. Thickness, width, color, and spacing belong to the renderer's CSS or supported theme settings.

Why does my divider turn text into a heading?

Hyphens directly below paragraph text can form a level-two Setext heading. Add a blank line or use three asterisks for the divider.

Continue This Guide