Free auditStart free
GlossaryGlossary · Crawling and indexing

URL fragment

A URL fragment is the part after #. It is handled by the browser, not sent to the server. What that means for canonicals, JavaScript routing, and crawlable links.

2 min
read
4
sources
Oct 29, 2026
updated
Scaplet Editorial Team
author
In one line

A URL fragment is the final part of a URL, starting with #. It points to a spot inside a resource, such as a heading or a video timestamp, and is handled by the browser after the page loads, not sent in the request. Google advises against loading different content by fragment and against using one as a canonical URL.

30-second check

Is this costing your site traffic?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode

At a glance

4 facts from the sources below
#
Starts with
No, handled by the browser
Sent to server
Generally not supported
Google as canonical
History API, not fragments
SPA routing advice
01At a glance

Anatomy of a URL with a fragment

Form

#setup

What the browser does
Scrolls to the element with id="setup"
Form

#t=10,20 (media fragment)

What the browser does
On audio or video, starts playback at the given time
Form

#:~:text=fragment

What the browser does
Text fragment: highlights matching text on the page
Where the fragment sits
https://www.example.com/path/guide?lang=en#setup
 scheme   host        path      query   fragment

MDN says the fragment is handled entirely by the client and isn't included in the request, and RFC 3986 describes it being split off before the URI is dereferenced. The server never sees it, so two URLs that differ only after the # fetch the same response.

02Worth knowing

Three places fragments cause SEO trouble

Content swapped by fragment

Google's JavaScript SEO guide warns against loading different content based on the fragment, because Googlebot can't reliably resolve those URLs. Its section is titled "Use the History API instead of fragments."

Fragment as canonical

Google's consolidation guide says not to specify a fragment as the canonical URL, because Google generally doesn't support fragments.

Non-link navigation

Google can only discover links that are a elements with an href attribute, so clickable elements without one don't help discovery.

Instead of hashchange, use real paths
// Link: <a href="/products">Products</a>
link.addEventListener('click', (event) => {
  event.preventDefault();
  loadView('/products');
  history.pushState({}, '', '/products');
});
03How it works

Check it in 2 minutes

Prove the server ignores the fragment
curl -s https://developer.mozilla.org/en-US/ | wc -c
curl -s 'https://developer.mozilla.org/en-US/#anything' | wc -c   # curl drops the fragment, so the byte count matches
  1. 01

    Find hash-based routes

    Open the site, click through the main navigation, and watch the address bar. If views change only after a #, they're fragment-routed.

  2. 02

    Compare with View source

    Open a fragment-routed view's source. If the content isn't in the initial HTML, the view depends on JavaScript, so see JavaScript SEO.

  3. 03

    Check canonicals

    Search your rel=canonical values for #. Any hit is a canonical Google generally won't support.

Sources · 4

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • mozilla.org
  • google.com
  • rfc-editor.org
  1. 01URI fragment (MDN)developer.mozilla.org · checked 2026-11-01
  2. 02JavaScript SEO basics (Google Search Central)developers.google.com · checked 2026-11-01
  3. 03How to specify a canonical URL (Google Search Central)developers.google.com · checked 2026-11-01
  4. 04RFC 3986, section 3.5 Fragmentrfc-editor.org · checked 2026-11-01
Questions

Asked a lot.

1 questions people ask next, answered from the sources on this page.

01Does Google treat URLs with different fragments as different pages?

Google's documentation says it generally doesn't support fragments as canonical URLs and can't reliably resolve content that depends on them. Because the server receives the same request, treat fragment variants as one URL.

Free · 2 minutes

Know the term. Now check your site.

The free audit reads robots.txt, sitemaps, status codes, canonicals, redirects and structured data.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • +212% organic clicks in 90 days Ledgerly