FormatterHQ

HTML Link Generator

Build a correct <a href> tag in seconds: link text, title, open in a new tab, nofollow or sponsored rel values and basic inline styles.

Output HTML
Ready.

How to use the HTML Link Generator

  1. Enter the URL and the text people should click.
  2. Add an optional title and choose whether the link opens in a new tab.
  3. Select rel options such as nofollow or sponsored if they apply.
  4. Optionally set a color, bold text or remove the underline, then copy the generated tag.

Anatomy of an HTML link

A hyperlink in HTML is an <a> (anchor) element. Its href attribute holds the destination, and the content between the tags is what visitors click. This HTML link generator assembles the tag with correctly quoted and escaped attributes, so special characters in URLs or text cannot break your page.

<a href="https://example.com" target="_blank" rel="noopener noreferrer nofollow">Visit Example</a>

HTML link generator options explained

  • Title – shown as a tooltip on hover. It is optional and should add information rather than repeat the link text.
  • Open in new tab – adds target="_blank" together with rel="noopener noreferrer". noopener stops the new page from controlling your page through window.opener, and noreferrer also withholds the referring URL.
  • nofollow – tells search engines you do not vouch for the destination. Use it for links you do not want to endorse, such as user-submitted links.
  • sponsored – marks paid, affiliate or otherwise compensated links, as Google's guidelines ask. You can combine it with nofollow.
  • Color, bold, underline – simple inline styles for places where you cannot edit the stylesheet, such as some CMS fields or email signatures.

Writing good link text

Link text matters for both accessibility and search. Screen-reader users often jump from link to link, hearing only the text, so vague words such as "here" or "read more" tell them nothing. Descriptive text such as "download the 2026 price list (PDF)" works for everyone and gives search engines context about the target page.

Absolute vs relative URLs

An absolute URL (https://example.com/pricing) works anywhere, including emails and other websites. A root-relative URL (/pricing) only works on your own site but survives a domain change. Use absolute URLs for anything that leaves your site.

Useful href values beyond web pages

  • #pricing jumps to the element with id="pricing" on the same page, handy for tables of contents.
  • /guides/setup#install opens another page and scrolls to a section on it.
  • tel:+442071234567 starts a call on phones. Use the international format with a plus sign and no spaces.
  • mailto: links open an email draft; the mailto link generator encodes a subject and body for you.

Whichever destination you choose, test the link after publishing: a typo in a fragment or path fails silently.

Safety checks

The generator escapes quotes and ampersands in the URL and text, and it refuses javascript: URLs, which can run code when clicked. Links to mailto: and tel: addresses work normally, for example mailto:hello@example.com.

Need other formats?

If the same link is also going into a README or a forum post, the hyperlink generator produces HTML, Markdown and BBCode versions at once. URLs with spaces or special characters should be encoded first with the URL encoder, and you can test many links on a page with the broken link checker.

The tag is generated in your browser; nothing is stored.

Frequently asked questions

Should I add rel="noopener" to links that open in a new tab?
Yes. The generator adds noopener and noreferrer automatically when you choose a new tab. Modern browsers imply noopener for target="_blank", but adding it explicitly protects older browsers too.
What is the difference between nofollow and sponsored?
sponsored identifies paid or affiliate links specifically, while nofollow is a general signal that you do not endorse the destination. Google accepts either for paid links, and they can be combined.
Why are javascript: links not allowed?
javascript: URLs run code when clicked and are a common way to inject malicious scripts. Use a button with an event handler for actions instead of a link.
Can I create an email link?
Yes. Enter a URL such as mailto:hello@example.com and the generated anchor opens the visitor’s email program.

Last updated September 26, 2026

Related tools

Mailto Link Generator Create mailto: links with pre-filled recipients, CC, BCC, subject and body — correctly URL-encoded, with the HTML <a> tag. WhatsApp Link Generator Create a wa.me click-to-chat link with a pre-filled message for your website, e-mail signature or QR code. Broken Link Checker Find broken links on a web page: every link is checked and 404s, errors and redirects are listed. HTML Table Generator Generate HTML table code with any number of rows and columns, header row, caption, border and padding - with live preview. Favicon Generator Make favicon.ico, Apple touch and Android icons plus site.webmanifest and HTML tags from an image or from text/emoji. ZIP download. Hreflang Tag Generator Generate hreflang annotations for multilingual sites as <link> tags, sitemap entries or HTTP headers, with code validation. HTML Pretty Print Opinionated HTML pretty print with Prettier: closes implied tags, enforces a line width and gives the same output for any input layout. HTML to BBCode Converter Convert HTML into forum-friendly BBCode: bold, links, images, lists, quotes, tables, code blocks and inline colours. HTML to Jade Converter Turn HTML into Jade syntax for legacy .jade views, using only markup that also keeps working after an upgrade to Pug. HTML to JSX Converter Convert HTML markup to valid JSX for React: className, htmlFor, style objects, self-closing tags and comments handled automatically. HTML to PHP Converter Convert HTML into PHP echo statements, a string variable or a heredoc block with every quote and dollar sign safely escaped. HTML to Pug Converter Convert HTML to Pug template syntax: indentation-based tags, #id and .class shortcuts, attributes and text blocks.