To open a link in a new tab in HTML, add target="_blank" to the <a> (anchor) element.
<a href="https://example.com" target="_blank">Open Example</a>
The target="_blank" attribute tells the browser to open the linked document in a new browsing context, which commonly appears as a new browser tab. Depending on the browser and the user’s settings, it can also open in a new window.
Basic HTML Syntax
The standard syntax is:
<a href="URL" target="_blank">Link Text</a>
For example:
<a href="https://www.google.com" target="_blank">Visit Google</a>
When the user clicks the link, the browser opens the destination separately from the current page.
The important part is:
target="_blank"
The _blank value means the link should be opened in a new browsing context.
Use rel="noopener" for External Links
For links that open in a new tab, it is good practice to use rel="noopener":
<a href="https://example.com" target="_blank" rel="noopener">
Open Example
</a>
rel="noopener" prevents the newly opened page from using the window.opener reference to interact with the page that opened it.
This is particularly relevant when linking to external websites. It separates the new page from the original page’s opener relationship while still allowing the destination to open in a new tab.
For modern HTML, this is a commonly recommended pattern:
<a href="https://example.com" target="_blank" rel="noopener">
Visit Example
</a>
What Does target="_blank" Do?
The target attribute determines where the linked resource is opened.
For example:
<a href="/about" target="_self">About</a>
_self opens the link in the current browsing context.
<a href="/about" target="_blank">About</a>
_blank opens the link in a new browsing context.
Other target values include _parent and _top, which are mainly relevant when working with nested browsing contexts such as frames.
For the specific requirement of opening a link in a new tab, _blank is the relevant value.
Opening Internal Links in a New Tab
You can use the same method for pages on your own website.
<a href="/contact/" target="_blank" rel="noopener">
Contact Us
</a>
This opens the /contact/ page separately from the current page.
You can also use an absolute URL:
<a href="https://example.com/contact/" target="_blank" rel="noopener">
Contact Us
</a>
Both approaches work. The difference is whether the destination is specified as a relative URL or a complete URL.
Opening an Image or Other Resource in a New Tab
The same target="_blank" behavior can be used when the anchor points to another type of resource.
For example:
<a href="/images/photo.jpg" target="_blank" rel="noopener">
Open Image
</a>
The browser can open the linked resource in a separate browsing context.
Does HTML Guarantee a New Tab?
No. HTML specifies a new browsing context for target="_blank", but it does not guarantee that the browser will physically display it as a tab.
Modern desktop browsers commonly use a new tab, but the final behavior can depend on browser implementation and user preferences.
Therefore, the technically accurate statement is that target="_blank" requests a new browsing context. In typical desktop browsing, that usually means a new tab.
Can You Open a Link in a New Tab Without JavaScript?
Yes.
You do not need JavaScript for a standard link to open in a new tab.
Use:
<a href="https://example.com" target="_blank" rel="noopener">
Open Link
</a>
JavaScript is unnecessary for this basic requirement.
Using JavaScript such as window.open() introduces additional complexity and can also be affected by browser popup-blocking rules.
For a normal hyperlink, HTML is the appropriate solution.
Common Mistake: Using target="_new"
A common mistake is writing:
<a href="https://example.com" target="_new">Open Link</a>
_new is not the standard special target keyword for requesting a fresh browsing context in the way _blank is.
Use:
target="_blank"
instead.
Common Mistake: Forgetting the href Attribute
This is incomplete:
<a target="_blank">Open Link</a>
The anchor should normally have an href containing the destination:
<a href="https://example.com" target="_blank" rel="noopener">
Open Link
</a>
The href specifies where the user should be taken. The target specifies where that destination should be opened.
Complete Example
Here is a complete HTML document containing a link that opens in a new tab:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Tab Link</title>
</head>
<body>
<a href="https://example.com" target="_blank" rel="noopener">
Open Example in a New Tab
</a>
</body>
</html>
When the link is clicked, the browser is instructed to open https://example.com in a new browsing context.
The Exact Answer
If the question is simply “How to open a link in a new tab HTML?”, the answer is:
<a href="https://example.com" target="_blank" rel="noopener">
Open Link
</a>
Use target="_blank" to request that the link open in a new browsing context. Adding rel="noopener" is recommended for links opened this way, particularly when the destination is an external website.
No JavaScript is required for a standard HTML hyperlink.
More Guide On HTML
How To Change Plain Text Email To Html
How To Make Text Wrap Around An Image In Html
Are Html And Css Programming Languages
Do My Html Homework
How To Add Alt Tags To Images In Html
How To Create Multiple Web Pages In Html
How To Import An Html File Into Excel
How To Integrate WordPress Blog Into Html Website
How To Link A Css File To An Html File


