SEO 101: Hyphens vs. Underscores in URLs

Hyp

Hyphens (-) or Underscores (_) in URLs?

As you build your website from the ground up, you’re faced with a variety of decisions. For this reason, it’s only natural to overlook a few important details that can have a major impact on your search engine rankings.

For example, a site’s URL structure is extremely important. With the right approach, you have a greater chance of reaching the top of the search engines for your target keywords.

Conversely, if you make mistakes, it could (and probably will) work against you.

Keep Your URL Structure Simple

Here’s the most important thing you will ever hear in regards to your site’s URL structure: it should be as simple as possible.

Of course, the word simple means something different to everyone. Here are a few URL strategies to employ:

  • Avoid overly complex URLs that include multiple parameters.
  • Use readable words in your URL structure, not a long string of numbers.
  • Choose a URL that describes the page and gives people a reason to click your link.

What about Hyphens and Underscores?

There’s no denying the fact that you should use punctuation in your URLs. But here’s the big question: what type of punctuation is considered best?

According to Google, URLs with hyphens (-) are preferred over those that use underscores (_).

In fact Matt Cutts said:

For urls in Google, I would recommend using dashes.

Overall, one does not adversely rank better than the other. Wikipedia for instance uses underscores on all of their pages.

URL Readability

Here is an example of a URL with hyphens:

http://www.example.com/miami-real-estate-agent.

Now, here is an example of a URL using underscores:

http://www.example.com/miami_real_estate_agent.

Which one would you remember on a billboard? Probably the hyphens, as its more culturally relevant to standard punctuation practices.

Also, avoid a situation in which you don’t use hyphens or underscores. This looks something like this:

http://www.example.com/miamirealestateagent.html.

It should come as no surprise that the easier a URL is to read for humans, the better it is for search engines.

Benefits of URL Readability

Image curtesy of Moz

Note: if you simply use spaces it will show up in your URL structure as 20%. This takes away from the readability, while also working against you from an SEO perspective.

DESKTOP FILE: BETTER RANKING IN SEARCH.pdf
ONLINE FILE: BETTER%20RANKING%20IN%20SEARCH.pdf

Why Use a Hyphen?

On the surface, it’s easy to believe that hyphens and underscores are treated the same by search engines. However, this is not the case.

In short, Google treats a hyphen as a space (or word separator). So, while you may not be able to add a traditional space, it still appears this way in the eyes of Google.

An underscore, on the other hand, is considered a “word joiner.” Sticking with the example above, miami_real_estate_agent is the same as miamirealestateagent to Google.

In fact Matt Cutts said:

…if you have a url like word1_word2, Google will only return that page if the user searches for word1_word2. If you have a url like word1-word2, that page can be returned for the searches word1, word2, and even “word1 word2″.

Why Use a Underscore?

The underscore [ _ ] (also called understrike, underbar, or underline) is a character that originally appeared on the typewriter and was primarily used to underline words.

The first IBM character-coding system was introduced in 1964 and used a small character set, of which the underscore was one character. It was referred to at that time as the “break character” because it broke up simple lines of text and code, as in “rate_of_pay”. By 1967, the underscore character was also used in ASCII, an early computer programming language.

It is common in computer programming to use an underscore just before the name of a file intended for internal use within a computer library, or for a header file. Ruby, Perl, and Windows PowerShell also use underscores after certain characters to create a special variable

How to Avoid Trouble with Your Site’s URL Structure

The best thing you can do is verify that every URL is using hyphens and not underscores. Along with this, here are three additional tips:

  • Use a robots.txt file to block Google from accessing any problematic URLs.
  • Shorten URLs when possible by getting rid of excessive parameters.
  • Check your site regularly for broken links.

Tip: if you are among the millions of people relying on WordPress to power your website, you can opt for a SEO friendly permalink structure.
You can learn more about this here.

A structure such as this one will work best:

http://example.com/post-name/

Final Word

You have the ability to structure your URLs in a number of ways, but always remember this: your decision will have a big impact on your search engine rankings.

From an SEO perspective, it is always best to use hyphens rather than underscores. Don’t let this very important detail slip through the cracks!

About Charlie Rose

I am the founder of SEO Mechanic. I have 20 years of experience helping multinational corporations and small businesses take the guesswork out of SEO. You can find me on Twitter.

29 responses to “SEO 101: Hyphens vs. Underscores in URLs”

  1. Steve says:

    Excellent article. Clearly written and straight to the point

    • Charlie says:

      Hey Steve, Thanks for taking the time to read the post and leave a comment! This might not be the most popular subject around the water cooler, but its the nuts and bolts of search :o()! Hope all is well – Charlie

  2. Aamir Saleem says:

    Thanks Charlie, very informative article, I understanding each and every word clearly. Nice post

  3. Quanglepro says:

    Greate tip… i never see this subject before..so very useful

  4. Very helpful information I had no idea there was a difference in the way that the search engine’s look at them or Google. Thank you Charlie
    Nancy

  5. RAHUL SHARMA says:

    thanks charlie this information helps me a lot

  6. Arthur Green says:

    Great article about Hyphens vs. Underscores in urls.
    I’m satisfied that you just shared this helpful information with us.Please stay us informed like this.
    Thanks for sharing…..!!!

  7. Cam says:

    CHarlie, this is good stuff that I’m not aware of. Does it also apply to ‘home’ URLs, or just sub addresses?

    EG if I’m starting a new consumer product brand, do the same rules still apply?

    • Charlie Rose says:

      Yes its similar though you can’t do an underscore in a root domain. But you can do a dash / hyphen. The problem with having a hyphen in a root domain is in offline advertising. You have to constantly emphasize the dash / hyphen. ~ Charlie

  8. Great article and very helpful, Learned something new.

  9. kim says:

    Hi Charlie,
    Very nice article, i do learn something new today.
    Your article published from 2016, now its April 2018. Is this guideline still valid in terms of SEO?

    • Charlie Rose says:

      Yep! This type of information will stay the same. Unless something new happens. In that case we always update our posts.

  10. Sergio says:

    It was interesting to find out how and why underscore appears and why we have to avoid them. I’m new to SEO and trying to read as much as possible every day about this topic. I really appreciate you for sharing your experience and knowledge.

    • Charlie Rose says:

      No problem you’re welcome! Everything has a purpose and some of it is from the early programming days.

  11. Marv says:

    “Which one would you remember on a billboard?”
    the underscore as it simulates a blank space rather than disrupting reading the singular words.

    Doesn’t change a thing that you should use dashes for seperate words and underscores for conjoined words:

    /red-sneaker = red sneaker
    /red_sneaker = redsneaker

    but

    /sunset-boulevard = Sunset Boulevard
    /sunset_boulevard = Sunsetboulevard

  12. Albert says:

    Sorry for bothering you. I’m a bit confused, I want to create a URL with multiple words. Which structure is better from the following. …?

    Domain URL…
    graphic-designer.com
    graphicdesigner.com

    Page or Post URL….
    /graphic-designer
    /graphicdesigner

    Thanks in advance.

  13. Barakha Rao says:

    Structuring a URL is necessary for an improved user experience and search engine optimization. Online businesses are designed with the URLs so it requires to be important, human readable and search engine friendly.

    I was actually considering of what precisely I should do improve my blog ranking before I came across your post. About permalink – use essential words in the first 3 words of URL to make it understandable. Users are more likely to click on a site that makes sense to them. Permalinks structure is one of the major element to rank higher in the Google search engine. Although I have regularly avoided the use of “stop words” in my permalink structure, but this post has redeclared my thinking & that’s what professionals are already doing.

    Quick suggestion; “Hyphens” &”Underscore” are the basic word separators used in the URL. My advice is to avoid underscores as word separators in URLs. Anyways, thanks for sharing the resourceful article. I like articles of this type, ones that make you actually think. This has encouraged me a lot and I hope it will improve my ranking in Google.

  14. Tom says:

    Thank you, Charlie. Old info but still very useful.

    • Charlie Rose says:

      Thanks for the feedback. What would you add to freshen it up? I guess perhaps the fact that Google is shying away from URLs in the first place would be a good start. Would love some more feedback.

  15. iransite says:

    how to deal with developers who never understand it??

  16. matheen says:

    Great Article!

Leave a Reply

Your email address will not be published. Required fields are marked *