Site SEO AI Auditod Internet Solutions

URL Fragments and Hash URLs: How Search Engines Treat #

1 października 2026Czas czytania: 8 minSEO techniczne
URL Fragments and Hash URLs: How Search Engines Treat #

Short answer: The part of a URL after the # sign is called the fragment. Browsers do not send it to the server, and search engines generally treat /page#section as the same URL as /page. That is fine for jump links within a page, which can even appear as “jump to” links in results. It is a problem when a site uses fragments to show different content, as in single-page apps with hash routing: every “page” collapses into one URL. Use real paths or query parameters for anything that should be indexed separately.

What a URL fragment is

A URL has several parts. In https://example.com/guide/?lang=en#pricing, the scheme is https, the host is example.com, the path is /guide/, the query is lang=en and the fragment is pricing.

The fragment was designed to point to a location inside a document. When a browser loads the URL, it requests /guide/?lang=en from the server, receives the page and then scrolls to the element with id="pricing". The fragment itself never reaches the server. That has consequences:

The formal definition is in the URI standard, RFC 3986, which describes the fragment as a secondary resource identified relative to the primary one.

How search engines treat fragments

Because the fragment identifies a place within a document, not a different document, search engines normally drop it when they decide which URL to crawl and index. /guide/#pricing, /guide/#faq and /guide/ are one URL from the index’s point of view. Links pointing to any of them count as links to /guide/.

There are a few exceptions and nuances worth knowing:

Where fragments are fine

For their original purpose, fragments are useful and have no SEO downside:

In each case, all content is in the page HTML, and the fragment only changes the scroll position or which part is visible. Search engines index the whole page, including every section.

Best practice for these anchors: use short, stable, readable IDs like #returns rather than generated ones like #h-7f3a, and do not change them when you edit the heading, because external links may depend on them.

Where fragments cause problems

Problems start when the fragment is used to load different content, rather than to move within the same content.

  1. Hash routing in single-page applications. Some JavaScript frameworks can use routes like /#/about, /#/products/42 and /#/contact. To a search engine these are all just /. Only one page can be indexed, and the content of the others is effectively invisible to search as separate pages.
  2. Filters and pagination in fragments. A category that stores filters or page numbers as #color=red&page=3 gives search engines one URL, so deeper pages and their items may never be discovered through it.
  3. Content loaded by fragment. A page that fetches a different article when the fragment changes shows crawlers only the default content.
  4. Language versions in fragments. Using #de or #fr to switch languages makes it impossible to give each language its own indexable URL and hreflang annotations.

The general principle is the same as in JavaScript SEO basics: every piece of content that should rank on its own needs its own URL that returns that content when requested.

Fixing hash-routed sites

If your site or app uses hash routing for public content, the fix is to move to path-based routing:

  1. Switch the router to history mode. Most frameworks support routes like /about using the browser’s History API instead of #/about. This is usually a configuration change in the router.
  2. Configure the server. With history mode, the server must return the application for every route, not a 404. Ideally, render the content on the server or pre-render it, so that each URL returns its own HTML without waiting for JavaScript.
  3. Redirect old hash URLs in the browser. Because the server never sees fragments, server redirects cannot catch /#/about. Add a small script that reads the fragment on load and replaces the URL with /about. External links to old hash URLs then still work for visitors.
  4. Update internal links and the sitemap. All links should point to the new paths, and the XML sitemap should list them.
  5. Give each route its own metadata. Unique title, meta description, canonical and headings per route.

For filters and pagination, use query parameters or paths for the combinations you want indexed, and follow the guidance in URL parameters and duplicate content for the rest.

Fragments in canonicals, sitemaps and hreflang

Fragments do not belong in the URLs you declare to search engines:

Plugins and scripts sometimes add fragments automatically, for example a “#more” anchor on WordPress read-more links or a “#respond” anchor on comment links. These are harmless in links, but check that they do not end up in canonicals or sitemaps.

Fragments and tracking

Since fragments are not sent to the server, some tools use them for client-side purposes, such as passing campaign information or state within a page. A few points to keep in mind:

Quick reference: path, query or fragment?

Use case Best URL part Why
A separate page that should rank Path Clean, indexable, one URL per page
Pagination, sorting, filters Query parameter or path Crawlable when needed; manageable with canonicals
Section within a page Fragment Scrolls to the section; no duplicate URL
Language or country version Path, subdomain or domain Needs its own URL for hreflang
Client-side state that should not be indexed Fragment Not sent to the server, not a new URL

How an audit spots fragment problems

Hash-routed sites usually show a very clear pattern in a crawl: only a handful of URLs are found, and most content is missing or requires JavaScript to appear. Site SEO AI Audit crawls through links like a search engine, reports pages whose content depends on JavaScript, and checks canonicals, sitemaps and hreflang for problems such as duplicates and broken targets. If the crawl finds far fewer pages than your app has routes, fragments are a likely cause. Paid plans include re-audits to confirm the migration worked.

Related reading

The bottom line

Search engines treat everything after # as a location inside the same page. Use fragments for jump links, tables of contents and in-page tabs, where they work well. Never use them to separate content that should be indexed on its own, such as app routes, filters or language versions. Move those to paths or query parameters, redirect old hash URLs with a small script, and keep fragments out of canonicals, sitemaps and hreflang.

FAQ

Does Google index URLs with a hash?

Google generally ignores the fragment and indexes the URL without it. /page#a and /page#b are treated as the same URL as /page.

Are jump links good for SEO?

They help readers navigate long pages and can appear as direct links to sections in search results. They do not create separate indexable pages, and they do not need to.

Can I redirect a URL with a fragment on the server?

No. The server never receives the fragment, so the redirect must be done with JavaScript in the browser, which reads the fragment and changes the URL.

Is hash routing always bad?

For private app screens behind a login it does not matter. For public content that should appear in search, path-based routing with server-side or pre-rendered HTML is much safer.

Do links to URLs with fragments pass value?

Yes. A link to /page#section is treated as a link to /page, so it supports the page as a whole.

#Indexing#JavaScript SEO#Technical SEO#URL structure
Sprawdź swoją stronę — za darmo.Każdy problem SEO na Twojej stronie — i dokładnie, jak go naprawić.
Zacznij za darmo
Internet Solutions

Więcej od naszego zespołu

Stworzone przez Internet Solutions. Wypróbuj nasze pozostałe produkty — każdy oszczędza czas na swój sposób.

internet-solutions.net ↗
Site SEO AI Audit
Przegląd prywatności

Ta strona używa plików cookie, abyśmy mogli zapewnić Ci jak najlepsze wrażenia. Informacje z plików cookie są przechowywane w Twojej przeglądarce i pełnią funkcje takie jak rozpoznawanie Cię po powrocie na stronę oraz pomagają naszemu zespołowi zrozumieć, które sekcje strony są dla Ciebie najciekawsze i najbardziej przydatne.