How to Open Links in a New Tab using target="_blank" in HTML

Introduction: What Does _blank Mean in HTML?

When you click a link on a website, it usually opens in the same browser tab.
Sometimes, you want the link to open in a new tab or window instead.

This is where _blank in HTML is used.

You’ve probably seen code like this:

<a href="https://example.com" target="_blank">Visit Site</a>

This guide explains what _blank is, how it works, when to use it, and best practices—all in a clear, beginner-friendly way.

Basic Syntax of _blank

<a href="https://example.com" target="_blank">Open in New Tab</a>

Explanation

  • <a> → Anchor tag

  • href → Destination URL

  • target="_blank" → Open link in a new tab

Example 1: Simple External Link

<a href="https://www.google.com" target="_blank">Google</a>

Output Explanation

  • Clicking the link opens Google

  • Your current page stays open

Common target Attribute Values

ValueMeaning
_selfOpens in same tab (default)
_blankOpens in new tab
_parentOpens in parent frame
_topOpens in full window

When Should You Use target="_blank"?

Good Use Cases

  • External websites

  • Documentation links

  • Third-party resources

  • Download pages

  • References

Avoid Using _blank For

  • Internal navigation

  • Forms

  • Primary site flow

 Overusing _blank can confuse users.

Security Issue with _blank (Very Important)

Using _blank without precautions can cause a security vulnerability called reverse tabnabbing.

 Unsafe Example

<a href="https://example.com" target="_blank">Link</a>

Safe Way to Use _blank (Best Practice)

Always add rel="noopener noreferrer".

Secure Example

 
<a href="https://example.com" target="_blank" rel="noopener noreferrer"> Secure Link </a>

Why This Matters

  • Prevents malicious page access

  • Improves performance

  • Recommended by modern browsers

Using _blank with Images

 
<a href="https://example.com" target="_blank" rel="noopener noreferrer"> <img src="logo.png" alt="Company Logo"> </a>

Using _blank for Download Links

 
<a href="file.pdf" target="_blank" rel="noopener noreferrer"> Download PDF </a>

Accessibility Considerations

Opening new tabs without warning can confuse screen reader users.

Best Accessibility Practice

  • Inform users that the link opens in a new tab

<a href="https://example.com" target="_blank" rel="noopener noreferrer" aria-label="Opens in new tab"> Visit Example </a>

Or use visible text:

Visit Example (opens in new tab)

SEO Impact of _blank

  • _blank does not directly affect SEO rankings

  • Overuse may increase bounce rates

  • Proper user experience is more important

 Use _blank only when it improves usability.

Common Beginner Mistakes

  • Using _blank on every link
  •  Forgetting rel="noopener noreferrer"
  •  Using _blank for internal links
  •  Not informing users
  •  Confusing _blank with _self

_blank vs _self (Quick Comparison)

Feature_blank_self
Opens new tab Yes No
Default behavior No Yes
Best for external links Yes No
Requires rel attributeYes No

Real-World Example

<p>
  Learn more on
  <a href="https://developer.mozilla.org"
     target="_blank"
     rel="noopener noreferrer">
     MDN Web Docs
  </a>
  (opens in a new tab).
</p>

FAQs: _blank in HTML

What does _blank do in HTML?

It opens a link in a new tab.

Is _blank bad practice?

No, but it should be used carefully and securely.

Should I always use _blank for external links?

Not always—use it when it benefits the user.

What happens if I don’t use rel="noopener"?

It may expose your site to security risks.

Can _blank open a new window instead of a tab?

It depends on browser settings.