<base target=""> HTML Attribute

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
<base> HTML Tag
What does <base target=""> HTML Attribute do?
Specifies the default target value for all anchor links in the current document.

Example Code

<head> . . . <base target="_blank"> 

Opening all Links in a New Tab

Setting the target attribute to _blank in the <base> element will cause all on-page links to open in a new tab. You should think carefully before implementing this, as your users may or may not appreciate this behavior.

Opening only outbound links in a new tab

If you only want outbound links (links to a different domain) to open in a new window, you should not use the <base> attribute. Instead, you can use JavaScript. Opening only outbound links in a new tab is more common, and user-friendly, behavior than opening all links that way.

Adam is a technical writer who specializes in developer documentation and tutorials.