Skip to main content
HomeBlogMarkdown Horizontal Line: Dividers, Rules, and Common Fixes

Markdown Horizontal Line: Dividers, Rules, and Common Fixes

Create a Markdown horizontal line with ---, ***, or ___. Learn why a divider becomes a heading, how indentation changes it, and when to use a line break.

Published:

To add a horizontal line in Markdown, put three hyphens on their own line, with a blank line above and below:

End of the first section.

---

Start of the next section.

The result is a divider between two paragraphs. Markdown calls it a thematic break; HTML represents it with <hr>. Paste the example into the Markdown viewer to check the rendered document.

Three ways to write a divider

These forms all produce a thematic break:

Markdown source Result
--- Horizontal rule
*** Horizontal rule
___ Horizontal rule
* * * Horizontal rule

Use at least three matching hyphens, asterisks, or underscores. Spaces between the markers are allowed. Mixing marker types, adding text to the same line, or using only two markers does not create a rule. These are syntax rules from CommonMark's thematic break specification.

The number of hyphens does not control the line's visual width. A line of 20 hyphens and a line of three both produce the same HTML element; the destination's styling determines its appearance.

Why did my horizontal line turn into a heading?

This source does not place a divider below “Release notes”:

Release notes
---

It creates a level-two heading. Hyphens directly below paragraph text can form a Setext heading, and that interpretation takes precedence over a horizontal rule. Add a blank line to separate the two:

Release notes

---

For a document section, an explicit heading is often clearer:

## Release notes

The import workflow now accepts CSV files.

Use Markdown headings to label sections. Use a horizontal rule when the transition itself matters, such as separating a letter from an appendix.

Why is the divider showing as plain text?

Check the source around the rule:

Symptom Likely cause Fix
The preview shows --- in a code block Four spaces at the start of a standalone block, or an open code fence Remove the indentation or close the code fence
The preview shows -- Only two hyphens Use three or more
Text appears beside the markers The line contains other text Put the markers on their own line
The line displays as --- inside a sentence Markers are inside backticks Remove backticks when you intend a divider
The previous paragraph becomes a heading No blank line above --- Insert a blank line

At the document's top level, up to three leading spaces are allowed for a thematic break. Within lists, indentation also determines which item owns the content, so check the surrounding list rather than removing every space.

A horizontal line is different from a line break

A divider separates sections. It does not simply move the following words to a new line.

For an address, use a hard line break:

120 Market Street\
San Francisco, CA

For a new paragraph, leave an empty line. For a section divider, use --- on a separate line. The Markdown line break guide explains trailing spaces, backslashes, and GitHub's different newline behavior in files and comments.

Put a divider inside a blockquote

Keep the > prefix on each line, including the divider and the empty lines:

> Original proposal.
>
> ---
>
> Additional context from the reviewer.

The divider stays inside the quotation. Removing the > from the rule can end the quote and move the divider to the outer document. See the blockquote examples for multiple paragraphs and nested quotes.

A table separator is not a horizontal rule

This line belongs to a table:

| Format | Editable |
| --- | :---: |
| Markdown | Yes |

The pipes and optional colons describe the columns. They do not insert a page-wide divider. Use the Markdown table generator to create a table, or the CSV to Markdown converter when the data already exists in a spreadsheet.

Horizontal rules and exported documents

A thematic break is not a page-break command. A PDF or Word exporter decides where pages end based on its layout and pagination rules. Do not add extra hyphens expecting the following section to start on a new page.

For a web page whose CSS you control, the generated <hr> can be styled in the site's stylesheet. A hosted Markdown service may not permit custom CSS. Check the final destination or exported document, especially if the divider carries meaning that must survive printing.

Frequently asked questions

Do I need blank lines around a horizontal rule?

CommonMark does not require them in every context, but using them avoids the common --- heading ambiguity and makes source files easier to read.

Can I use an HTML hr tag?

<hr> works in renderers that permit raw HTML. Markdown's --- is more suitable for a Markdown document. The MD File Viewer editor removes user-supplied HTML tags, while the Markdown divider syntax renders normally.

How do I show three hyphens without creating a divider?

For a syntax example, write inline code: `---`. For ordinary text on a standalone line, escape the first hyphen: \---.

For other common formatting patterns, keep the Markdown cheat sheet nearby.

Try it in your browser

Open the homepage editor to view, edit, and export Markdown instantly — no install required.

More articles

Markdown Horizontal Line: Dividers, Rules, and Common Fixes | MD File Viewer