Open In App

HTML <base> Tag

Last Updated : 22 Dec, 2023
Like Article

The HTML <base> tag is used to specify a base URL, or target, for relative links. This URL will be the base URL for every link on the page and will be prefixed before each of them. For example, if the URL specified by the base tag is “” then every other URL on the page will be prefixed by, “”.

Important Points:

  • The base tag must be defined between the head tags.
  • There can be a maximum of only 1 base tag on a page.
  • The <base> tag requires the presence of either an href attribute, a target attribute, or both.
  • When multiple <base> elements are employed, only the first href and first target are observed, while all subsequent ones are disregarded.


<base href = "SAMPLE_URL">


Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at “”. That is in the below program we have specified a base URL “” for all the links and when we are referring to the image at URL “1-95.jpg” then the browser is actually rendering the image from “”. 


<!DOCTYPE html>
    <!-- Declaring the BASE URL -->
        target="_blank" />
    <img src="1-95.jpg" width="400" height="250" />


Supported Browsers:

  • Google Chrome 1
  • Edge 12 and above
  • Firefox 1 and above
  • Opera 1 5and above
  • Safari 3 and above

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads