Anchor Tag & Hyperlink Code Generator
Enter URL, link text, and attributes to instantly generate a complete HTML anchor tag with live preview
Fill in a URL, pick your target and rel attributes, and grab a finished <a> tag in one step — no more hand-typing href values or forgetting to close quotes. The code updates on every keystroke so you can see exactly what you're getting before you paste it anywhere.
And everything runs in your browser. Nothing gets uploaded.
How It Works
You fill in the URL and optional link text. Then set whichever attributes you need — target, rel values, title, class, or ID. The tool assembles a valid <a> element on every keystroke, so you see the result immediately. Hit copy, paste it into your HTML. Done.
Examples
Basic External Link
Linking to an external site from a blog post — opens in a new tab with security attributes.
URL: https://example.com
Text: Visit Example
Target: _blank
Rel: noopener, noreferrer
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Visit Example</a>
Affiliate Link with Nofollow
Paid product recommendation in a review article. Search engines need to know it's sponsored.
URL: https://store.example.com/product
Text: Get 20% Off
Target: _blank
Rel: nofollow, sponsored, noopener
Title: Limited time deal
<a href="https://store.example.com/product" target="_blank" rel="nofollow sponsored noopener" title="Limited time deal">Get 20% Off</a>
Styled Internal Navigation Link
Same-site link that needs a CSS class and ID for JavaScript targeting or custom styling.
URL: /pricing
Text: See Plans
Target: _self
Class: btn btn-primary
ID: pricing-cta
<a href="/pricing" target="_self" class="btn btn-primary" id="pricing-cta">See Plans</a>
Who Uses This
Quickly scaffold anchor tags with the right rel and target combos instead of typing them from memory.
Drop properly formatted links into WordPress or static site HTML without guessing at syntax.
Generate links with correct nofollow, sponsored, or ugc attributes for Google compliance.
Learn what each anchor tag attribute does by toggling options and watching the code change live.
Common Mistakes
Opening a link in a new tab without noopener gives the target page access to your page's window.opener object. That's a real security hole. This tool auto-checks noopener and noreferrer when you pick _blank, so you won't miss it.
Nofollow tells search engines to ignore the link. If you're linking to a trusted resource or citing a source, that's not what you want. Reserve nofollow for affiliate links, ads, or untrusted content. Overusing it can actually hurt your own SEO.
Screen readers announce link text out of context. "Click here" means nothing on its own. Write something descriptive — "View the pricing page" or "Read the full report." Both accessibility and SEO improve when link text actually describes the destination.
Technical Details
- Processing: 100% client-side — nothing leaves your browser
- Browser Support: Chrome, Firefox, Safari, Edge
- Output Format: Valid HTML5 anchor tag
- Supported Attributes: href, target, rel (nofollow, noopener, noreferrer, sponsored, ugc), title, class, id
Frequently Asked Questions
What is an HTML anchor tag?
It's the <a> element — the thing that makes text or images clickable on a webpage. The href attribute tells the browser where to go when someone clicks it. Every hyperlink you've ever clicked on the web was built with one of these.
When should I use target="_blank"?
Use it when you want the link to open in a new tab. This is common for external links so visitors don't lose their place on your site. Just make sure rel="noopener noreferrer" is there too — it plugs a security gap where the new page could mess with your original window.
What's the difference between nofollow, sponsored, and ugc?
Nofollow is the general "don't pass SEO value" signal. Sponsored is specifically for paid links and ads — Google introduced it in 2019 as a clearer alternative. UGC stands for user-generated content, meant for links people add in comments or forums. You can combine them if needed.
Do I need both noopener and noreferrer?
Modern browsers treat target="_blank" as noopener by default now. But older browsers don't. Adding both explicitly covers you everywhere. Noreferrer also stops the destination site from seeing where the click came from, which is sometimes what you want for privacy.
Is the data I enter here private?
Yes. The tool runs entirely in JavaScript inside your browser. Nothing gets sent to a server — not the URLs, not the link text, none of it. You can disconnect from the internet and it still works perfectly. Your data stays on your machine.