HTML Entity for Horizontal Bar (―)

Beginner
5 min read
Updated: Sep 2026
1 example
Unicode U+2015

What Is Horizontal Bar?

Horizontal bar (―) is the Unicode character at U+2015 in General Punctuation. Official name: HORIZONTAL BAR. It is a long dash used as a text separator or quotation dash — similar in length to an em dash, but a distinct character.

Remember
Character     ―
Unicode       U+2015
Named entity  ―
Hex entity    ―
Decimal       ―
CSS escape    \2015
Meaning       long horizontal separator / quotation dash
Not the same  — (—) · – (–) · ‐ (‐)

Prefer ― in HTML. Hex ―, decimal ―, or typing ― in UTF-8 also work. For common English sentence breaks, — is usually the better default.

Quick Reference

One table for every form you will actually use.

FormCodeWhere it goes
Named entity―HTML markup (preferred)
Hex entity―HTML markup
Decimal entity―HTML markup
Direct character―HTML text (UTF-8)
CSS escape\2015Stylesheet content

When to Use Which

SituationUse
Long separator / quotation-dash style break― plus nearby prose when needed
Sentence aside / abrupt pause (common English prose)Em dash — — (—)
Number or date rangesEn dash — – (–)
Figure / tabular dashFigure dash — ‒ (‒)
Compound words / soft hyphenation contextsHyphen — ‐ / -
Generated text via ::before / ::aftercontent: "\2015"

Live Preview

Symbol alone, in a sample line, and next to related dashes.

Glyph ―
Large glyph ―
Sample Part A ― Part B
Compared ―   —   –   ‐   -
With entities Named: ― | Hex: ― | Decimal: ―

Complete HTML Example

One page that shows horizontal bar with named, hex, decimal, CSS escape, and a typed character. Use View Output or open the live editor.

Named + Hex + Decimal + CSS + Typed

Five ways to display ― in HTML and CSS.

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Horizontal Bar (U+2015) in HTML</title>
  <style>
    #point::after {
      content: "\2015";
    }
  </style>
</head>
<body>
  <p>Built with Named: &horbar;</p>
  <p>Built with Hex: &#x2015;</p>
  <p>Built with Decimal: &#8213;</p>
  <p id="point">Built with CSS: </p>
  <p>Typed: ―</p>
  <p>Section: Chapter 1 &horbar; Chapter 2</p>
  <p>Em dash: &mdash;</p>
</body>
</html>
Try It Yourself

How It Works

1. Named: &horbar; is the preferred HTML form for U+2015 → ―.

2. Hex / decimal: &#x2015; and &#8213; insert the same code point. Same visual as named.

3. CSS: use \2015 in content (not an HTML entity). #point::after appends ―.

4. Typed: paste ― in a UTF-8 document when you need this dash. Choose &mdash; instead when you want a standard English em-dash break.

Pitfalls & Tips

Common mistakes when working with horizontal bar.

Name

Prefer &horbar;

HTML5 defines &horbar; for U+2015. Prefer it over inventing names. Hex and decimal still work when needed.

—

Not the em dash

&mdash; is — (U+2014). Horizontal bar is ―. Related long dashes — different code points and typical editorial use.

–

Not the en dash

&ndash; is – (U+2013). Use it for ranges (2010–2020). Horizontal bar is longer and meant for separators.

-

Not a hyphen or minus

ASCII - and &dash; (‐) are hyphen forms. &minus; is the math minus. Do not swap them for ―.

Font

Font coverage

Some fonts render ― similarly to —. If you need a clear distinction, check the font’s General Punctuation coverage.

CSS vs HTML

Do not mix escapes

\2015 belongs in CSS strings. &horbar; / &#x2015; / &#8213; belong in HTML.

Semicolon

End references

Always finish entities with ; — write &horbar;, not &horbar.

Browser Support

Horizontal bar (U+2015) and its entity forms (&horbar;, &#x2015;, &#8213;, CSS \\2015) are supported in all mainstream browsers. Visible glyphs depend on General Punctuation font coverage.

✓ Universal support

Horizontal Bar (&#x2015;)

Encode with named, hex, decimal, CSS escape, or type the character — same code point everywhere encoding is supported.

100% Browser coverage
Google Chrome Supported
Yes
Microsoft Edge Supported
Yes
Mozilla Firefox Supported
Yes
Apple Safari Supported
Yes
Opera Supported
Yes
Internet Explorer All versions
Yes
U+2015 Full support

Bottom line: Prefer &horbar; in HTML. Use &#x2015; / &#8213; when numeric form is required, and \\2015 only inside CSS content.

Key Takeaways

  • Unicode: horizontal bar is U+2015 (decimal 8213) — glyph ―.
  • HTML: prefer &horbar; — also &#x2015; / &#8213; / type ―.
  • CSS: use \2015 inside content for generated text.
  • Meaning: ― ≠ &mdash; / &ndash; / hyphen — use for long separators.

One line: U+2015 → &horbar; / &#x2015; / &#8213; / CSS \2015.

Frequently Asked Questions

Use &horbar; (named), &#x2015; (hex), &#8213; (decimal), type ― directly in UTF-8, or the CSS escape \2015 in content. Prefer &horbar; in normal HTML.
U+2015 (HORIZONTAL BAR). Hex 2015, decimal 8213. It belongs to the General Punctuation block (U+2000–U+206F).
Yes. Use &horbar; — the preferred form in HTML markup. Numeric forms &#8213; and &#x2015; also work.
Use it for a long horizontal separator or quotation-dash style break. For sentence asides in English prose, &mdash; is more common. For ranges, prefer &ndash;. For compound words, prefer a hyphen.
HTML entities (&horbar;, &#8213;, or &#x2015;) go in markup. The CSS escape \2015 goes in stylesheet strings (usually content on ::before/::after).
No. Horizontal bar is U+2015 (― / &horbar;). Em dash is U+2014 (— / &mdash;). En dash is U+2013 (– / &ndash;). Hyphen is U+2010 (‐ / &dash;) or ASCII -. Related dashes — different lengths and typical uses.

Did you know?

Horizontal bar is Unicode U+2015 (decimal 8213) — glyph ― in General Punctuation (official name HORIZONTAL BAR). HTML5 names it &horbar;. Prefer &horbar; in markup. It is often used as a quotation dash or long separator and is not the em dash &mdash; (—), en dash &ndash; (–), or hyphen &dash; (‐).

Next: Horizontal Ellipsis

Learn the HTML entity for horizontal ellipsis (U+2026).

Horizontal ellipsis tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful