Home / Blog / Anchor text HTML: how the a tag really works
Guide
Anchor text HTML: how the a tag really works
Every link is an HTML anchor element, and the words between its tags are the anchor text. Get the markup right and your links are clear to readers, screen readers, and search engines alike. Here is the tag, the attributes, and the rules that matter.
Every hyperlink on the web is an HTML anchor element, and the anchor text HTML markup is short enough to learn in a sentence: the text you place between the opening and closing tags is the anchor. In <a href="/guide">internal linking guide</a>, the words "internal linking guide" are the anchor text, and /guide is where the link goes. Getting the anchor text HTML right is what makes a link clear to three audiences at once — readers, screen readers, and search engines. This page covers the tag, the attributes worth knowing, and the accessibility rules that keep your links honest. For the strategy of choosing the words, see the complete guide to anchor text.
The a tag, broken down
The anchor element has two required parts and a handful of optional ones:
<a>— the opening tag that begins the link.href="..."— the attribute that sets the destination URL (a page, a file, an email address, or a spot on the same page).- the anchor text — the visible content between the tags.
</a>— the closing tag.
Put together: <a href="/blog/find-orphan-pages">how to find orphan pages</a>. A browser renders "how to find orphan pages" as a clickable link; the href decides where it goes. According to MDN's reference for the <a> element, the element "creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address" — and the text inside it is what both people and crawlers read.
Attributes worth knowing
A few attributes shape how a link behaves and how search engines treat it:
href— required for a real link. Without it, the<a>element is just a placeholder.rel— describes the relationship of the link. Common values includenofollow(do not pass ranking signal),sponsored(paid links), andugc(user-generated content). For ordinary internal links between your own pages you normally use norelat all, so the link passes authority freely.title— an optional tooltip shown on hover. It is a nice-to-have, not a replacement for descriptive anchor text; many users (and crawlers) never see it.target="_blank"— opens the link in a new tab; pair it withrel="noopener"for security.
The attribute that trips people up is rel="nofollow". It tells search engines not to pass authority through the link, which is the right call for untrusted or paid links — but applying it to your own internal links throws away the signal you are trying to build. Keep internal links followable.
Accessibility: the anchor text is the label
Anchor text is not only an SEO signal; it is how screen-reader users navigate. Assistive technology can pull up a list of all the links on a page, read out of context, so a link whose text is "click here" or "read more" becomes meaningless in that list. The WCAG guideline on link purpose asks that the purpose of each link be determinable from its link text — which is the same standard that makes a link good for search. Descriptive anchor text serves people and crawlers with one piece of work.
This is why two common patterns should be avoided as your only anchor. A bare URL (<a href="...">https://example.com/very/long/path</a>) is read character by character by a screen reader and tells a sighted reader little. An image with no alt text used as the entire link gives assistive technology nothing to announce. If you link an image, the alt attribute becomes the effective anchor text, so write it descriptively.
Anchor text in a CMS
Most people never hand-write the <a> tag — a content management system writes it for them. In WordPress, the Block Editor lets you highlight a phrase, click the link button, and paste a URL; the editor wraps your highlighted words in an <a> element automatically, so the phrase you selected becomes the anchor text. The step-by-step is in the guide to adding internal links in WordPress. The lesson holds whatever the tool: the words you highlight are the anchor, so highlight a phrase that describes the destination — not a stray "here."
Verifying the markup
The step most people skip is checking that the link actually shipped. A cached page, a plugin that strips or rewrites links, or a draft that never published can leave the <a> element missing from the live HTML even though it looked right in the editor. After publishing, view the page source (or re-fetch it) and confirm the anchor element is present with the right href and the right text between the tags. That final check is cheap and catches the silent failures that an editor preview hides.
A fuller worked example
Most real links use only href and good anchor text. But it helps to see the attributes together so you know what each one does. An internal link to one of your own pages is the simplest case:
<a href="/blog/find-orphan-pages">how to find orphan pages</a>
No rel, no target — the link passes authority, opens in the same tab, and its anchor describes the destination. That is the shape of the overwhelming majority of links you should write.
An external link you do not want to vouch for, opening in a new tab, looks different:
<a href="https://example.com" rel="nofollow noopener" target="_blank">an external reference</a>
Here rel="nofollow" tells search engines not to pass authority, noopener closes a small security gap that target="_blank" otherwise opens, and the anchor still describes what waits on the other side. The contrast is the lesson: reserve nofollow for links you cannot vouch for, keep your internal links plain and followable, and in every case give the link real, descriptive words rather than a bare URL or a lonely "here."
A last note on relative vs. absolute paths: for links between your own pages, a relative href like /blog/find-orphan-pages is fine and portable; reserve full https:// URLs for links that leave your site. Either way, the anchor text rules are identical — the words between the tags carry the meaning.
Where the markup meets the strategy
Clean anchor text HTML is the foundation; choosing the words well is the craft on top of it. Once your links use real <a> elements with descriptive, followable, accessible anchors, the rest is editorial: pick phrases that describe each destination and read naturally in the sentence. That craft — and the way anchor text fits into connecting your whole site — is the subject of the broader guide to internal linking for SEO. Get the markup right once, then spend your attention on the words.
Sources
- The HTML a element, href and rel attributes (MDN) — developer.mozilla.org
- WCAG: link purpose should be clear from the link text — w3.org
- Google advises descriptive, accurate link text — support.google.com