What is a URL fragment?
A URL fragment, also called a hash or anchor, is everything after the # in an address, as in example.com/guide/#pricing. It tells the browser where to scroll within a page. The browser keeps it to itself: the fragment is not part of the request the server receives.
Because of that, search engines generally treat a URL with a fragment and the same URL without one as a single page.
Anatomy
https://example.com/guide/?page=2#pricing
└ scheme └ host └ path └ query └ fragment
The fragment always comes last. In HTML, the target is any element with a matching id:
<a href="#pricing">Jump to pricing</a>
...
<h2 id="pricing">Pricing</h2>
How search engines treat fragments
Google's guidance is direct: it generally does not support fragments for changing the content of a page, and it strips them when deciding which URL to index. Three practical results follow.
- No duplicate content from jump links.
/guide/#pricingand/guide/#faqare the same indexed URL. They need no canonical tag handling of their own. - Fragments cannot carry unique pages. A single-page application that shows different content at
/#/productsand/#/aboutexposes only one URL to crawlers. Route with real paths through the History API instead. The old#!"hashbang" crawling scheme is long retired. - Server-side tools cannot see them. Fragments do not appear in access logs and cannot be matched by server redirect rules. A redirect from
/old/#sectioncannot be written on the server, though a fragment in the redirect's target is kept by browsers.
Where fragments help
Jump links and tables of contents. A table of contents made of fragment links helps readers on long pages. Google sometimes shows links to sections of a page within a result, and descriptive headings with stable id values give it something to work with. There is no markup that guarantees this.
Text fragments. Browsers support a special syntax that scrolls to and highlights a phrase:
https://example.com/guide/#:~:text=cold%20brew%20ratio
Google uses it in some featured snippet links, which is why visits from search may land with a sentence highlighted. Nothing on your side has to be set up for this, and nothing about your URLs changes.
State you do not want indexed. Tabs, accordions and lightboxes can keep their state in the fragment without creating crawlable variants, which is the opposite trade-off from URL parameters.
Fragments and analytics
Since the server never sees the fragment, tracking it is a client-side job. Analytics tools record it only when the page script sends it. Campaign tags belong in the query string, before the #. A URL written as example.com/#section?utm_source=x puts the tag inside the fragment, where it is lost.
In WordPress
The block editor's Heading block has an HTML anchor field under Advanced. Whatever you type there becomes the heading's id, and you can link to it with #your-anchor. Hydrogen SEO's Table of Contents block builds the list of jump links from a post's headings for you. Keep anchors short, lowercase and stable: changing one breaks every link that pointed to it, and no redirect can catch that.
Common questions
Does Google index URLs with a hash?
Google generally ignores the fragment and indexes the URL without it, so pages that differ only by their fragment count as one page.
Are anchor links good for SEO?
They help readers move around long pages, and clear section headings may lead Google to show section links in a result. They are not a ranking factor in themselves.
Can I redirect a URL with a fragment?
Not on the server, because the fragment is never sent to it. Only JavaScript running in the browser can read a fragment and act on it.