When using empty URL fragment links, to send a user to the top of the page (e.g. <a href="#">return to top</a>), are these links considered broken or invalid? One of my tools is returning them all as broken links.

  • What "tool" is considering them broken?
    – MrWhite
    Jan 17, 2013 at 16:55
  • A PHP program I use to generate a sitemap.
    – Nathan
    Jan 17, 2013 at 17:08
  • @Su': why did you delete my thanks? I was sincere!
    – Nathan
    Jan 17, 2013 at 19:35
  • 4
    @Nathan I'm sure you were. But the SE sites aren't really discussion forums and it's basically a waste of time and space. Just ask the question. Show your appreciation by upvoting/accepting answers. Jeff's answer there is the "canonical" one, but see some of the others for different takes.
    – Su'
    Jan 17, 2013 at 20:01

2 Answers 2


Technically, "#" is a well-defined URL reference that points to the start of the current document, so it is not “broken” in formal sense. It can, however, be regarded as bad for accessibility, and it is also a common symptom of “fake” links, i.e. a elements that are supposed to link to something external but depend on JavaScript. (In the very old days, <a href="..." onclick="..."> was the only kind of element that supported the onclick attribute, so people wrote the “dummy” href="#" attribute, which isn’t really dummy.)

So you can regard this as an incorrect error message, or as a useful warning message that might be a little poorly formulated.

  • 1
    Do you have a source for # being well-defined and pointing to the start of the document (i.e. a w3c spec)? Jan 17, 2013 at 23:23
  • 2
    @DisgruntledGoat, it’s specified in Internet-standard STD 66, “Uniform Resource Identifier (URI): Generic Syntax”, clause 4.4. Same-Document Reference, available e.g. at tools.ietf.org/html/std66#section-4.4 Jan 17, 2013 at 23:29
  • 1
    Kudos for providing a source, although I don't see anything that specifies # on its own refers to the start of the document. Jan 18, 2013 at 15:18
  • 1
    Well, yes, the standard isn’t too clear about it, but it’s natural to assume that a referenced document is initially positioned at the start. Its predecessor RFC 2396 was more explicit: “4.2. Same-document References. A URI reference that does not contain a URI is a reference to the current document. In other words, an empty URI reference within a document is interpreted as a reference to the start of that document, and a reference containing only a fragment identifier is a reference to the identified fragment of that document.” Jan 18, 2013 at 18:09

I don't think it is considered as broken link.

Broken link is a link that points to resources doesn't exist (404 HTTP response).

  • 1
    Don't hedge this answer with "In my opinion". It's not a matter of opinion, it's a matter of fact (and you are correct).
    – msanford
    Jan 17, 2013 at 16:36
  • 1
    @msanford: You're right, I edited my answer.
    – Zistoloen
    Jan 17, 2013 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.