How to Create Hyperlink in HTML with Example: Step-by-Step Guide

Hyperlinks are an essential aspect of web development, enabling users to navigate between different pages or sections of a website. In HTML, creating a hyperlink involves using the anchor tag (<a>), along with the href attribute.

How to Code a Hyperlink in HTML (it's easier than you think!)
How to Code a Hyperlink in HTML (it's easier than you think!)

To create a hyperlink in HTML, follow this basic syntax: <a href="URL">Link Text</a>. Here, replace "URL" with the target webpage's address, and "Link Text" with the text you want users to see.

A Basic Guide to Links – How to Use HTML Hyperlinks
A Basic Guide to Links – How to Use HTML Hyperlinks

Understanding the <a> Tag

The <a> tag defines the hyperlink and is an important building block of the World Wide Web. It consists of two main parts: the href attribute and the visible text that users interact with.

Create Hyperlink or Actionlink (Html.ActionLink) from Controller in Asp.Net MVC 4 Example - Tutlane
Create Hyperlink or Actionlink (Html.ActionLink) from Controller in Asp.Net MVC 4 Example - Tutlane

Using the <a> tag not only helps improve user experience but also enhances a website's SEO by promoting natural link building and external referencing.

Setting the URL

the text how to add hyperlink in pdf on a white background with black and yellow shapes
the text how to add hyperlink in pdf on a white background with black and yellow shapes

The href attribute within the <a> tag is used to specify the URL of the webpage, file, or location to which the hyperlink will direct users upon clicking. URLs can lead to both internal (within your website) and external (outside your website) content.

Here's an example: <a href="https://www.example.com">Visit Example</a>. This will create a hyperlink that, when clicked, takes users to the Example website.

destinoglobiumt_small

HOW TO CREATE LINKS IN HTML
HOW TO CREATE LINKS IN HTML

The "Link Text" within the <a> tag is the visible portion of the hyperlink that users click on to follow the link. It can be a word, phrase, or even an image, but should be relevant to the target content and helpful to users.

For instance: <a href="https://www.example.com/products">Shop Our Products</a>. This creates a link leading to a products page, with engaging text encouraging users to explore the merchandise.

Using Absolute and Relative URLs

How to Hyperlink - SlideServe
How to Hyperlink - SlideServe

URLs in hyperlinks can be either absolute or relative, depending on their target destination.

Absolute URLs provide the full path to a resource from the root, typically starting with 'http://' or 'https://', like so: <a href="https://www.example.com/products">Shop Products</a>. These are useful when linking to external websites or pages.

Blogging Your Brand With WordPress
Blogging Your Brand With WordPress
How to Hyperlink to a Specific Point within Your Posts
How to Hyperlink to a Specific Point within Your Posts
How To Add Hyperlink In PDF: How To Create Hyperlink In PDF File For FREE
How To Add Hyperlink In PDF: How To Create Hyperlink In PDF File For FREE
Learn to create links in HTML.
Learn to create links in HTML.
🔗 Chapter 4: HTML – Add Links and Images
🔗 Chapter 4: HTML – Add Links and Images
How to Create External Hyperlinks in Microsoft Word
How to Create External Hyperlinks in Microsoft Word
Links in HTML
Links in HTML
Links in HTML: Create, Example - Scientech Easy
Links in HTML: Create, Example - Scientech Easy
How to Create a Hyperlink in Microsoft Word
How to Create a Hyperlink in Microsoft Word
SEO for Lawyers: Definitive Guide to SEO for Law Firms in 2026
SEO for Lawyers: Definitive Guide to SEO for Law Firms in 2026
How to Create a Hyperlink in Excel (3 Most Common Types of Hyperlinks)
How to Create a Hyperlink in Excel (3 Most Common Types of Hyperlinks)
the word click here is displayed on a computer screen with an arrow pointing to it
the word click here is displayed on a computer screen with an arrow pointing to it
Difference Between Link and Hyperlink Editing Service
Difference Between Link and Hyperlink Editing Service
Do You Hyperlink Your Teaching?
Do You Hyperlink Your Teaching?
How to Make Text Accessible to People with Disabilities - Caitlin Cahill - The Geek You Need
How to Make Text Accessible to People with Disabilities - Caitlin Cahill - The Geek You Need
Hyperlink Formula in Excel with Example | Create Bulk Hyperlink in Excel
Hyperlink Formula in Excel with Example | Create Bulk Hyperlink in Excel
Difference Between Hypertext and Hyperlink
Difference Between Hypertext and Hyperlink
How to make a digital planner with hyperlinks using Canva for free - DigitalbossCreations
How to make a digital planner with hyperlinks using Canva for free - DigitalbossCreations
an image of a web page with the text'how to write a html list '
an image of a web page with the text'how to write a html list '
How to Use Hyperlinks in Google Docs - Make Tech Easier
How to Use Hyperlinks in Google Docs - Make Tech Easier

Absolute URLs

Absolute URLs always start with the protocol (http:// or https://) and include the domain name, which can make them quite long. However, they provide a clear and full reference to the target resource.

Example: <a href="https://www.w3.org/html/">W3 HTML Documentation</a>

Relative URLs

Relative URLs, on the other hand, are paths relative to the current page's location. They don't include the protocol or domain and are often used for internal linking within a website.

For example, if you want to link to a 'contact.html' page in the same directory, you can use: <a href="contact.html">Contact Us</a>. If the 'contact.html' page is in a subdirectory called 'support', you'd use: <a href="support/contact.html">Contact Us</a>.

Mastering hyperlinks empowers you to create richer, more interactive user experiences. They facilitate easy navigation, improve discoverability, and foster a more connected web. Now that you know how to create hyperlinks in HTML, go ahead and make your webpages more engaging and user-friendly!

Related Articles

Css Marquee Tutorial What Is The Use Of Image Tag In Html Html Table Css Examples Beautiful With Code Html Table Border Code Example Marquee Title Html Simple Html Table Code Example Html Marquee Examples W3schools Html Marquee Tutorial Marquee Html Code Example Example Image Tag Html