Open In App

HTML <base> Tag

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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 "www.xyz.com" then every other URL on the page will be prefixed by, "www.xyz.com/".

  • 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.
HTML
<!DOCTYPE html>
<html>

<head>
    <base 
        href=
"https://media.geeksforgeeks.org/wp-content/uploads/" 
        target="_blank" />
</head>

<body>
    <img src="1-95.jpg" width="400" height="250" />
</body>

</html>

Syntax

<base href = "SAMPLE_URL">

Similar Reads