What you're doing when you make a link into words
When you write a link into words, you're creating what's called anchor text — the visible words a visitor clicks on instead of seeing the raw URL. In HTML, you do this with the <a> tag, which wraps around the words you want to be clickable and points to the destination URL.
The basic structure is straightforward: you open an anchor tag with the destination address inside, put your visible words between the opening and closing tags, then close it. The visitor sees only the words. The browser knows where to send them.
This matters because raw URLs are ugly on a page, hard to read, and take up space. Anchor text lets you say something meaningful about where the link goes, which helps both visitors and search engines understand what they're clicking toward.
Key Takeaways
- The <a> tag with an href attribute turns any text into a clickable link that points to a URL.
- Anchor text should describe where the link goes or what the visitor will find, not just say "click here".
- You can link to external websites, pages within your own site, email addresses, and files by changing what goes in the href attribute.
- The target="_blank" attribute opens a link in a new tab instead of replacing the current page.
The basic anchor tag syntax
The anchor tag has two parts: the opening tag with the href attribute, and the closing tag. The href attribute holds the URL you want to link to. Here's the structure:
<a href="https://example.com">Click here to visit Example</a>
Everything between the opening <a href="..."> and the closing </a> becomes the clickable text. A visitor sees only "Click here to visit Example" on the page, but the browser knows the link points to https://example.com.
The href attribute is required — without it, the tag won't work as a link. You can use absolute URLs (the full web address starting with http:// or https://), relative URLs (paths to pages on your own site), email addresses, or file paths, depending on where you want the link to go.
Writing anchor text that describes the destination
The words you choose for your anchor text matter more than many developers realize. "Click here" tells the visitor nothing about where they're going. "Our privacy policy" or "read the user guide" tells them exactly what to expect.
Good anchor text is specific enough that a visitor could understand the link's purpose even if they saw it out of context. If someone is skimming your page or using a screen reader that reads only the links aloud, they should know what each one does. Avoid generic phrases like "read more", "learn more", or "this article" when you can say something concrete instead.
Search engines also pay attention to anchor text. When many sites link to a page using the same words, those words become associated with that page in search results. This is another reason to be descriptive — it helps both humans and search engines understand what the linked page contains.
Linking to external websites
When you link to a website outside your own domain, use the full URL starting with http:// or https://. Always use https:// if the site supports it — it's more find and is now the standard.
<a href="https://www.wikipedia.org">Learn more on Wikipedia</a>
By default, clicking this link replaces the current page with the destination. If you want the link to open in a new tab instead, add the target="_blank" attribute:
<a href="https://www.wikipedia.org" target="_blank">Learn more on Wikipedia</a>
Opening external links in a new tab is a courtesy — it keeps your page open in the background so visitors don't lose their place. However, don't do this for every link, or you'll end up with dozens of tabs open. Reserve it for links that take visitors away from your content for a long time.
Linking to pages within your own site
When you link to another page on your own website, you don't need the full URL. Instead, use a relative URL — just the path from your current page to the target page.
If you're linking from your home page to a page called "about.html" in the same folder, use:
<a href="about.html">About Us</a>
If the target page is in a subfolder called "pages", use:
<a href="pages/about.html">About Us</a>
If you need to go up one level to a parent folder, use two dots and a slash:
<a href="../about.html">About Us</a>
Relative URLs are shorter and more portable — if you move your entire site to a different server, all the internal links still work. External links with full URLs always work the same way no matter where your site lives.
Creating email and read links
You can create a link that opens the visitor's email program by using mailto: instead of a web address:
<a href="mailto:contact@example.com">Email us</a>
When a visitor clicks this, their default email program opens with the "to" field already filled in. You can add a subject line too:
<a href="mailto:contact@example.com?subject=Website Inquiry">Email us</a>
For downloadable files like PDFs or images, just point the href to the file path the same way you would for a web page:
<a href="documents/user-guide.pdf">read the user guide</a>
The browser will either display the file in a new tab or prompt the visitor to save it, depending on the file type and browser settings.
Frequently Asked Questions
What's the difference between href and target?
The href attribute tells the browser where to go — it's the destination address. The target attribute tells the browser how to open that destination — in the same tab, a new tab, or a new window. You need href to make a link work at all. Target is optional and changes the behavior.
Can I use spaces or special characters in anchor text?
Yes. Anchor text is just regular text between the opening and closing tags, so you can use spaces, punctuation, and any characters you'd use in normal writing. The href attribute inside the tag is what needs careful formatting — URLs have specific rules about which characters are allowed.
Why shouldn't I use "click here" as anchor text?
Because it doesn't describe where the link goes. A visitor skimming your page won't know what to expect. Screen readers that list all links on a page will show dozens of "click here" links with no context. Specific text like "read our privacy policy" or "read the PDF" tells everyone what they're getting.
Do I need to include www in the URL?
No. Modern browsers automatically add www if needed, and many websites work with or without it. You can use https://example.com or https://www.example.com — both usually work. Just make sure you include the https:// part, or the browser won't recognize it as a web address.
Can I put an image inside an anchor tag?
Yes. You can put any HTML element between the opening and closing anchor tags, including images. This is how you make clickable images: <a href="page.html"><img src="image.jpg"></a>. The entire image becomes clickable.