Absolute and Relative links in HTML
Posted By: Riya Saini Published: 14, Jan 2024

Absolute and Relative Links
What is an absolute link?
An absolute link is a hyperlink that contains the entire URL, which contains all of the information necessary to locate a specific site, page, document, or other addressable items on the Internet. This data comprises the following: HTTP (Hypertext Transfer Protocol) or FTP (File Transfer Protocol).
e.g. - https://www.example.com/image/logo.svg
What is the relative link?
Any link that reveals the current URL's connection to the linked page's URL is referred to as a relative link. Relative links, rather than displaying the entire reference URL in the href tag, only display the relative link pathways, as their name suggests. It's a link that includes the precise location of a file.
e.g. - /images/logo.svg
Which one is better?
The following points can help you understand it better:
- While designing a website, using relative links instead of absolute connections will not make the site more appealing to search engines, as search engines convert relative links to absolute links automatically. It makes no difference to search engines which ones are used.
- Relative links, on the other hand, load far faster than absolute links, and the faster a website loads, the more desirable it is to consumers.
- Using too many absolute links might slow down a page's download time and, as a result, decrease conversion rates.
- A relative URL carries less information than an absolute URL. Because relative URLs are shorter and more portable, they are more convenient. They can only be used to refer to links on the same server as the page that contains them, though.
In general, web developers should make relative links whenever possible. Links to outside websites must have absolute paths, while links to internal pages can and should be relative to save download time.