In: Web Help

Hyphen vs. Underscore in URLs

Welcome to WebHelperMagazine.com. Please consider signing up for our RSS feed. Check out our job board, and be sure to leave comments -- we post your name and a link to your site as a way to thank you for joining the WHMag conversation.

by Tony Turner, Creative Director: Cranium Creations

An age-old question, and an important consideration in the interest of SEO, usability, and semantics, for folder and file naming convention in websites. Some prefer not using a word-separator when naming domains, files, or folders for the web. For those that do use word-separators, we must choose whether a hyphen or an underscore character is the best choice.

“When a link is underlined, it is difficult to tell if the file path contains underscores or spaces between the words.”

Using Google as a test subject, we ran some experiments to see how these two characters are treated. Our results show that a hyphen tends to separate words in a phrase, as expected. The underscore ties the entire phrase together, as if it were a single word. Not a positive result, we want the name treated as separate words that make up a sensible phrase.

Consider that underscores are not allowed in the domain name part of a URL, everything to the left of the TLD. So, to use a word separator throughout a full URL, we’d be mixing methods if we use underscores to the right of the TLD.

Example:

http://using-seperated-words.com/for_semantics_and_seo/

Looks pretty goofy, eh?

Another consideration, in Email or as default in HTML, hyperlinks are underlined.

When text is underlined, the underscore is not obvious. We should not use spaces in file or folder names for the web, but some folks do anyway. Not-so-savvy users may not know this, and could easily mistake an underscore for a space. If they are typing it from sight, or writing it on paper, they could write down an erroneous URL.

When a link is underlined, it is difficult to tell if the file path contains underscores or spaces between the words. The example above would appear very much the same, if the underscores replaced by spaces.

Merely aesthetics perhaps, but something. Same goes for aural, “dash” or “hyphen” is easier to recite than “underscore”… one or two less syllable to annunciate and it sounds better… again, aesthetics perhaps, but something.

Domain dot Com slash Say dash This dash Out dash Loud

Domain dot Com slash Say underscore This underscore Out underscore Loud

http://Domain.com/say-this-out-loud

http://Domain.com/say_this_out_loud

Imagine what that sounds like for someone listening to a screen reader.

So combine this aesthetic idea, both visual and aural, with the performance concerns as illustrated in our tests, and we arrive at a happy choice.

Use Hyphens for folder and file names in URLs, not underscores.

Looking around for similar test results we found this interesting article by Matt Cutts, Dashes vs. underscores. Which seems to echo our findings in a nerdy fashion.

Happy Hyphenating,

- Tony Turner

Tony Turner has been a regular contributor to a few select eList resources over the last several years. Helping others to explore and hone web building skills and promoting standards based development. A collection of recent articles can be found at Articles.Cranium-Creations.com. Contact, Link, eList, and current availability information are there as well.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Netvouz
  • Spurl
  • Facebook
  • SphereIt
  • Sphinn
  • StumbleUpon
  • Technorati
  • BarraPunto
  • Hyphen vs. Underscore in URLs blinkbits
  • e-mail
Tags: , , , , , , , , , , , ,

Written by: Tony Turner

This entry was posted on Wednesday, October 17th, 2007 at 5:45 pm and is filed under Web Help. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “Hyphen vs. Underscore in URLs”

  1. Halestorm said:

    What about the plus sign?

    We might need to identify actual hyphens in words in the URL (a server-side script for example).

    http://www.domain.com/stratford-upon-avon+is+nice/

    This URL has a place that contains hyphens and so we leave them in and use + instead of spaces. Good or bad?

  2. WebMaster said:

    Hi - Interesting question. From a human usability aspect (remembering the URL and typing it, or listening to it via a reader), this is probably not preferable. At WebHelperMagazine, we use WordPress permalinks in such a way that hyphens are generated in the URL (this article URL is http://www.webhelpermagazine.com/2007/10/hyphen-vs-underscore-in-urls/). My question to you is why mix them? I think I would vote for all dashes in your example given, and look forward to other thoughts and comments. - Scott [Editor]

  3. iGuide said:

    About a year ago, Matt Cutts of Google mentioned Google was “in the process” of treating underscores the same as dashes in urls. So, has this old rule finally changed?

    http://www.mattcutts.com/blog/whitehat-seo-tips-for-bloggers/

  4. Finn Firma said:

    Thanks for this article,

    It really helped me optimize my Norway Search Portal for Google.

Leave a Reply




Message:

Comment moderation is enabled. Your comment may take some time to appear.