Links in Markdown
Learn how to create different types of links in your Markdown documents
Creating Links in Markdown
Links are an essential part of web content, allowing you to connect your document to other resources. Markdown provides several ways to create links, from basic inline links to reference-style links and automatic URL conversion. Links can be combined with images to create clickable images, and used within tables and lists. You can also use our Link Generator tool to easily create link syntax.
Basic Link Syntax
The basic syntax for creating a link in Markdown consists of link text in square brackets followed by the URL in parentheses:
[Link text](https://www.example.com)
When rendered, this will appear as:
You can also add a title attribute to your link, which will appear as a tooltip when a user hovers over the link:
[Link with title](https://www.example.com "Website Title")
When rendered, this will appear as:
(Hover over the link to see the title tooltip)
Reference-Style Links
Reference-style links allow you to keep your document more readable by separating the link URL from the link text. They consist of two parts: the link reference in the text and the link definition elsewhere in the document.
Here is a [reference link][ref1] and another [reference link][ref2].
[ref1]: https://www.example.com
[ref2]: https://www.example.org "Optional Title"
When rendered, this will appear as:
Here is a reference link and another reference link.
You can also use a shorthand version where the reference name is the same as the link text:
Visit [Google][] for more information.
[Google]: https://www.google.com
More Link Examples
Automatic Links
Markdown can automatically convert URLs into links by enclosing them in angle brackets:
<https://www.example.com>
When rendered, this will appear as:
Many Markdown processors will also automatically convert raw URLs into links without the angle brackets, but using angle brackets ensures consistent behavior across all processors.
Email Links
You can create email links in Markdown using the same syntax as regular links, or with automatic links:
[Send an email](mailto:example@example.com)
<mailto:example@example.com>
When rendered, these will appear as:
Internal Document Links
You can create links to sections within the same document by linking to heading IDs. Most Markdown processors automatically generate IDs for headings.
## My Section {#custom-id}
[Link to My Section](#custom-id)
For automatically generated IDs, you typically link to the lowercase version of the heading with spaces replaced by hyphens:
## My Example Section
[Link to section](#my-example-section)
Note: The exact rules for automatic ID generation can vary between Markdown processors. Some may handle special characters differently or apply different transformations to the heading text.
Best Practices for Links
Link Best Practices
- Use descriptive link text - Instead of "click here" or "read more," use text that describes the destination, like "view our pricing page" or "learn about Markdown syntax."
- Check for broken links - Regularly verify that your links are still valid and point to the correct resources.
- Consider using reference-style links - For documents with many links, reference-style links can make your Markdown more readable and easier to maintain.
- Add titles for context - When appropriate, add title attributes to provide additional context about the link destination.
- Indicate external links - Consider using visual indicators (like an icon) for links that lead to external websites.
Common Mistakes to Avoid
Missing or Extra Spaces
// Incorrect - space between brackets and parentheses [Link text] (https://example.com) // Incorrect - no space after the colon in reference links [reference]:https://example.com
Ensure there are no spaces between the closing square bracket and opening parenthesis in inline links. For reference links, include a space after the colon.
Forgetting Protocol in URLs
// Incorrect - missing protocol [Website](www.example.com)
Always include the protocol (http:// or https://) in your URLs to ensure they work correctly.
Interactive Markdown Link Generator
Practice creating different types of Markdown links with our interactive generator.
[Link text](https://example.com)
Additional Resources
Official Markdown Specifications
Learn more about Markdown link syntax from the original specification and popular implementations.
Related Markdown Elements
Explore other Markdown elements that work well with links: