By Arthur Teboul//4 min read/Tutorial

How to Add a Horizontal Line in Markdown

Three syntaxes create a markdown horizontal line — also called a horizontal rule or divider — in any Markdown document. Type three hyphens (---), three asterisks (***), or three underscores (___) on their own line. All three produce the same visual output: a full-width line separating content sections. The rendered result is an HTML <hr> element regardless of which syntax you choose. MacMD Viewer, a native macOS Markdown viewer ($9.99, SwiftUI, 2 MB), renders horizontal lines with theme-aware styling — it does not require custom CSS or manual configuration.

TL;DR: Use --- (three hyphens) on its own line with blank lines above and below. It is the most common convention. All three syntaxes (---, ***, ___) render identically as a horizontal rule.

How Do You Create a Horizontal Line in Markdown?

The simplest way to add a markdown horizontal line is to type three hyphens on a line by themselves. Place a blank line before and after the hyphens to ensure every parser interprets them correctly. Here is the raw syntax:

First section of content.

---

Second section of content.

That --- renders as a full-width horizontal rule between the two paragraphs. The result is a clean visual break — identical to writing <hr> in raw HTML.

Markdown supports three equivalent syntaxes for the markdown horizontal line. Each one produces the same <hr> element in the rendered output:

Three syntaxes for creating a markdown horizontal line
SyntaxNameConvention
---Three hyphensMost common (GitHub, GFM default)
***Three asterisksSometimes used to match bold syntax
___Three underscoresLess common but equally valid

There are four rules to remember when writing a markdown horizontal line:

  • The syntax must appear on its own line with no other text.
  • A blank line must precede the markers. Without it, parsers may interpret --- as a Setext heading underline instead of a horizontal rule.
  • A blank line should follow the markers for consistent rendering.
  • You can use more than three characters. ----- and ********** both work. The minimum is three.

For a deeper understanding of the .md file format and all its syntax elements, see our guide on what is a .md file.

What Is the Difference Between ---, ***, and ___?

There is no visual difference. All three syntaxes render as an identical <hr> HTML element. The choice between them is purely a matter of stylistic convention and team preference.

The --- syntax dominates in GitHub Flavored Markdown repositories and has become the de facto standard. Many style guides and linters default to three hyphens. The *** variant occasionally appears in documents where authors prefer symmetry with the bold (**text**) syntax. The ___ form is the least common in practice but remains fully compliant with the CommonMark specification, which treats all three identically as thematic breaks.

The practical advice is straightforward: pick one syntax and use it consistently throughout your project. Most teams settle on --- because it requires the fewest keystrokes and reads cleanly in raw source files. The markdown horizontal line you choose is ultimately a stylistic decision with zero functional impact.

When Should You Use Horizontal Lines in Markdown?

Horizontal lines separate major sections within a document. They signal a clear shift in topic or context — a stronger visual break than a heading alone. The most common use cases include:

  • Dividing chapters or major topics in long-form documentation.
  • Separating a document body from a footer or appendix section.
  • Creating visual breathing room above and below important blockquotes.
  • Breaking topic changes in README files between installation, usage, and contribution sections.
  • Marking transitions in changelog entries or release notes between version blocks.

One caveat: overuse fragments your documents. Use sparingly. A markdown horizontal line works best as a deliberate separator for major transitions — not between every paragraph. If you find yourself adding one between every section, headings alone may serve the document structure better. The Markdown Guide recommends placing blank lines before and after for maximum compatibility across all parsers. For practical examples of well-structured Markdown documents, see our Markdown app roundup for Mac.

How Do Different Markdown Renderers Display Horizontal Lines?

Every standard Markdown renderer converts ---, ***, and ___ into an HTML <hr> element. The visual styling of that element varies by renderer and its CSS theme:

  • GitHub: A thin gray line with generous vertical padding above and below. Consistent across READMEs, issues, and wikis.
  • VS Code preview: A subtle, lightweight line that blends with the editor theme. Dark and light modes adjust the line color automatically.
  • MacMD Viewer: A styled horizontal rule that inherits the document theme. The markdown horizontal line matches the overall typography and color scheme of the rendered output.
  • Typora: Appearance depends on the active CSS theme. Each theme defines its own hr styling with different weights and colors.

The underlying HTML is always the same <hr> tag. Only the CSS differs. Every application applies its own stylesheet to the identical element, which means a horizontal rule that looks bold and dark in one theme may appear as a barely visible hairline in another. If you need consistent rendering across tools, rely on default styles and avoid inline HTML overrides. For a detailed comparison of Mac rendering tools, see our best Markdown viewer for Mac roundup or the comprehensive Markdown viewer for macOS guide. You can also check pricing for MacMD Viewer to see what is included.

Conclusion

Three hyphens on their own line with blank lines around them. That is the entire markdown horizontal line syntax. Pick ---, stay consistent, and your documents gain clean visual separators that every renderer understands. For a deeper look at the terminology and best practices, see our companion article on horizontal rules in Markdown.

To preview horizontal lines and all other Markdown formatting on Mac, try MacMD Viewer — a native SwiftUI viewer that renders horizontal rules, Mermaid diagrams, syntax highlighting, and tables of contents from any .md file. Check pricing to get started.

Frequently Asked Questions

What is the shortcut for a horizontal line in Markdown?

Type three hyphens (---) on their own line with blank lines before and after. There is no keyboard shortcut — it is a text syntax. Most writers memorize three hyphens because it is the fastest pattern to type.

Why doesn't my horizontal line render in Markdown?

Most likely you are missing a blank line before the ---. Without it, parsers interpret --- as a Setext-style heading underline for the preceding paragraph. Always add a blank line above the hyphens.

Is --- the same as <hr> in Markdown?

Yes. Markdown parsers convert --- (and *** and ___) to the HTML <hr> element. They are functionally identical. The Markdown syntax is simply a shorthand for the HTML horizontal rule tag.

Can I style a horizontal line in Markdown?

In standard Markdown, no. But in HTML-accepting renderers, you can use <hr style="border: 2px solid red">. In CSS-customizable viewers like MacMD Viewer, the hr element inherits the document theme automatically.

How many hyphens do I need for a horizontal line?

At least three (---). You can use more (------) and it renders the same way. Some writers use longer sequences for visual clarity in the raw source file, but the output is identical.

Ready to read Markdown beautifully?

Native macOS viewer with Mermaid diagrams, syntax highlighting, and QuickLook. Coming soon.

Continue reading with AI

Summarize in ChatGPT🔍Research in PerplexityAsk Google AI

Related Articles

Tutorial

Horizontal Rule in Markdown: Complete Guide (2026)

Horizontal rule markdown searches up 4,663% YoY (DataForSEO, 2026). Complete guide to thematic breaks — syntax variants, HTML output, styling, common mistakes.

Guide

What Is a .md File? Markdown Explained Simply (2026)

What is a .md file? It's a Markdown document — plain text with formatting symbols. Learn what .md means, why it exists, and 4 ways to view it properly.

Guide

How to View Markdown Files — Complete Guide (2026)

GitHub hosts 630M+ repos with Markdown files (2026). View .md files on Mac, Windows, Linux, web, and terminal — 10 tools compared with step-by-step setup.