You can link to a specific section of a page using an anchor — a marker you place on the target section, then reference in your link

When you link to a webpage, you normally land at the top. An anchor (also called a fragment identifier) lets you link directly to a heading, paragraph, or any other part of that page. The person who clicks lands exactly where you want them, not at the top scrolling to find it.

Anchors work on any webpage you can edit, and most modern websites already have them built in — you just need to know how to find and use them. This guide covers how to create anchors, how to link to them, and how to spot when a page already has them ready to use.

Key Takeaways

  • An anchor is an invisible marker you place on a heading or section using the id attribute, like <h2 id="shipping-costs">.
  • To link to an anchor, add a hash and the anchor name to the end of the URL: example.com/page#shipping-costs.
  • Most websites already have anchors on their headings, so you can right-click a heading and copy the link to that section directly.
  • Anchor names must be lowercase, use hyphens instead of spaces, and contain only letters, numbers, and hyphens.
  • When you link to an anchor on the same page, use just the hash and name: #shipping-costs instead of the full URL.

How to create an anchor on your own page

An anchor is created using the id attribute on any HTML element. The most common place is on a heading, because readers expect to land at section titles.

In your HTML, add id="anchor-name" to the opening tag of the element you want to link to. For example:

<h2 id="shipping-costs">How Much Does Shipping Cost?</h2>

The anchor name should be lowercase, use hyphens instead of spaces, and contain only letters, numbers, and hyphens. id="shipping-costs" works; id="Shipping Costs" or id="shipping_costs" will cause problems in some browsers.

You can place an anchor on any element — a paragraph, a list, a div — but headings are clearest because readers can see where they landed. Once the anchor exists on your page, anyone can link to it.

How to link to an anchor on another page

To link to an anchor, add a hash symbol and the anchor name to the end of the page URL. If the page is example.com/faq and the anchor is id="returns", the full link is:

example.com/faq#returns

In HTML, that looks like:

<a href="example.com/faq#returns">Our return policy</a>

The person who clicks this link lands directly at the "returns" section instead of at the top of the FAQ page. If the page is long, this saves them from scrolling.

How to link to an anchor on the same page

When you link to a section within the page you are already on, you only need the hash and anchor name — not the full URL. This is called a same-page anchor link.

If you are writing a table of contents at the top of a long page, you would use:

<a href="#shipping-costs">Shipping Costs</a>

Not the full URL. The hash tells the browser to look for an anchor on the current page. This also means if you move the page to a different URL later, the links still work.

How to find and use existing anchors on other websites

Most modern websites already have anchors on their headings. You do not have to create them — you can link directly to sections that already exist.

To find the anchor name, right-click the heading you want to link to and select "Copy link" or "Copy link address" (the exact wording depends on your browser). Paste it into your document. The URL will include the anchor at the end.

For example, if you right-click a heading on Wikipedia, you might get en.wikipedia.org/wiki/Cat#Behavior. The #Behavior part is the anchor. You can share this link, and anyone who clicks it lands at that section.

Not every website has anchors on every heading. If right-clicking does not show an anchor in the URL, that section does not have one yet. You can still link to the page, but the reader will land at the top.

Why anchor names matter and how to avoid mistakes

Anchor names are case-sensitive in some browsers and case-insensitive in others, so the safest approach is to always use lowercase. An anchor named id="Shipping" might work in Chrome but fail in Firefox.

Spaces in anchor names cause problems. Use hyphens instead: id="shipping-costs" not id="shipping costs". Special characters like &, %, and @ also cause issues — stick to letters, numbers, and hyphens.

Each anchor name on a page must be unique. If you have two headings with id="overview", the browser will only link to the first one. If you are adding anchors to an existing page, check that the name is not already in use.

How anchors work in different contexts

Anchors work the same way whether you are linking from an email, a document, or another webpage. Any link that ends with a hash and anchor name will jump to that section.

In email, you can include a link like example.com/guide#step-three and the reader lands at step three when they click. In a Google Doc or Word document, you can link to anchors on external websites the same way.

Some website builders like Wix, Squarespace, and WordPress automatically create anchors on headings, so you can link to them without writing any HTML. Check your builder's documentation to see how to find or create anchor links in your specific platform.

Frequently Asked Questions

Can I link to an anchor that does not exist?

Yes, the link will work, but it will land at the top of the page instead of at a specific section. The browser silently ignores anchors it cannot find. If you are linking to someone else's website, test the link first to make sure the anchor exists.

Do I need to use the full URL when linking to an anchor on my own site?

No. Use just the hash and anchor name: #section-name. This is called a relative link and it works even if you move your site to a different domain later. Full URLs like example.com/page#section also work, but relative links are more portable.

What if I want to link to an anchor on a page that does not have one?

You cannot link to an anchor that does not exist. If you own the page, you can add anchors to the headings yourself. If you do not own the page, you can contact the site owner and ask them to add one, but you cannot force it.

Do anchors affect how search engines rank a page?

No. Anchors are invisible to search engines and do not change how a page ranks. They only affect where a reader lands when they click a link. Search engines see the page as a whole, not individual sections.

Can I use numbers or special characters in anchor names?

Numbers are fine: id="step-1" works. Most special characters cause problems. Stick to lowercase letters, numbers, and hyphens. Avoid spaces, underscores, ampersands, and punctuation marks.