MD ViewerMD Viewer

100% private — everything runs in your browser

Markdown Underline

Standard Markdown has no underline marker — here is the working markdown underline recipe with the HTML u tag, a live preview, and a copyable example.

MD Viewer Team

Examples
Markdown source
Preview

Normal text and underlined text in one line.

Markdown underline is the request that reveals a gap in the language: there is no native underline syntax in Markdown. Asterisks give italic, double asterisks give bold, double tildes give strikethrough — but no character pair produces an underline. The markdown underline that works everywhere HTML is allowed is the u tag: <u>underlined text</u>. The playground above renders it live, safely, with the source on the left and the result on the right.

Because the markdown underline leans on HTML, two rules follow. First, the renderer must permit inline HTML — GitHub, GitLab, most documentation sites, and this page do; strict CommonMark sandboxes and some wikis do not. Second, the tag must be sanitized: this site whitelists the u tag specifically and strips every event handler and dangerous attribute from user markup, which is why you can experiment with a markdown underline here without risk.

A warning born of twenty years of habit: underlined text on the web reads as a link. Reserve the markdown underline for the few places it carries real meaning — Chinese proper nouns (where underline is a typographic convention), form labels on printed output, or traditional document styling — and prefer bold or italic for emphasis. The underline in markdown compatibility page covers renderers and fallbacks in depth; this page is the hands-on syntax demo.

Markdown underline syntax reference

You typeWhat you get
<u>text</u>An actual markdown underline via the u tag
**<u>bold underlined</u>**Bold and underline combined
_text_Italic — not an underline, a common mistake
__text__Bold — double underscores are emphasis, not underline
<ins>text</ins>Insert semantics; renders underlined in many renderers

How to underline text in Markdown

  1. 1

    Check that HTML is allowed

    The markdown underline needs a renderer that accepts inline HTML. Test with the playground above or a scratch file on your target platform before relying on it in production docs.

  2. 2

    Wrap the text in <u> tags

    Write <u> before the words and </u> after them. The markdown underline applies to exactly the enclosed span — the live preview shows the boundary as you edit.

  3. 3

    Combine with other emphasis

    The u tag composes with Markdown emphasis: **<u>bold underlined</u>** renders both. Keep the tags balanced, or the rest of the paragraph inherits the underline.

  4. 4

    Copy and verify elsewhere

    Copy Markdown gives you the exact source. Paste it into your README or issue and confirm the markdown underline renders — the underline in markdown page lists which platforms are safe bets.

Why there is no native markdown underline

John Gruber's original Markdown deliberately omitted an underline for a web-native reason: on web pages, underline means hyperlink. Adding underline text would have collided with the most important affordance in the medium — readers would click underlined words and find nothing. So Markdown shipped with emphasis (italic), strong emphasis (bold), and code, and the markdown underline has remained an HTML import ever since.

The gap shows up differently across writing cultures. In Chinese typography, underline marks proper nouns and is common enough that the markdown underline question recurs constantly; in legal and academic documents, underline survives as a heading style from print. Those are the legitimate uses. For plain emphasis in English web writing, bold and italic carry the meaning without confusing anyone — the markdown underline is best when underline itself is the message.

Practically, this page's engine treats the u tag as a whitelisted, sanitized element: it renders as a real markdown underline, while onclick handlers, style attributes, and scripts inside your markup are stripped before rendering. You get the typography without the XSS surface — which is the right trade for a public tool.

One more convention is worth knowing: in East Asian documents, the markdown underline frequently marks a book title where Western typography would use italics. If you maintain Chinese or Japanese documentation, a short <u>span</u> for titles is idiomatic and unambiguous — and it exports to PDF with the line intact on the convert md to pdf page.

Markdown underline mistakes

__underlined__

<u>underlined</u>

Double underscores produce bold text, not a markdown underline. There is no character-based underline syntax to fall back on.

<u onclick=…>

<u>plain tag</u>

Attributes like onclick are stripped by this page's sanitizer. A markdown underline needs only the bare tag — clean markup renders, dangerous markup does not.

Underlining for emphasis everywhere

Bold or italic for emphasis

On the web, underlined text reads as a link. Save the markdown underline for proper nouns and print-style documents; emphasize with bold or italic.

Underline and PDF export

The convert md to pdf page maps the markdown underline to true underlined PDF text. If your document mixes underline with links, both survive export — links stay blue and clickable, u spans stay plain and underlined.

Frequently asked questions

Sources and spec citations

“The <u> HTML element represents a span of inline text which should be rendered in such a way as to indicate that it has a non-textual annotation.”
MDN Web Docs — <u>: The Unarticulated Annotation element
“Markdown treats asterisks (*) and underscores (_) as indicators of emphasis.”
John Gruber, "Markdown: Syntax" (Daring Fireball, 2004)

Related Markdown tools