Xerobit

Hyperlink Generator: Create Anchor Tags and Link Code

Enter a URL and link text to generate an HTML anchor tag, Markdown link, BBCode or reStructuredText reference instantly. This hyperlink generator handles attribute escaping, target blank, and rel tokens like nofollow and sponsored. It runs entirely in your browser so nothing is uploaded anywhere.

Adds target="_blank" and rel="noopener noreferrer"

Tells search engines not to follow the link

Marks the link as paid or sponsored content

Generated code

<a href="https://example.com">Example</a>

How the HTML anchor tag is built

The core of any HTML link is the <a> element. This hyperlink generator constructs it by combining the URL, text, optional title, target and rel attributes in the correct order. The formula is straightforward: start with <a href="URL">, append title="..." if provided, then target="_blank" if the new tab option is checked.

When target="_blank" is present, the generator automatically adds rel="noopener noreferrer" to prevent the opened page from accessing the original window object. If you also check nofollow or sponsored, those tokens are appended in order. For example, linking to a site with text "Example", opening in a new tab with nofollow produces:

<a href="URL" target="_blank" rel="noopener noreferrer nofollow">Example</a>

Escaping special characters

User-provided text and URLs often contain characters that break HTML syntax. This html link generator escapes four characters in both attribute values and link text: ampersand becomes &amp;, double quote becomes &quot;, less-than becomes &lt; and greater-than becomes &gt;. Without escaping, a title like He said "hello" would prematurely close the attribute value and corrupt the markup.

In Markdown, the link text is placed inside square brackets and the URL inside parentheses. Square brackets and backslashes in the link text are escaped with a backslash, spaces and parentheses in the URL become %20, %28 and %29, and double quotes in the title are escaped so they cannot end the title early. BBCode uses simple bracket tags and does not require HTML entity escaping, though some forum software may apply its own filters.

Links are also checked before any code is produced. The hyperlink generator uses an allowlist: http://, https://, mailto:, tel:, relative paths beginning with /, ./ or ../, protocol-relative //host links and #fragment links are accepted, and every other scheme is rejected. Browsers ignore tabs, line breaks and leading control characters inside a URL, so a link like java[tab]script: would still run code. For that reason any URL containing a control, zero-width or other invisible character is refused outright rather than cleaned up. A bare domain such as example.com is rejected with a hint to add https://. In Markdown, BBCode and reStructuredText output, brackets, angle brackets, quotes and backticks inside the URL are percent-encoded so they cannot break out of the link.

Common rel attribute values

The rel attribute tells browsers and search engines how to treat the link. Here is a reference table of the tokens this anchor tag generator supports:

TokenPurpose
noopenerPrevents the new page from accessing window.opener. Always added with target="_blank".
noreferrerOmits the Referer HTTP header. Also prevents window.opener access. Always added with target="_blank".
nofollowTells search engines not to pass ranking credit through this link. Used for untrusted or user-generated content.
sponsoredIdentifies links created as part of advertising, sponsorships or other compensation agreements.

You can combine these tokens. When multiple values are present, they are separated by spaces in the order: noopener, noreferrer, nofollow, sponsored.

Format comparison

Different platforms require different link syntaxes. This link code generator supports four common formats:

  • HTML: The standard <a> tag used on websites and in email templates.
  • Markdown: Uses [text](url "title") syntax, common in README files, blogs and documentation tools.
  • BBCode: Uses [url=URL]text[/url], the standard for many forum platforms.
  • reStructuredText: Uses backtick-wrapped inline references like `text <url>`_, popular in Python documentation.

Selecting the right format ensures the link renders correctly without manual editing. If you need to preview the rendered HTML output, you can pair this tool with an HTML viewer to verify the result visually.

Practical use cases

Web developers and content creators use an html a tag generator to avoid typing errors in repetitive markup. Common scenarios include building navigation menus where every link needs target="_blank" and the corresponding security attributes, creating affiliate links that require both nofollow and sponsored rel values, and drafting Markdown documentation where consistent link formatting matters.

Forum moderators frequently need BBCode links with specific display text. Rather than remembering the exact bracket syntax each time, generating it ensures consistency across posts. Similarly, technical writers working in reStructuredText benefit from automated generation because the backtick and underscore syntax is easy to mistype manually.

Worked examples

ExampleInputResult
Basic HTML linkURL: https://example.com; Link text: Example; Open in new tab: no; Add nofollow: no; Add sponsored: no; Output format: html<a href="https://example.com">Example</a>
New tab with nofollowURL: https://example.com; Link text: Example; Open in new tab: yes; Add nofollow: yes; Add sponsored: no; Output format: html<a href="https://example.com" target="_blank" rel="noopener noreferrer nofollow">Example</a>
Markdown with titleURL: https://example.com; Link text: Example Site; Title (optional): Visit Example; Open in new tab: no; Add nofollow: no; Add sponsored: no; Output format: markdown[Example Site](https://example.com "Visit Example")
BBCode forum linkURL: https://example.com; Link text: Click here; Open in new tab: no; Add nofollow: no; Add sponsored: no; Output format: bbcode[url=https://example.com]Click here[/url]

FAQ

What is a hyperlink generator?

A hyperlink generator creates properly formatted link code for HTML, Markdown, BBCode or reStructuredText. You provide the URL and display text, and it outputs the ready-to-use markup with correct syntax and escaping.

Why does opening a link in a new tab add noopener and noreferrer?

Using target="_blank" without rel="noopener noreferrer" allows the newly opened page to access the original page's window object. Adding these tokens prevents potential security vulnerabilities and is considered a best practice.

When should I use nofollow versus sponsored?

Use nofollow for links you do not want search engines to count as endorsements, such as user-generated comments. Use sponsored specifically for links that are part of paid advertisements, sponsorships or affiliate arrangements.

Does this tool escape special characters in my URL or text?

Yes. For HTML output, the characters &, ", ', < and > are converted to HTML entities, which prevents broken markup. The tool also uses an allowlist for URLs: it accepts only http://, https://, mailto:, tel:, relative paths starting with /, ./ or ../, protocol-relative //host links and #fragments. Anything else, including javascript:, vbscript:, data: and file:, is rejected, as is any URL with a tab, line break, zero-width or other hidden character. It does not check that a URL exists or is safe to visit.

Can I add a tooltip to the link?

Yes. Enter text in the Title field to add a title attribute in HTML or a quoted title in Markdown. The title typically appears as a tooltip when a user hovers over the link in a browser.

Is my data sent to a server?

No. This tool runs entirely in your browser. The URL, text and options you enter never leave your device.

Why was my URL rejected?

The URL either contains a hidden or control character, a backslash, or does not start with an allowed form. Add https:// to a bare domain such as example.com, remove stray spaces or line breaks, and avoid schemes other than http, https, mailto and tel.