How to add links in Markdown?

In Markdown, links are created by specifying three things, link text, URL and title text. The reason for doing this is that in HTML, you define these three things while adding links to web pages.

[link text](URL 'title text')
OR
[link text](URL "title text")

Note: HTML provides <a> element to add links to web pages. The <a> tag has two attributes, href and title. You specify URL using href attribute.

The title text is provided using the title attribute. It is displayed when someone hovers the link.

Format Code or Output
Markdown [Markdown tutorial](https://www.tutorialsandyou.com/markdown/ 'Learn Markdown')
HTML Output <a href="https://www.tutorialsandyou.com/markdown/" title="Learn Markdown">Markdown tutorial</a>
Rendered Output Markdown tutorial

How to add reference links in Markdown?

To add a reference link, you have to do three things:

  • Instead of parenthesis, you have to use square brackets.
  • Inside another pair of square brackets, pass a number, and this number will point to the reference URL.
  • Somewhere in the document, specify the URL to the reference. The reference link starts with square brackets. Inside the square brackets, you pass the same number that you used earlier. After that, write a colon, space and a URL.

Note: If you want to create footnotes, visit Markdown footnotes.

[link text][number]
.
.
.
[number]: URL 'title text'
Format Code or Output
Markdown [Markdown tutorial][1]
.
.
.
[1]: https://www.tutorialsandyou.com/markdown/ 'Learn Markdown'
HTML Output <a href="https://www.tutorialsandyou.com/markdown/" title="Learn Markdown">Markdown tutorial</a>
Rendered Output Markdown tutorial