How can I underline text in Markdown?
9 Answers
Markdown syntax doesn't support underline text on its own. You should be able to use HTML tags with some caution (see linked documentation).
All this said ...
In GitHub markdown <ins>text</ins> works just fine.
10 Comments
<ins>text</ins> works fine in Jupyter notebooks too<u>. Here's a little more info: stackoverflow.com/a/66595330/4561887.Markdown doesn't have a defined syntax to underline text.
I guess this is because underlined text is hard to read, and that it's usually used for hyperlinks.
5 Comments
Another reason is that <u> tags are deprecated in XHTML and HTML5, so it would need to produce something like <span style="text-decoration:underline">this</span>. (IMHO, if <u> is deprecated, so should be <b> and <i>.) Note that Markdown produces <strong> and <em> instead of <b> and <i>, respectively, which explains the purpose of the text therein instead of its formatting. Formatting should be handled by stylesheets.
Update:
The <u> element is no longer deprecated in HTML5.
6 Comments
<u> is <ins>; that's never been deprecated.<u> is not particularly a semantic tag at all, while <ins> is. Yet they are traditionally rendered in the same way. So <ins> is the semantic analogue of <u>, while <u> is the syntactic analogue of <ins>. Well, even if you don't like how I describe it, the point is that we have this analogy: <u> : <ins> :: <i> : <em> :: <b> : <strong>. (Also <s> : <del>.)<ins> tag since it represents inserted text (with <del> representing deleted text). In diff tools, including those online, I've mostly seen inserted text rendered as green text (sometimes blue) or with a green background, and deleted text rendered as red text or with a red background. So I think you shouldn't count on <ins> being rendered as underlined text. Maybe it's an unofficial convention in markdown but there are plenty of places where it wouldn't make sense.The simple <u>some text</u> should work for you.
13 Comments
<u> can be used for underlining, but is discouraged "where it could be confused for a hyperlink."<u> is your best option for explicitly rendered underlining. Of course, more semantic elements should be used when possible.Just use the HTML <u> tag (recommended) or the <ins> tag inside your markdown for this.
The HTML tag <ins> is the HTML "insert tag", and is usually displayed as underlined. Hence, you can use it for underlining, as @BlackMagic recommends in his answer here. It is the opposite of the <del> delete tag.
But, I'd prefer and I recommend to just use the HTML <u> underline tag, since that's exactly what it's for:
<u>this is underlined text in HTML or markdown, which accepts HTML</u>
@zed_0xff also recommends using the <u> tag in his answer here.
You can try it out live online here: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_u.
What about underlined headings on GitHub?
@NoChance left in the comments:
I guess the
<u>does not work with#, for example, let's say you have Header 3 and you want to make it bold and underline - what can one do?
In this case, for it to work on GitHub, you have to use <ins> in place of <u>.
Do this:
# <ins>Underlined Heading 1</ins>
## <ins>Underlined Heading 2</ins>
### <ins>Underlined Heading 3</ins>
#### <ins>Underlined Heading 4</ins>
<!-- etc. -->
That works on GitHub too! Sample output on GitHub:
Using <u> in place of <ins> there will work on most markdown viewers, but not on GitHub.
See a full demo and trial file in my eRCaGuy_hello_world repo here: eRCaGuy_hello_world/markdown/underline.md.
Can I use CSS too?
It depends. On your custom Jekyll website? Sure. In GitHub readmes and other GitHub markdown files? No!
HTML tags work fine in GitHub readmes too, because GitHub accepts HTML tags just fine. BUT, custom CSS in GitHub does NOT work since GitHub blocks and rejects all custom CSS you may try to add. I talk about this in my other answer here: How do I center an image in the README.md file on GitHub?.
7 Comments
### <ins>Underlined Heading 3</ins>. That works! I've updated my answer and added a link to a demo file I tried on Github directly.<u> did not work in GitHub issue comments, at least in my case. <ins> did work<u> also does not appear to work in PR descriptions at the time of writing this comment. <ins> does work.You can wrote **_bold and italic_** and re-style it to underlined text, like this:
strong>em,
em>strong,
b>i,
i>b {
font-style:normal;
font-weight:normal;
text-decoration:underline;
}
3 Comments
Both <ins>text</ins> and <span style="text-decoration:underline">text</span> work perfectly in Joplin, although I agree with @nfm that underlined text looks like a link and can be misleading in Markdown.

_underlined_text, unfortunately it does not\text{...}and\underline{...}LaTeX commands. This only works for markdown that renders LaTeX and is inelegant imo. On the plus side, you can use the\boxed{...}command which I think looks pretty unique. Edit: I just noticed this is a 15 year old question lmaoo