Format Code Now
/
Web & markupHTML Link Generator Next: HTML Meter Generator ›

HTML Link Generator

WM-34

Type the link text and an href, choose target and rel, and copy an anchor element. Ampersands in the address are escaped for you.

Runs in your browser. Nothing is uploaded.

Link text (required line: href:; optional: hreflang:, download:, title:)

HTML

How to use it

  1. Type the link text, then an href: line with the address.
  2. Add title:, hreflang: or download: lines if you need them.
  3. Choose target and rel.
  4. Copy the a element.

target, rel and new tabs

target="_blank" opens the link in a new tab. Modern browsers treat it as if rel="noopener" were also set, so the new page cannot reach your window through window.opener, but older browsers do not, which is why rel is still offered. noreferrer also hides the address of your page from the destination, and nofollow tells search engines you do not vouch for the link. Opening in a new tab takes control from the visitor, so use it sparingly.

Escaping and download

A bare ampersand in an href should be written as & in HTML, so a query string such as ?a=1&b=2 comes out as ?a=1&b=2, and the browser reads it back correctly. The download attribute asks the browser to save the file, with the value as its suggested name. Browsers only honor it for same-origin links. The tool does not check that the address exists or that the text is meaningful; avoid text such as click here.

Error messages and what to do

MessageWhat it meansFix
Add an "href:" line with the address the link points to.No href: line was found.Add href: and the address.
Links that start with javascript: or vbscript: are not generated. Use a normal URL.The address used a script scheme.Use an http or https address.

Questions people ask

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

Add target="_blank", using the target select. Consider also adding rel="noopener noreferrer" for older browsers. Tell users the link opens a new tab if it is not obvious.

What does rel noopener do?

It stops the opened page from getting a reference to your page through window.opener. Current browsers apply it automatically for target="_blank", so adding it mostly helps older ones.

How do I write an ampersand in an href?

Write it as &. The generated markup does this for you, and the browser turns it back into & when it reads the link. Writing a bare ampersand usually still works in browsers, but escaping is the correct form and avoids edge cases.

How do I make a download link in HTML?

Add the download attribute, with a file name as its value if you want to suggest one. It works for same-origin links, so a file on another site will usually open instead of saving.

What does nofollow mean on a link?

It is a hint to search engines that you do not endorse the target, often used for paid or user-submitted links. It does not change how the link behaves for visitors.

About this tool

Writes one a element with the attributes you set. The link text and every attribute value are escaped, so an & in a query string comes out as &, which is the correct way to write it in HTML. rel only takes the choices in the select, and it is written whether or not target is set. Modern browsers treat target="_blank" as if noopener were set, but writing it is harmless and older browsers need it. download: with no value adds the bare attribute; with a value it suggests that file name, and browsers only honor it for same-origin links. Addresses starting with javascript: or vbscript: are refused. The tool does not check that the address exists.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.