Skip to content

Link Generator

Looks One click to load a style, then fine-tune it

Link type
Where it goes

A full address (https://…) for another site, or a path like /contact for a page on your own site.

Text and names
Icon (drawn in the link color)

Only for icon-only links or short text like "Read more". Start it with the visible text.

Opening and rel
rel for search engines (optional)
Look
Style
Focus ring

It's always a solid outline at least 2px wide, so keyboard users can see where they are.

Page

Hover the link and press Tab to see the focus ring. Clicks in the preview don't open anything.

<style>
  .my-link {
    color: #1d4ed8;
    text-decoration: underline;
  }

  .my-link:hover {
    color: #1e3a8a;
  }

  .my-link:focus-visible {
    outline: 2px solid #1d4ed8;
    outline-offset: 2px;
  }
</style>

<a href="https://example.com/guides/bread" class="my-link">Read our guide to baking bread</a>

Checks

  • Tip Put the <style> block in your page's <head> (or the CSS in your stylesheet), and the link where it should go.
  • OK Looks good. Paste the code into your page, then click the link on your own site to make sure it goes to the right place. This tool doesn't visit the address.

HTML Link Generator: Hyperlink Code for Any Kind of Link

What Is an HTML Link?

A link (or hyperlink) is text people click to go somewhere else: another page, another site, a spot further down the page, a new email or a phone call. In HTML it's the <a> tag. The address goes in href, and the words between <a> and </a> are what people see and click.

This generator writes the whole tag for you. Pick the kind of link, type where it goes and the text, choose a look, and copy the code. Email subjects and phone numbers are encoded the right way, links that open a new tab get the safe rel value, and the checks under the code point out things like "click here" text or a missing https://. It all runs in your browser, and your last link is remembered for next time.

How to Use It, Step by Step

Five quick steps. The preview shows the exact code you copy, inside a sentence, so you see how the link stands out.

Step 1 Pick the Link Type

Under Link type, choose Web page, Email, Phone call, Text message, Section (a spot on the same page) or Download. The fields below change to match.

Step 2 Say Where It Goes

  • Web page: a full address like https://example.com/page, or a path on your own site like /contact. If you type example.com, https:// is added for you.
  • Email: the address, plus an optional Cc, Bcc, subject and message. Spaces, line breaks and symbols are encoded for you.
  • Phone call and Text message: type the number any way you like; spaces, dashes and brackets are dropped.
  • Section: the id of the part of the page to jump to, like prices.
  • Download: the file's address and, if you like, the name it's saved as.

Step 3 Write the Link Text

Type the Link text: the words people click. Add an Icon if you want one. The Tooltip and Screen reader name are optional. Quotes, < and & in your text are escaped in the code, so they can't break your page.

Step 4 Set How It Opens and Looks

For web links, switch on Open in a new tab if you need it and tick nofollow, sponsored or ugc when they apply. Then pick a look: a preset, or No CSS, Text link (color, hover color, visited color, underline) or Button. The focus ring is always there for keyboard users.

Step 5 Read the Checks, Then Copy

Hover the link in the preview and press Tab to see the focus ring. Read the Checks under the code, then press Copy all, Copy HTML, Copy CSS or Copy href (just the address, handy for a website builder's link box).

💡 Clicking the link in the preview does nothing on purpose, so you can try it without leaving the page. Test it for real once it's on your own site.

How to Make a Link in HTML

Write <a href="…">, the text, and </a>. A link sits inside a sentence like any other word, and browsers show it blue and underlined until you style it.

The code:

<p>Read our <a href="https://example.com/guides/bread">guide to baking bread</a> before you start.</p>

You'll see:

Use a full address (https://…) for other sites. For pages on your own site, a path is enough: /contact starts from the top of your site, and contact.html is next to the current page. Typing example.com without https:// is a common slip: the browser then looks for a page called "example.com" on your own site.

Open a Link in a New Tab

Add target="_blank". Also add rel="noopener noreferrer": noopener stops the new page from reaching back and changing yours (an old phishing trick), and noreferrer doesn't tell the other site which page the visitor came from. Modern browsers already act as if noopener is there, but writing it keeps older ones safe too.

The code:

<a href="https://example.com" target="_blank" rel="noopener noreferrer">
  Example site (opens in a new tab)
</a>

You'll see:

Use new tabs sparingly. People can open any link in a new tab themselves, and a tab that opens on its own can be confusing, especially on phones and for screen reader users. If you do it, say so in the text, like "(opens in a new tab)".

Make an Email Link With a Subject

An email link starts with mailto: and the address. Add ?subject= for the subject and &body= for the message. Spaces and symbols in them must be encoded, or the email arrives cut off. In HTML the & between the parts is written &amp;; the browser turns it back into &.

<a href="mailto:[email protected]?subject=Question%20about%20my%20order&amp;body=Hi%2C%0D%0A%0D%0AI%20have%20a%20question.">
  Email us
</a>
Character Becomes Why
space %20 Question about my order → Question%20about%20my%20order
line break %0D%0A Starts a new line in the body
& %26 Otherwise it starts the next part (like &body=)
? %3F Otherwise it can be read as the start of the options
, %2C Commas also separate addresses
# %23 Otherwise everything after it is dropped

The generator does all of this for you. For several people, separate the addresses with commas. Keep in mind an email link only works when the visitor has a mail app set up; on a shared or work computer that's not always the case, so it's kind to show the address as text too.

Phone and Text Message Links

tel: starts a call and sms: opens a new text message. Write the number with only digits and a + with the country code, like +15551234567, so it works for visitors in other countries. The text people see can be formatted however you like.

<a href="tel:+15551234567">Call +1 (555) 123-4567</a>

<a href="sms:+15551234567?body=Are%20you%20open%20today%3F">Send us a text</a>

On a phone these open the dialer or the messages app. On a computer they may offer a calling app or do nothing. The message text (?body=) is filled in by most phones, but not every messages app reads it.

Link to a Section on the Same Page

Give the section an id, then link to it with # and the same id. Clicking the link scrolls straight there. Ids can't have spaces, are case-sensitive, and must be used only once per page. #top always goes back to the top, even without an element with that id.

The code:

<p><a href="#prices">Jump to prices</a></p>

<p style="height: 260px">Lots of text here…</p>

<h2 id="prices">Prices</h2>
<p>Bread: $4. <a href="#top">Back to top</a></p>

You'll see (click "Jump to prices", it scrolls inside this box):

To link to a section on another page, put the id after the address: /faq#shipping. Add scroll-behavior: smooth to html in your CSS if you'd like the page to glide instead of jump.

Make a Download Link

Add the download attribute and the browser saves the file instead of opening it. Give it a value to choose the file name people get.

<a href="/files/price-list.pdf" download="price-list-2026.pdf">
  Download the price list (PDF, 120 KB)
</a>

This only works for files on your own site. For a file on another site, browsers ignore download and the name you picked, and just open the file. Mentioning the file type and size in the text helps people decide before they click.

Remove the Underline or Change the Link Color

color sets the link color and text-decoration: none removes the underline. Add a :hover rule so the link still reacts to the mouse, and a :focus-visible rule so keyboard users can see where they are. If you drop the underline, make the link stand out some other way, like bold text or an underline on hover.

The code:

<style>
  .my-link {
    color: #0f766e;
    font-weight: 600;
    text-decoration: none;
  }
  .my-link:hover {
    color: #134e4a;
    text-decoration-line: underline;
  }
  .my-link:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 2px;
    border-radius: 2px;
  }
</style>
<p>See the <a href="/menu" class="my-link">full menu</a> for today.</p>

You'll see (hover the link, then click beside it and press Tab):

You can also keep the underline and make it nicer: text-decoration-thickness sets how thick it is, text-underline-offset moves it down a little, and text-decoration-style makes it dotted, dashed or wavy.

The code:

<style>
  .fancy {
    color: #1d4ed8;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
  }
  .dotted {
    color: #374151;
    text-decoration-style: dotted;
  }
</style>
<p><a href="/a" class="fancy">Thick, with a gap</a> and <a href="/b" class="dotted">dotted</a>.</p>

You'll see:

The :visited color shows on links someone has already opened. Write it before :hover, so hovering still changes visited links. Browsers only let you change a few things there, mostly the color. Need a color? Find it with the HTML Color Picker and check it with the Color Contrast Checker (aim for at least 4.5:1).

nofollow, sponsored and ugc: Which rel to Use

rel tells browsers and search engines how the linked page relates to yours. Most links need none. These are the common ones:

rel Use it when
nofollow You link to a page but don’t want to vouch for it. Search engines are asked not to count it as a recommendation.
sponsored The link is paid for: an ad, an affiliate link or a sponsored post. Google asks for this one on paid links.
ugc Someone else posted the link (user-generated content), like in comments, reviews or a forum.
noopener Used with target="_blank". The new tab can’t reach back and change your page.
noreferrer The other site isn’t told which page the visitor came from. It also includes noopener.

You can combine them with spaces, like rel="sponsored noopener noreferrer" on a paid link that opens a new tab.

Write Link Text People Understand

People skim pages, and screen reader users often jump from link to link and hear only the link text. "Click here" tells them nothing. Good link text says where the link goes or what happens, even when it's read on its own.

Instead of Try
Click here Download the 2026 price list (PDF)
Read more Read more about our bread classes
https://example.com/a/b?id=123 Our shipping times
Link Contact the support team

If a design really needs a short "Read more", give it an aria-label that starts with the visible words, like aria-label="Read more about bread classes". And a link that runs code isn't a link at all:

<!-- Don't: a "link" that runs code. It can't be opened in a new tab or bookmarked. -->
<a href="javascript:void(0)" onclick="openMenu()">Menu</a>

<!-- Do: an action on the page is a button -->
<button type="button" onclick="openMenu()">Menu</button>

That's why this generator never writes javascript: (or data: and vbscript:) addresses. For something that happens on the page, use the HTML Button Generator.

What This Generator Can't Do

Putting a page together? Try your code in the HTML Editor and check it with the HTML Validator.

Frequently Asked Questions

How do I make a link in HTML?

Use the a tag with the address in href: <a href="https://example.com">Visit Example</a>. The words between the tags are what people see and click. For a page on your own site, a path is enough, like <a href="/contact">Contact us</a>. The generator writes the tag for you, with the address checked and the text escaped.

How do I make a link open in a new tab?

Add target="_blank" and rel="noopener noreferrer": <a href="https://example.com" target="_blank" rel="noopener noreferrer">Example</a>. Switch on "Open in a new tab" in the generator and both are added. Use it sparingly, and say so in the link text, because a tab that opens on its own can confuse people.

What does rel="noopener noreferrer" do?

A page opened with target="_blank" could reach back to your tab through window.opener and send it somewhere else, an old phishing trick. noopener cuts that link. noreferrer also stops the browser from telling the other site which page the visitor came from. If you want the other site to see you in its stats, use noopener alone.

How do I make an email link with a subject and message?

Start with mailto: and the address, then add ?subject= and &body=, with spaces and symbols encoded: <a href="mailto:[email protected]?subject=Hello%20there&amp;body=Hi%21">Email us</a>. A space becomes %20 and a line break %0D%0A. Pick Email in the generator, type the subject and message as normal text, and it encodes everything for you.

How do I make a clickable phone number?

Use tel: with only digits and a + with the country code: <a href="tel:+15551234567">Call +1 (555) 123-4567</a>. The visible text can be formatted any way you like. On a phone it opens the dialer. For a text message, use sms: instead, and add ?body= to fill in the message on most phones.

How do I link to a section on the same page?

Give the section an id, like <h2 id="prices">Prices</h2>, then link to it with a # in front: <a href="#prices">Jump to prices</a>. Ids are case-sensitive, can’t have spaces and must be unique on the page. To jump to a section on another page, add the id to the address: /faq#shipping.

How do I make a link download a file?

Add the download attribute: <a href="/files/report.pdf" download>Download the report</a>. Give it a value, like download="report-2026.pdf", to choose the saved file name. It only works for files on your own site; for files on other sites the browser ignores it and just opens the file.

How do I remove the underline from a link?

Set text-decoration: none in your CSS, for example .my-link { text-decoration: none; }. Then make the link stand out in another way, like a different color plus bold text, or bring the underline back on hover. Otherwise people who don’t see colors well can miss it. Pick "Never" or "Only on hover" under Underline in the generator to get the CSS.

When should I use nofollow, sponsored or ugc?

Most links need none of them. Use sponsored for paid and affiliate links, ugc for links other people posted (comments, forums, reviews), and nofollow for a page you link to but don’t want to vouch for. They only tell search engines how to treat the link; visitors see no difference.

Does this tool check if my link works?

No. Nothing is fetched or visited, so it can’t tell whether the page exists or the email address is real. It checks how the link is written: missing https://, spaces, an email address that looks wrong, vague text like "click here", unsafe addresses like javascript: (which it never writes). Click the link on your own site once it’s live to make sure it goes to the right place.