SEO 101: Hyphens vs. 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.
Here is an example of a URL with hyphens:
Now, here is an example of a URL using underscores:
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:
It should come as no surprise that the easier a URL is to read for humans, the better it is for search engines.
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.
A structure such as this one will work best:
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!