Blog

How to Underline in Markdown

The complete guide to underlines in markdown. Learn how to underline words and format underlines in markdown so everything displays correctly after publishing.

Benjamin McBrayer // Published: May 11, 20265 min read

Unlike bold and italic formatting, there is no native markdown underline syntax built into the language. Markdown was designed to map closely to HTML, and since underlined text is easily confused with hyperlinks on the web, the creators intentionally left it out.

That does not mean you are out of luck. There are several reliable ways to underline in markdown depending on the platform you are using and how much control you have over the rendered output.

This guide walks through every method so you can underline markdown text in any situation.

Why Markdown Has No Underline Syntax

Markdown was created by John Gruber in 2004 as a simple way to write content that converts cleanly to HTML. Bold uses double asterisks, italic uses single asterisks, and strikethrough uses tildes in some flavors. But underline was deliberately excluded.

The reasoning is practical. On the web, underlined text almost always signals a clickable link. If markdown allowed native underlining, readers would constantly mistake underlined words for hyperlinks, creating a confusing experience. Most style guides for web content also discourage underlining for this same reason.

Still, there are legitimate cases where you need to underline text in markdown, such as academic writing, formal documents, or platforms where links are styled differently.

How to Underline in Markdown Using HTML

The most widely supported method to underline markdown text is to use the HTML <u> tag directly:

This is <u>underlined text</u> in a sentence.

This renders as: This is underlined text in a sentence.

Since most markdown parsers allow inline HTML, this approach works on GitHub, GitLab, Jupyter Notebooks, and many static site generators. It is the most straightforward answer for anyone searching for ways to create markdown underline syntax, even though it technically uses HTML rather than pure markdown.

When the <u> Tag Might Not Work

Some platforms strip out HTML tags for security reasons. Discord, Slack, and certain CMS editors will ignore or remove <u> tags entirely. If you are working in one of these environments, you will need a different approach.

Using CSS to Underline Text in Markdown

If you have access to custom styles, CSS gives you the most flexibility. You can use a <span> tag with an inline style:

This is <span style="text-decoration: underline;">underlined text</span> in a sentence.

Alternatively, if you control the stylesheet for your site or documentation, you can define a custom class:

.underline {
  text-decoration: underline;
}

Then use it in your markdown:

This is <span class="underline">underlined text</span> in a sentence.

This method is ideal for blogs, documentation sites, and any environment where you manage the CSS. It keeps your markdown cleaner than inline styles and gives you consistent formatting across the entire project.

Markdown Underline in Specific Platforms

Different platforms handle underline formatting in their own ways. Here is how to approach it in the most common environments.

GitHub

GitHub Flavored Markdown supports inline HTML, so the <u> tag works in README files, issues, pull request descriptions, and comments. This makes it the easiest markdown underline method for GitHub users.

Jupyter Notebooks

Jupyter renders markdown cells with full HTML support. Both the <u> tag and CSS-based approaches work reliably. You can also use the <ins> tag, which semantically represents inserted text but renders with an underline by default:

This is <ins>underlined text</ins> in a notebook.

Discord and Slack

Neither Discord nor Slack supports underline markdown natively. Discord uses its own variation of markdown, but it does not include any underline syntax. Slack uses its own formatting system entirely. In both cases, there is no workaround within the messaging input itself.

Obsidian and Note-Taking Apps

Some note-taking apps like Obsidian support custom CSS snippets. If your app allows it, you can define an underline class in your CSS and reference it in your notes. Check your specific app's documentation for details on enabling custom styles.

Using the <ins> Tag as an Alternative

The <ins> tag is an HTML element that represents text that has been inserted into a document. Browsers render it with an underline by default, making it a semantic alternative to the <u> tag:

The meeting is on <ins>Thursday</ins>, not Wednesday.

The difference between <u> and <ins> is mostly about meaning. Use <u> when you simply want visual underlining. Use <ins> when you want to indicate that text has been added or changed, such as in a revision or edit history.

Both tags produce the same visual result in most markdown parsers that support HTML.

Workarounds When HTML Is Not Supported

If you are working on a platform that strips HTML tags and has no underline support, your options are limited. Here are some common workarounds people use:

Fake underlining with Unicode characters. You can use Unicode combining characters to simulate an underline, but this is unreliable across fonts and platforms and generally not recommended.

Use bold or italic instead. If the goal is simply to draw attention to specific text, bold or italic formatting may serve the same purpose without the need for underlining.

Add a note in parentheses. In plain text environments, some writers indicate emphasis by adding a note like "(emphasis mine)" after the relevant text.

None of these are true substitutes for markdown underline text, but they can help in constrained environments.

Quick Reference

Here is a summary of every method to underline text in markdown:

  • <u>text</u> is the simplest and most widely supported method.
  • <ins>text</ins> is a semantic alternative that also renders as underlined.
  • CSS with <span> tags gives the most control when you manage the stylesheet.
  • No native markdown underline syntax exists, so all methods rely on HTML or platform-specific features.
  • GitHub and Jupyter support HTML-based underlining.
  • Discord and Slack do not support any form of underline formatting.

Final Thoughts

The lack of a built-in markdown underline syntax is a deliberate design choice, not an oversight. For most web content, avoiding underlines keeps your text clear and prevents confusion with links. But when you do need to underline text in markdown, the <u> tag is the fastest and most portable solution. Choose the method that fits your platform, keep readability in mind, and your documents will look exactly the way you intend.