The HTML target attribute
The HTML target attribute specifies where to open the linked URL or form response. It is used on the <a>, <area>, <form> and <base> elements.
Overview
The target attribute specifies where to open a link's destination (on <a> and <area>) or a form's response (on <form>). By far the most common value is _blank, which opens in a new tab or window.
There are four keyword values: _self (the default — the same browsing context), _blank (a new tab or window), _parent (the parent frame) and _top (the full window, breaking out of any frames). You can also give a name to reuse a specific browsing context across several links.
When you use _blank, the newly opened page could in older browsers reach back through window.opener. Modern browsers add rel="noopener" implicitly, but set rel="noopener noreferrer" explicitly for safety and privacy. And use new tabs sparingly — opening them unexpectedly can disorient users, so signal it in the link text or with an icon.
Syntax
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Opens in a new tab</a>
Values
| Value |
|---|
| _self (default) | _blank | _parent | _top | a named browsing context |
Best practices
- Use
target="_blank"sparingly — unexpected new tabs can disorient users. - Pair
_blankwith rel="noopener noreferrer"for security in older browsers. - Signal that a link opens in a new tab (in the text or with an icon) for accessibility.
- Use the default
_selffor ordinary in-page navigation.
Frequently asked questions
How do I open a link in a new tab?
target="_blank" to the <a>.What are the target keyword values?
_self (same context, the default), _blank (new tab), _parent (parent frame) and _top (full window).Is target="_blank" a security risk?
window.opener. Modern browsers mitigate it, but add rel="noopener noreferrer" to be safe.