hemburger
Blog

An HTML anchor tag, written as <a>, creates a hyperlink that takes users from one location to another. You can use it to connect pages, link to specific sections, open files, send emails, make phone numbers clickable, or help users move through a website.

The basic anchor tag uses an href attribute to define the destination and anchor text to describe the link. For example:

<a href=”https://example.com”>Visit Example.</a>

Anchor tags also matter for SEO and accessibility. Google can generally crawl a link when it uses an <a> element with an href attribute, while descriptive link text helps both users and search engines understand the linked page

Keep reading to learn more about anchor tags in HTML.

What Is an Anchor Tag in HTML?

HTML anchor tag linking to websites, files, email, and phone

An HTML anchor tag is the <a> element used to create hyperlinks. These links allow users to navigate from one web page to another, jump to specific sections within the same page, download files, or trigger actions like opening an email client or making a phone call. Anchor tags can link to webpages, files, page sections, email addresses, and phone numbers.

Basic syntax:

<a href=”URL”>Anchor Text</a>

For example:

<a href=”https://example.com/services”>Our Services</a>

What Is the <a> Tag in HTML?

The <a> tag is the HTML anchor element. It creates a hyperlink between the current page and another destination.

The destination can be another webpage, a file, a section on the same page, an email address, or a phone number. The href attribute usually defines that destination.

What Does an HTML Anchor Tag Do?

An anchor tag can help users:

  • Move from one webpage to another
  • Navigate between pages on the same website
  • Open an external website
  • Jump to a specific section of a page
  • Download a file
  • Send an email
  • Call a phone number
  • Navigate through website menus

For example:

<a href=”/about-us”>About Us</a>

When a user selects About Us, the browser navigates to the URL in the href attribute.

What Does an HTML Anchor Tag Look Like?

A simple anchor tag has three main parts:

<a href=”https://example.com”>Visit Example</a>

Here:

  • <a> starts the anchor element.
  • href specifies the destination.
  • https://example.com is the destination URL.
  • Visit Example is the anchor text.
  • </a> closes the element.

The href attribute stands for hypertext reference

What Are the Main Parts of an HTML Anchor Tag?

A basic anchor element contains an opening tag, attributes, anchor text, and a closing tag.

1. Opening <a> Tag

The opening tag tells the browser that the element is a hyperlink.

<a>

2. href Attribute

The href attribute defines the URL or destination.

<a href=”https://example.com”>

Google recommends using crawlable <a> elements with href values that resolve to actual URLs when you want Google to discover and crawl pages through those links.

3. Anchor Text

Anchor text is the visible, clickable text.

<a href=”/seo-services”>SEO Services</a>

Here, SEO Services is the anchor text.

Good anchor text should describe the destination clearly rather than using vague phrases such as “click here.” Google recommends concise, relevant, descriptive anchor text.

4. Closing Tag

The </a> tag closes the anchor element.

</a>

A complete example looks like this:

<a href=”https://example.com”>Visit Example</a>

Common Anchor Tag Attributes

Attribute Purpose Example
href Specifies the destination address of the link. Absolute URLs, relative paths, hashes, or protocols (mailto:, tel:).
Target Specifies where to open the linked document self (default tab) or _blank (new tab).
Download Prompts the browser to download the linked file instead of navigating to it. File name (optional filename override).
hreflang Indicates the language of the linked resource hreflang=”en”

Not every anchor needs all these attributes. Use them only when they serve a clear purpose.

Where Are HTML Anchor Tags Used?

Anchor tags appear anywhere you need to connect one resource to another. Common applications include:

Web Pages

Anchor tags create hyperlinks between different pages, allowing users to navigate within the same site or to external destinations.

Navigation Menus

Headers, footers, and sidebars use anchor tags to build menu items that guide users through different sections of a website.

Images

Wrapping an anchor tag around an image creates a clickable image link. When clicked, users are directed to the URL specified in the href attribute.

Email Addresses

HTML mailto link example for sending email

Using the mailto: protocol, anchor tags can open the user’s default email client with a pre-filled recipient address.

In-Page Navigation

Anchor tags linked to element IDs allow users to jump directly to specific sections of a long webpage, improving usability and reducing bounce rates.

HTML <a> Tags vs. HTML <link> Tags: Key Differences

Feature <a> Tag <link> Tag
Primary Function Creates clickable hyperlinks for user navigation Links external resources to the HTML document
Placement Within the <body> section Within the <head> section
Common Attributes href, target, rel, title rel, href, type, media
Typical Use Cases Navigation menus, internal links, external links, email links Stylesheets, favicons, canonical URLs, alternate document versions

How Do You Create an HTML Anchor Tag?

HTML hyperlink structure showing anchor text and target URL

Creating an anchor tag takes only a few steps.

Step 1: Choose the Destination

Decide where the link should take users.

For example:

https://example.com/contact

Step 2: Add the <a> Element

Start with the anchor element:

<a></a>

Step 3: Add the href Attribute

Place the destination inside href:

<a href=”https://example.com/contact”></a>

Step 4: Add Descriptive Anchor Text

Add text that clearly describes the destination:

<a href=”https://example.com/contact”>Contact Our Team</a>

Step 5: Test the Link

Open the page and select the link. Make sure it goes to the intended destination. Also check links after changing URLs, moving pages, or updating website navigation.

How Do You Add an HTML Anchor Tag in WordPress?

You usually do not need to write HTML manually in WordPress.

In the WordPress editor:

  1. Select the text you want to turn into a link.
  2. Select the Link option.
  3. Enter or paste the destination URL.
  4. Apply the link.
  5. Preview the page.
  6. Test the link before publishing.

If you use an HTML or code editor, you can add the anchor element directly:

<a href=”https://example.com”>Learn More</a>

The exact editor interface can vary depending on your WordPress setup and theme.

How Do Anchor Tags Support SEO?

SEO anchor text highlighted on a webpage

Anchor tags can support SEO by helping search engines discover pages and understand relationships between content. Google states that crawlable <a> elements with href attributes are generally used to discover links. It also recommends descriptive and relevant anchor text.

Use Descriptive Anchor Text

Compare these examples:

Less useful:

<a href=”/technical-seo”>Click here</a>

More descriptive:

<a href=”/technical-seo”>Technical SEO guide</a>

The second version gives users and search engines more context about the destination.

Use Relevant Internal Links

Link related pages when the connection is useful to readers.

For example, an article about ecommerce SEO might naturally link to a detailed guide about product-page optimization.

Google says internal links can help people and Google understand a site’s content and discover other pages.

Avoid Keyword Stuffing

Do not force keywords into every anchor.

For example, repeatedly using an exact keyword in unnatural sentences can make the content harder to read. Google specifically recommends writing naturally and avoiding keyword stuffing in anchor text.

Make Links Crawlable

A standard HTML link looks like this:

<a href=”/products”>View Products</a>

Google can generally crawl this type of link. By contrast, relying only on JavaScript events for navigation can make discovery less reliable.

Advantages of Using Anchor Tags in HTML

Hyperlinking

Anchor tags connect documents, images, websites, and specific page sections, enabling seamless movement between resources.

Enhanced Navigation

Users can jump directly to relevant content, which is especially valuable for long-form articles or complex site structures.

Cross-Platform Compatibility

Anchor tags work consistently across all modern browsers and devices.

SEO Benefits

Descriptive anchor text gives search engines context about the linked content. Strategic internal linking distributes page authority and improves crawlability. Both of which can

improve rankings.

  • Bookmarking and Sharing: Users can bookmark or share direct links to specific sections of a webpage.
  • Accessibility: Well-written anchor text helps screen readers and assistive technologies convey link purpose to all users.
  • Dynamic Content Loading: Anchor tags can work with JavaScript to support single-page applications (SPAs) and AJAX-driven experiences.
  • Analytics and Tracking: Integrating anchor tags with analytics tools reveals which links users click, informing content and UX strategy.

Troubleshooting Issues with HTML <a> Tags

Check for Syntax Errors: Ensure the <a> tag has proper opening and closing brackets and that the href attribute is correctly specified.

Verify the Link URL: Confirm the href value contains the correct URL or path. Incorrect URLs lead to broken links and poor user experience.

According to Semrush, incorrect URLs in the ‘href’ attribute lead to broken links.

Confirm Link Targets: If using the target attribute, verify it is set correctly (e.g., _blank for new tabs).

Validate rel Attributes: For external links, use rel=”noopener” or rel=”nofollow” as appropriate to manage security and SEO signals.

Test Across Devices: Check that links work on desktop, mobile, and tablet devices.

Check the Browser Developer Tools: For more difficult problems, use your browser’s developer tools to inspect the HTML and check for errors. This can help identify incorrect URLs, missing elements, or JavaScript issues affecting navigation.

Conclusion

HTML anchor tags play an important role in website navigation, helping users access relevant pages and search engines discover content through crawlable links. Using descriptive anchor text, relevant internal links, and valid URLs makes it easier to navigate a website and understand the relationship between its pages. Regularly checking links for errors and avoiding forced keywords also helps maintain a better user experience.

For businesses looking to improve their website’s search performance, these practices are an important part of effective on-page and technical SEO. ResultFirst helps businesses identify SEO improvement opportunities and strengthen the technical foundations that support organic search visibility. If your website needs better crawlability, a more effective internal linking structure, or a closer review of technical SEO issues, contact us to discuss how our SEO expertise can support your organic growth goals.

Read more: 7 Ways to Use the ‘Inspect Element’ Tool for SEO

FAQs:

READY TO BUILD PREDICTABLE ORGANIC GROWTH?

We are the only TOP SEO services agency providing Real Results in a Real Performance model. We help growth hungry companies outperform their competition and achieve 300%+ growth in their digital marketing initiatives.

    300K+

    KEYWORDS RANKED

    546M+

    REVENUE GENERATED

    18 Years

    SOLVING COMPLEX SEO

    150+

    TEAM MEMBERS