How to Create an HTML Link: Hyperlink, New Tab and Nofollow Code
At a glance
- To make an HTML link, put the address in the href of an <a> tag and a descriptive anchor text between the tags.
- target="_blank" opens the link in a new tab; use sponsored for paid links and ugc for comments.
- Google reliably follows only <a> links with an href, so write clear text instead of 'click here'.
Whether you write for a website, a blog or an online shop, the thing that moves readers from one page to another is the HTML link. Once you know how to create an HTML link properly, you can build hyperlinks yourself, make them open in a new tab, and decide which links need nofollow or sponsored.
Sultan Muhammad Rashed once ran an "HTML Link Generator" tool on his old blog: paste a URL and some text, and it produced the link code. This guide grows out of that idea. It shows, step by step, how to write correct, SEO-friendly links by hand without any tool. Everything here has been checked against MDN Web Docs and Google Search Central guidance as of November 2026.
What an HTML link is and how it works
Links in HTML are made with the <a> tag, called the "anchor" tag. It has two essential parts:
- href: the address the link goes to.
- Anchor text: the words inside the tag that the reader clicks.
The simplest hyperlink code:
<a href="https://www.priyonews24.com">Priyo News 24</a>The browser shows this as the words "Priyo News 24", and a click opens the site. Google also discovers new pages through links like this. Google's link guidance says it can reliably follow only <a> elements that have an href. Links built with only onclick and no href, addresses placed inside a <span>, or an href that starts with javascript: are not handled properly.

How to create an HTML link: step by step
- Pick the address. Copy the full URL of the page you want to send people to (including https://).
- Write <a href="...">. Put the URL inside the quotation marks. Don't leave spaces or commas in it.
- Write the anchor text. Use words that tell the reader what they'll get when they click.
- Close the tag with </a>. If you forget, everything after it may turn into a link.
- Add extra attributes if needed. A new tab (target), the link type (rel) or a download (download).
- Test it. Before publishing, click every link to make sure it opens.
Types of URL: full or partial?
| Type | Example | When to use it |
|---|---|---|
| Absolute URL | href="https://example.com/page" | Linking to another website |
| Root-relative | href="/blog/seo-tips" | Another page on your own site |
| Same folder | href="contact.html" | Small static sites |
| Part of the same page | href="#faq" | Jumping to a section of a long article |
| href="mailto:info@example.com" | Opening a new email on click | |
| Phone | href="tel:+8801XXXXXXXXX" | Calling directly on mobile |
To link to a section of the same page, give that section's heading an id, such as <h2 id="faq">, then use href="#faq" in the link. This is very handy for long guides and tables of contents.
Code to open a link in a new tab
Many people want external links to open in a new tab so readers don't lose your page. Add target="_blank":
<a href="https://example.com" target="_blank" rel="noopener">Example site (opens in a new tab)</a>Keep a few things in mind:
- According to MDN, in modern browsers target="_blank" automatically gives the same protection as rel="noopener", so the new page cannot control yours. Adding rel="noopener" anyway is a safe habit for older browsers.
- Links within your own site usually work best in the same tab; opening every link in a new tab for no reason annoys mobile readers.
- For accessibility, say in the text or with a labelled icon that the link opens in a new tab.
Nofollow, sponsored and ugc: which link gets which
The rel attribute tells Google what kind of link it is. According to Google Search Central's "Qualify your outbound links" page:
| rel value | Use it for | Example |
|---|---|---|
| sponsored | Ads or paid placements | <a href="..." rel="sponsored"> |
| ugc | User-generated content such as comments and forum posts | <a href="..." rel="ugc"> |
| nofollow | Sites you don't want to vouch for or have Google follow | <a href="..." rel="nofollow"> |
| none | Normal, trusted links | <a href="..."> |
- You can combine values: rel="ugc nofollow".
- Nofollow used to be recommended for paid links and is still accepted, but sponsored is now preferred.
- To keep Google from crawling a page on your own site, Google recommends robots.txt rather than nofollow.
- Plain links to trustworthy sources are fine and build reader trust. There is no need to put nofollow on every external link.
How to write SEO-friendly anchor text
The link text tells both readers and Google what the next page is about. Google's link guidance and MDN agree:
- Be descriptive: not "click here" but "Bangladesh passport fees 2026".
- Keep it short: a few words or a short phrase is enough.
- Don't stuff keywords: write what reads naturally.
- Give links context: put them inside sentences rather than lining many up side by side.
- Add alt text to image links: when an image is a link, Google uses its alt text as the anchor text.
Weak: To see our products, click <a href="/products">here</a>. Strong: Browse <a href="/products">our full product list</a>.
The same rules apply to internal links. Every important page on your site should be linked from at least one other page. To review a page's links, titles and headings together, our on-page SEO checklist will help.
Common link mistakes and how to fix them
| Mistake | Problem | Fix |
|---|---|---|
| href="example.com" without https:// | The browser treats it as a page on your own site and returns 404 | Use the full URL for external links |
| Not closing </a> | All following text becomes a link | Close every <a> |
| Missing quotation marks | Links break if there are spaces | Always put the href value in " " |
| Using href="#" as a button | Confuses Google and screen readers | Use <button> for actions, links for navigation |
| Leaving old or broken links | Frustrates readers, lowers site quality | Check links regularly |
When you find a broken link, check which status code it returns and fix it accordingly; our guide to URL status codes and fixing 404 errors explains how. For checking many links at once or small jobs like counting words, the free online tools at GrowthPi can save time.
A quick way to build many links at once
The old "link generator" tools turned a list of URLs and texts into link code in one go. Today any spreadsheet can do it:
- Put URLs in column A and anchor text in column B.
- In column C, enter: ="<a href="""&A2&""">"&B2&"</a>"
- Drag the formula down; each row gives you ready link code.
Remember, though: stuffing a page with hundreds of artificial links or keyword-packed anchor text goes against Google's spam policies. Links are there to help readers.
Conclusion
Creating an HTML link is simple: an <a> tag, a correct href, and descriptive anchor text. Add target="_blank" where it helps, and sponsored or ugc on paid or user-generated links, and your links will be clear to readers and to Google alike. Make it a habit to click every link once before you publish a new page.
FAQ
What is the HTML code for a hyperlink?
The basic code is <a href="https://example.com">link text</a>. Put the destination address in href and the words readers will click between the opening and closing tags.
How do I make a link open in a new tab?
Add target="_blank" to the <a> tag. Modern browsers then apply noopener protection automatically, but adding rel="noopener" does no harm for older browsers.
When should I use a nofollow link?
Use nofollow for sites you don't trust or don't want Google to follow. Google recommends sponsored for ads and paid placements, and ugc for links in comments and forum posts.
Can I use more than one rel value?
Yes. Google's documentation allows several values separated by spaces or commas, such as rel="ugc nofollow" or rel="ugc,nofollow".
What makes good anchor text?
Short, descriptive text that is relevant to the page it points to. Avoid generic phrases like 'click here' or 'read more', and don't stuff keywords into it.
How do I link to an email address or phone number?
Use href="mailto:info@example.com" for email and href="tel:+8801XXXXXXXXX" for phone. On mobile, tapping the link opens the mail app or the dialer.
Comments
No comments yet — be the first to comment.