BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

Fragment identifier: The # part of a URL

A fragment identifier is the part of a URL after #. It points to a spot inside a page, such as a heading, and the browser handles it, not the server.

Monthly searches · fragment identifier
720
Keyword research data
fragment identifier
Fragment identifier: The # part of a URL
Click the image to view it full size

In https://example.com/guide#pricing, the fragment identifier is pricing: the last part of the URL, starting after the # sign. It doesn't point to a different page; it points to a place inside the page the rest of the URL loads, such as a heading, a page of a PDF or a moment in a video.

People also call it a fragment, a hash, a jump link or an anchor link, after the anchor tag that usually links to it.

How a browser handles the fragment

The fragment never reaches the server. When you open example.com/guide#pricing, the browser requests example.com/guide, receives the page, and then looks for pricing itself. RFC 3986

What the browser does with it depends on the type of file:

The URL opens... The fragment Example
An HTML page scrolls to the element with that id #pricing
A PDF opens a page or named destination #page=5
A video or audio file starts playback at a time #t=10,20 (from second 10 to 20)
Any page, with text fragments scrolls to and highlights matching text #:~:text=free%20trial

For HTML, the target is the element whose id matches:

<a href="#pricing">See pricing</a>
...
<h2 id="pricing">Pricing</h2>

Because the server never sees the fragment, server logs and redirects don't either. When a link to old-page#pricing redirects to new-page, the browser carries the fragment over and opens new-page#pricing (unless the redirect names a fragment of its own), so keep the same id on the new page. RFC 9110

Text fragments: linking to any sentence

Text fragments let you link to a passage on a page you don't control, even if it has no id. The syntax is #:~:text= followed by the text, URL-encoded, optionally with words before and after to make the match unique. MDN

Chrome, Edge, Safari and Firefox all support them in current versions. A browser that doesn't simply opens the page at the top. Browsers remove the text part before the page's scripts run, so the page itself can't read it.

Fragments and SEO

Google indexes the page, not the fragment. Its URL guidelines say Google Search generally doesn't support fragments, so example.com/guide#pricing and example.com/guide are the same URL to Google. Google Search Central

That has two practical consequences:

  • Don't use fragments to load different content. Some older JavaScript sites showed different pages at addresses like example.com/#/products. Google generally can't tell those apart. Use real paths and the History API instead.
  • Fragment links don't create new pages. A table of contents full of # links is fine; it doesn't add pages or duplicate content.

Google can still use sections inside a page. In search results, it sometimes adds "Read more" links that open a page at a specific section. To keep these working: show the content without hiding it in tabs or collapsed sections, don't force the page to scroll to the top on load, and if your scripts rewrite the URL, keep the # part. Google Search Central

  • Use short, readable ids such as pricing or how-to-apply. They show in the address bar when people share the link.
  • Keep ids stable. Other sites and your own emails may link to them. Renaming a heading's id breaks those links silently: the page still loads, just at the top.
  • Make each id unique on the page. With duplicates, the browser uses the first one.
  • Add a table of contents to long pages, linking to each section. It helps readers jump ahead and gives them links to share.

Fragments are also different from a query string, the part after ?. A query string is sent to the server and can change what the page returns; a fragment can't. For links into apps, see deep link.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.