HTML <base> Tag

By Jonathan Griffin. Editor, SEO Consultant, & Developer.

· 2 min read


The <base> Tag specifies the base URL for all relative URLs used in your web page.


  <base href="" target="_blank">

<a href="/seo/">View SEO articles</a>.


  • There can only be one <base> element in a document. If multiple are used, only the first href and target attributes are used.

  • The <base> element must be contained in the <head>. It must come before any other elements with attribute values of URLs, such as the <link> element’s href attribute.

  • The <base> element does not have a closing tag.

  • In-page anchors use the <base>. If you wish to link to something on the same page, you will also need to specify the directory in the href attribute.

    For example:

      <base href="" target="_blank">
    <p><a href="#best-practices">View best practices</a> links to</p>
    <p><a href="develop/reference/html/tags/base/#best-practices">View best practices</a> links to</p>

  • Open Graph tags do not use <base>.


The Base element supports the Global Attributes, as well as the following:

  • href

    The href attribute specifies the base URL of the page used for all relative links.

    <a href="" >Visit The Webmaster</a>
  • target

    The target attribute when used with the <base> element specifies the default way to open <a>, <area>, or <form> elements. You can override it by specifying a <target> attribute on any of those elements.

    Values can include:

    • _blank
    • _parent
    • _self
    • _top


Browser Support




Android WebviewChrome AndroidFirefox AndroidOpera AndroidiOS SafariSamsung Internet