HTML link generator — a tags with target, rel and download

Enter a URL and link text and get a correct a tag, with rel="sponsored", "nofollow" or "ugc" when you need them, noopener added automatically for new-tab links, and a warning when the link text says nothing about the destination.

Live demo · real result from this tool
Open in

Press Generate to create a result.

Processed on your device — nothing is uploaded.

  1. Enter the URL and the Link text. If the text is empty, the URL is used as the text.
  2. Add a Title (tooltip, optional) only if it adds information; screen readers often ignore it.
  3. Choose Open in: Same tab or New tab.
  4. Tick the rel values you need: rel="nofollow", rel="sponsored" (paid/affiliate), rel="ugc" (user content). Tick download (save instead of open) for a file link, and fill hreflang (optional) for a page in another language.
  5. Copy the code and read any notes below it.

What it does and when to use it

The a element is the most common tag on the web, and its attributes carry rules that are easy to forget: rel values that search engines expect on paid links, the security pair for new tabs, the download flag for files. The generator applies them for you and keeps the attributes in a consistent order.

It also checks the most common accessibility mistake. Screen-reader users often jump from link to link and hear only the link text, so “click here”, “here”, “read more” or “link” tells them nothing. The tool warns when the text is one of those.

For buttons that perform an action rather than go somewhere, use a button instead; the HTML Button Generator builds one. For a whole menu of links, use the HTML Nav Menu Generator.

How it works

Attributes are written in this order: href, title, target, rel, hreflang, download. target appears only for a new tab. The rel list joins your ticked values and, for a new tab, noopener noreferrer. Values are HTML-escaped, so a URL with & becomes & inside the attribute, which is correct HTML. Everything runs in your browser.

Worked examples

A plain internal link, the default:

<a href="https://toolsrift.com/pdf/pdf-merger">Merge PDFs in your browser</a>

An affiliate link to a German shop, in a new tab, with nofollow and sponsored ticked and hreflang de:

<a href="https://shop.example/item" target="_blank" rel="nofollow sponsored noopener noreferrer" hreflang="de">Desk lamp on Example Shop</a>

A note reminds you to tell visitors that the link opens a new tab.

A file download with weak text. URL https://example.com/report.pdf, text “click here”, download ticked. The output is <a href="https://example.com/report.pdf" download>click here</a> plus the warning that “click here” tells screen-reader users nothing. “Download the 2026 report (PDF)” is better.

Limits and tips

  • The tool does not check that the URL works. Test it after publishing.
  • Use relative URLs such as /contact for pages on your own site so links survive a domain change.
  • To collect every link on an existing page, use the HTML Attribute Extractor with the elements set to a and the attribute to href.

Frequently asked questions

Which rel value should I use for affiliate links?
Use sponsored for paid placements, adverts and affiliate links, ugc for links inside comments or forum posts, and nofollow for any other link you do not want to vouch for. You can combine them; search engines treat each as a hint.
Why is noopener noreferrer added to new-tab links?
A page opened with target _blank could otherwise reach back to your tab through window.opener and redirect it, a trick used for phishing. noopener cuts that link. noreferrer also stops the browser from sending your page address to the other site. Modern browsers apply noopener by default, but adding it costs nothing and covers older ones.
Should links open in a new tab?
Usually not. People can choose to open a new tab themselves, and an unexpected new tab breaks the Back button. If you do it, say so in the link text or with an icon and hidden text, as the tool's note reminds you.
Does download work for files on other websites?
Only for files on your own site, or data and blob URLs. For a file on a different domain, browsers ignore the download attribute and simply open the link, unless the server itself sends the file as an attachment.
What is hreflang for?
It tells the browser and search engines the language of the page you link to, for example de or pt-BR. It is a hint only; it does not translate anything.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close