What does an HTML link generator do?
An HTML link generator writes the anchor element, <a href="…">text</a>, that turns words on a page into a clickable link. This one takes a URL, optional link text and an optional "open in new tab" setting, escapes the characters that would break the markup, and returns a single line of HTML you can paste into a page, email template or CMS source view.
Three outputs, side by side
Each line below was produced by the tool:
<a href="https://example.com/">https://example.com/</a>
<a href="https://example.com/docs?tab=api&lang=en" target="_blank" rel="noopener noreferrer">API docs</a>
<a href="https://example.com/">Fish & <Chips></a>
The first had no link text, so the URL was used. The second had the link text API docs and Open in new tab ticked; note that the & between query parameters became &, which is the correct way to write it inside an HTML attribute and is decoded back before the browser follows the link. The third had the text Fish & <Chips>, escaped so the angle brackets show as text instead of being read as a tag.
Escaping covers &, <, > and " in both the URL and the text. Spaces at either end of each field are trimmed. Nothing else changes, so the tool won't percent-encode spaces or non-ASCII characters inside the URL. If your address has those, run it through the URL encoder first.
How to create a link
- Paste the destination URL into the input.
- Type the link text, or leave it blank to show the URL.
- Tick Open in new tab if the link should open separately.
- Click Generate, then Copy.
- Paste the line into your HTML. To see how it renders first, paste it into the HTML viewer, which shows it in a sandboxed preview.
Attributes: what the tool adds and what you can add by hand
| Attribute | Added by the tool? | What it does |
|---|---|---|
href |
Always | The destination. Google can only reliably crawl links that are <a> elements with an href |
target="_blank" |
With the new-tab option | Opens the link in a new tab or window |
rel="noopener" |
With the new-tab option | The new page gets no window.opener reference to yours |
rel="noreferrer" |
With the new-tab option | No Referer header is sent; also implies noopener |
rel="sponsored" |
No | Marks paid, affiliate or advertising links for Google |
rel="ugc" |
No | Marks links inside user-generated content |
rel="nofollow" |
No | Asks Google not to associate your site with the target |
download |
No | Downloads the file instead of navigating (same-origin URLs only) |
hreflang |
No | Hints at the language of the destination |
Sources: MDN's <a> reference, MDN on noreferrer and Google's guide to qualifying outbound links. Several rel values can go in one attribute separated by spaces, for example rel="sponsored noopener noreferrer".
Think about noreferrer before you keep it. It's sensible for links to untrusted sites, but if you're linking to a partner who tracks referral traffic, removing it lets their analytics credit your page. noopener alone still keeps the security benefit.
Writing link text people and crawlers understand
Google's link best practices describe good anchor text as "descriptive, reasonably concise, and relevant" to both pages, and call out "click here" and "read more" as too generic. MDN gives the same advice for accessibility: screen-reader users often jump through a list of links, so each one should make sense on its own. "Download the 2026 rate card (PDF)" beats "here".
If you use the new-tab option, say so in the text. MDN recommends signalling links that open a new tab, for example by adding "(opens in new tab)", because an unexpected new window can confuse people using screen readers or magnification.
Things the generator doesn't stop
It won't reject a javascript: URL. Google's link guidance marks script-based href values as not recommended, and MDN recommends a <button> for anything that runs script rather than navigating. It also won't warn about a typo in the domain or a page that returns 404. After publishing, scan the page with the broken link checker.
Everything runs in your browser; the URL and text aren't sent anywhere. For more on how links and other elements fit together, the HTML lessons cover the basics.
Last updated