Anchor Tag

The anchor tag is an HTML element used to anchor hyperlinks to an element on the website (e.g. text or an image).

It can e.g. link to a subpage of the website, the home page or another related page. This way you can connect a lot of individual files to a single website.
When linking to internal pages (i.e. on the same website), you should use only the file's path and name instead of the complete URL. Under certain conditions, this can decrease the load time of the page.

Furthermore, links can go from one website to another.


We tested <a href="" target="_self">this SEO software</a>.

We tested this SEO software.

Like most HTML elements, an anchor tag can also have various attributes. Here are the most important ones:


The href attribute defines the target URL.


The name attribute defines a name for the anchor tag. This name can be used afterwards to link exactly to this anchor on the page.


First you put an anchor tag on some text and give the tag a name.

<a name="introduction">Chapter 1: Introduction</a>

Then you add #name to a href attribute on another page:

In <a href="project.html#introduction">Chapter 1</a> of our project, we…


In HTML 5 the name attribute was replaced by the id attribute.


The target attribute defines where the link will be opened. The target attribute can have one of the following values: _blank, _parent, _self, _top

While too many anchor tags can confuse the visitor, too few can make navigation more difficult. So it's important to use an amount appropriate to the website's size.

Search engines also analyze the links from a website and the linked content. Depending on the reputation of the website where the link comes from, this means that rating of the linked page can improve because of the link.

The anchored text of the anchor tag is called anchor text.