Sub topic 2
What a backlink is and how it differs from an internal link
This chapter assumes you know what a URL, a web page, and a website are. It also assumes you can read simple HTML and know that search engines crawl and index pages. Chapter 1 covered how a link is built (href, anchor text, rel). Here you will use that anatomy to define a backlink precisely, separate it from an internal link, and handle the cases where the boundary is blurry.
The definition
A backlink is a hyperlink on one website that points to a page on a different website. The same link has two names, depending on whose side you look from:
- The site that contains the link calls it an outbound link (or external link).
- The site that receives the link calls it a backlink (or inbound link).
Take this snippet, which sits on a page at https://blog.example.org/tools-review:
<a href="https://example.com/guide">Example guide</a>For blog.example.org, this is an outbound link. For the page https://example.com/guide, it is a backlink. Nothing in the HTML changes between those two descriptions. Only the point of view changes.
Three parts of that definition matter in practice:
- Direction. A backlink is counted for the target. A page cannot create a backlink to itself by linking elsewhere. Someone else must link to it.
- A real link. The element must be an anchor with an
hrefthat a crawler can follow. A plain-text URL, a brand mention without a link, or a button that navigates through JavaScript only is not a backlink in the strict sense. - A site boundary. The linking page and the target page belong to different sites. This is the part that separates backlinks from internal links.
Internal links
An internal link points from one page of a site to another page of the same site. Navigation menus, footers, breadcrumbs, "related articles" blocks, and links inside body text are all typically internal links.
<!-- On https://example.com/blog/post -->
<a href="/pricing">See pricing</a>The relative href resolves to https://example.com/pricing. The source and target share a host, so this is an internal link. It is not a backlink, even though /pricing does receive an incoming link.
Side-by-side comparison
| Property | Backlink | Internal link |
|---|---|---|
| Source and target | Different sites | Same site |
| Who controls the link | Usually a third party | The site owner |
| Typical purpose | Reference, citation, recommendation | Navigation, structure, context |
| How a search engine reads it | Evidence that someone else considers the target worth citing | Evidence of site structure and which pages the owner considers important |
| Effort to obtain | Must be earned or requested | Free, edited at will |
| Spam risk | High, because it can be bought or manipulated | Low, because the owner controls it anyway |
The key difference is control. You can add or change an internal link whenever you like, so it says little about how the wider web sees your page. A backlink is a decision made by someone who does not work for you. That independence is why search engines treat backlinks as a stronger signal of value, and why people try to fake them. Later chapters build on this: the PageRank idea, link quality, and spam policies all rest on the cross-site boundary.
Internal links still matter for ranking. They help crawlers find pages, and they pass authority around inside your own site. They are a different tool, and you manage them as part of your site architecture.
Where the site boundary is unclear
"Different site" sounds simple, but real URLs produce edge cases. The right answer depends on which tool or search engine you ask, so treat these as rules of thumb.
Subdomains
Is a link from blog.example.com to www.example.com internal? Both belong to the same registered domain, example.com. Many SEO tools count links between subdomains as internal. Others count them as external, because the hosts differ. If you audit a site with subdomains, check how your tool defines a "site" before you compare numbers.
The `www` and protocol variants
https://example.com/ and https://www.example.com/ usually serve the same site, and http versus https is the same site on an older protocol. A link between them is internal in practice. A site that answers on several variants without redirecting them to one canonical form splits its link data across duplicates, which is a separate problem.
Several domains with one owner
If you own example.com and example-shop.com, a link between them crosses a domain boundary, so a crawler records it as a backlink. Search engines can see that the domains are related. A link between your own sites is a weaker endorsement than one from an unrelated publisher, and a large network of such links built only to boost rankings can fall under link-scheme policies.
Redirects
A link that points to https://example.com/old which redirects to https://example.com/new is still a backlink. A crawler follows the redirect and credits the final page. You should still ask linkers to update to the final URL, since each redirect adds a failure point.
Images as links
If an image is wrapped in an anchor, the alt text takes the place of anchor text. That link is a backlink just like a text link.
<a href="https://example.com/guide"><img src="/cover.png" alt="Example guide cover"></a>Mentions without links
Writing "see example.com/guide" in plain text creates no hyperlink. Some tools report these as unlinked mentions. They are useful outreach leads, but they are not backlinks.
Counting backlinks: links versus referring domains
Tools report two numbers that beginners often confuse:
- Backlinks: the total number of links that point to a page or site.
- Referring domains: the number of distinct domains those links come from.
If one blog links to you 400 times from a sidebar, you have 400 backlinks and one referring domain. Search engines tend to value variety of independent sources, so referring domains is usually the more informative number. A site-wide link in a footer or sidebar inflates the first count without adding independent endorsements.
Seeing the difference in code
Search engines record both link types from the same HTML. The difference is computed by comparing the source host with the target host. The script below parses one page, classifies each link, and then inverts a small link graph to find the backlinks each page receives. It uses only the Python standard library and needs Python 3.9 or newer for removeprefix.
from html.parser import HTMLParser
from urllib.parse import urljoin, urlparse
class HrefCollector(HTMLParser):
"""Collect the href of every <a> tag."""
def __init__(self):
super().__init__()
self.hrefs = []
def handle_starttag(self, tag, attrs):
if tag == "a":
href = dict(attrs).get("href")
if href:
self.hrefs.append(href)
def site_of(url):
"""Return the host without a leading www. Subdomains stay distinct."""
return (urlparse(url).hostname or "").removeprefix("www.")
def extract_links(page_url, html):
"""Return absolute http(s) link targets found on a page."""
collector = HrefCollector()
collector.feed(html)
targets = []
for href in collector.hrefs:
absolute = urljoin(page_url, href)
if urlparse(absolute).scheme in ("http", "https"):
targets.append(absolute)
return targets
def classify(page_url, html):
"""Label each link on a page as internal or external."""
source_site = site_of(page_url)
result = []
for target in extract_links(page_url, html):
kind = "internal" if site_of(target) == source_site else "external"
result.append((target, kind))
return result
page = "https://example.com/blog/post"
html = """
<a href="/pricing">Pricing</a>
<a href="https://www.example.com/about">About</a>
<a href="https://example.org/tool">A tool</a>
<a href="mailto:[email protected]">Mail</a>
<a href="#top">Top</a>
"""
for target, kind in classify(page, html):
print(kind, target)
print("--- backlinks by target ---")
crawled = {
"https://example.org/review": '<a href="https://example.com/guide">Guide</a>',
"https://example.net/list": '<a href="https://example.com/guide">Guide</a>',
"https://example.com/blog/post": '<a href="https://example.com/guide">Guide</a>',
}
backlinks = {}
for source, source_html in crawled.items():
for target, kind in classify(source, source_html):
if kind == "external":
backlinks.setdefault(target, set()).add(source)
for target, sources in backlinks.items():
print(target, "<-", sorted(sources))The first loop prints:
internal https://example.com/pricing
internal https://www.example.com/about
external https://example.org/tool
internal https://example.com/blog/post#topThe mailto: link is dropped because it is not an http or https link. The #top link resolves to the same page, so it is internal. The second loop prints one target, https://example.com/guide, with two sources, https://example.net/list and https://example.org/review. The link from https://example.com/blog/post is internal, so it is not counted as a backlink.
This inversion is how a search engine builds backlink data. Crawling records outgoing links per page. Indexing then flips the graph so that for any target it can list every page that links to it. The next chapter covers the crawling step in detail.
Why the distinction matters
Keeping backlinks and internal links separate changes what you do:
- Measurement. Counting a site's navigation links as "backlinks" gives a number that means nothing. Always filter out links whose source is on the same site.
- Strategy. You improve internal links by editing your own site. You improve your backlink profile by publishing something others want to cite, or by outreach.
- Risk. An odd internal link structure hurts only your own crawling. Paid or manipulated backlinks can trigger a search engine's spam policies.
- Diagnosis. If a page ranks poorly, you can ask two separate questions. Do crawlers find it through internal links? Does anyone else link to it? The answers point to different fixes.
Common errors
- Treating any incoming link as a backlink. Links from your own pages are internal, and they do not count as outside endorsement.
- Forgetting that direction is relative. One link is an outbound link for its page and a backlink for its target. Tool dashboards label it from the viewpoint of the site you are examining.
- Mixing up backlinks and referring domains. Report both, because they answer different questions.
- Counting unlinked mentions or JavaScript-only navigation. If a crawler cannot find an
<a href>element, no link was recorded. - Ignoring subdomains. Check whether your tool treats them as one site before you compare reports across tools.
Summary
A backlink is a hyperlink from a page on one site to a page on another site, viewed from the target's side. An internal link stays within one site. The HTML is identical, and what separates them is whether the source and target belong to the same site, which in practice means comparing hosts and deciding how to treat subdomains and related domains. Because backlinks come from outside parties, search engines read them as independent evidence about a page, which sets up the next chapters on discovery and PageRank.
Exercise
A page at https://shop.example.com/sale contains three links: (a) https://shop.example.com/cart, (b) https://example.net/review, (c) https://www.example.com/. Which of these are backlinks for their targets? Which is ambiguous, and why?
Show answer
Link (b) is a backlink for https://example.net/review, because it crosses to a different registered domain. Link (a) is internal, since the host is the same. Link (c) is ambiguous: shop.example.com and www.example.com are different hosts under one registered domain, so some tools call it internal and others call it external. Check how your tool defines a site before relying on the count.
Exercise
A blog links to your guide from its sidebar on 300 pages. A second site links to it once, from inside an article. What do a backlink count and a referring-domain count each report, and which number better reflects independent endorsement?
Show answer
The backlink count is 301 and the referring-domain count is 2. The referring-domain count reflects independent endorsement better, because the 300 sidebar links come from one source and say little more than a single link would.