Absolute Links Vs. Relative Links

Most internet users know that a link is a clickable feature of a website that takes the user to a certain webpage or other location using an address called a URL. But some may not know that there are two ways that link's address can be formatted: absolute links and relative links.

What Are Absolute Links?

Absolute links use the full address of a webpage, including the domain. For example, if I wanted to link to our Web Design page with an absolute link, that link address would be: https://www.starryeyes.media/website-development/website-design/.

Notice this address includes the scheme ("https://") and the whole domain ("www.starryeyes.media").

What Are Relative Links?

Relative links, by contrast, give the address for the destination webpage in relation to the page that contains the link. So, a relative link for the same Starry Eyes Web Design page above looks like: /website-development/website-design/.

Notice this address lacks the scheme and domain. That's because this tells the browser to find the new page in relation to the domain that contains the link, so the browser already knows where to start: the current website. The browser will look for the new page in the same domain that contains the link.

How To Use Absolute and Relative Links

External Links

This is an easy question to answer when it comes to linking to a webpage outside of your own website: only absolute links will work in this context. Since you're linking to a webpage outside of your website, the browser needs the domain of the new webpage to know where to look, so it needs an absolute link with the full URL. If we wanted to place a link to the WV Tourism website on our Starry Eyes homepage, we'd need to use the full address, including the domain.

Internal Links

This question is more open-ended when it comes to internal links, links from one webpage to another webpage on the same website. Both absolute and relative links will work for this, and each has its pros and cons.

At Starry Eyes, we generally recommend using relative links because they are more flexible and can offer slightly increased loading speeds. These links are great for any website that is regularly under testing, may migrate from one network to another, may change its domain name, or in several other contexts. Relative links work especially well in small websites and websites that have a neat and consistent internal linking structure.

If you haven't thought about your website's internal linking structure or made sure your links are consistent, absolute links may be the more reliable choice. If you use links consistently, have a small website, and/or want to gain a slight increase in loading speeds, relative links are a good option.

Did you find this article useful?