Website URL Structure: Should You Use Hyphens Or Underscores In URL Slugs?


website url structure

The URL structure refers to how your URL spells out in the browser. The first option is to use hyphens (-) in between words. The second one is to use underscore (_). 

Which of these two is better? I did some digging, and I will share the results of my findings with you. In the end, you should be able to decide which one to use. 

What does Google say about it? 

According to Google, you must keep your URL structure as simple as possible. Your website’s URL structure must be logical as it is easier for search engines and human beings to follow. In essence, it must be understandable to humans.

Furthermore, it has to be readable. Do not use numbers. Instead, use words in your URL. I touched on this subject in one of my blog posts about WordPress permalinks. 

Here is an example of my URL for one of my blog posts: 

As you can see, a person reading it would understand what the web page is about. It is easier to comprehend than this one: 

https://bloggingkarma.com/index.php?id_sezione=360&dasdssid=3a5ebcasdsad944f41daasadas6f849fsd730f1

Google also suggests that you use punctuations like dots and slashes. Between a hyphen and an underscore, what Google advises is to use hyphens, not underscore

Making your URL complex not only affects human users but also search engine robots. These are the crawlers that read your website and index your pages to where they belong. If you use numbers and unintelligible symbols, the search engine bots will spend more crawl budget, which is bad for you. 

How come underscores are not recommended? 

The way Google sees it, hyphens are word separators. This means that if you use hyphens, it is easier for the Google algorithm to read and separate words from each other. An underscore, however, is not recognized as such.

The end result is that Google can understand the context of your URL better. And if it does, it can do a better job in indexing your URL. 

Why is underscore not a word separator? 

If you use underscore, like red_widget, Google reads this is redwidget, not red widget. But why? 

We can trace this to the history of Google when it was still starting out. Most of them wanted to have precision in the search terms. The problem was that underscore was used in the programming language. Because of this, there could be confusion between what is a programming language and a word. 

For example, a programming language looks like this: init_var. 

In the eyes of a programmer, he knows that it is a code. Therefore, the machine must also identify it as a code, not a word. So, eventually, they decided that it is better to use the hyphen (-) to separate words. 

Because of this, the practice has been the same for Google for years. It may seem that using underscore might have a significant impact on SEO. As it turns out, not a lot. 



Does underscore have an impact on SEO?

According to Google, there is no big difference. The effect of using underscore is merely secondary, not a primary one. Google pointed out that Wikipedia uses many underscores, yet its articles rank high on the search results.

However, Google says that if you are starting a new website, you have to use hyphens instead of the underscore. 

Google thought of also using the underscore as a word separator. However, they found out that using either an underscore or a hyphen has little impact on rankings. As such, they discarded the project and decided to use their resources to do something else. 

So, why is the impact minimal? 

Google does not only use URLs to index a website. It uses hundreds of factors to determine what your webpage is about. 

Here are some more factors that Google takes into consideration:

1. Headlines

Surely, you do not use underscores to separate your texts in your headlines. If you use the right headlines, Google will index your content where it belongs, regardless of the URL. This is why there are URLs made of numbers, yet they still rank on the search engine results pages (SERPs).

See this example below:

This webpage still ranks even if the URL is comprised of numbers. 

2. Keywords

Another factor that you have to think about is the use of keywords. Instead of focusing on URL structure, focus on your keyword usage. 

Here are some questions worth asking yourself: 

  • Is your keyword in your headline?
  • Did you use LSI keywords in the body of the text?
  • Did you use relevant keywords in your sub-headings? 

Concerning this, you have to make sure that you are not stuffing your content with keywords. Even if your URL uses underscores, the keywords in your content play a big role in your ranking.

3. Content

Content is one of the main things you have to worry about as far as ranking is concerned. You must write content that is fresh and relevant to what a user needs. If you succeed in doing this, your web page will get more SEO juice from Google rather than merely working on your URL. 

Take a look at this example: 

In this example, the keyword we used in the search box is “elapid family of snakes.” 

As you can see, Wikipedia is at the top of the SERPs. But if you open the web page, this is what the URL looks like: 

The URL is gibberish. It does not follow the standard format that Google recommends, yet it sits at the top of the rankings. This goes to show that while URL structure is important, content is still the king. 

As you can see, the URL or your slug is just an address that helps Google direct users to your site. If anything, using hyphens merely makes it easier for readers to understand what your content is about. It also makes it easier for robots to decide that the texts are not program codes but texts intended for humans to read. 

Should you bother changing from underscore to hyphen? 

No, Google said that it is not necessary. As mentioned, the impact is relatively low. There is no need to change your URLs from underscore to hyphen. 

If you do this, you are going to have bigger problems. Your URLs will change, and Google will have to reindex your pages again. If you make the changes, you will experience an SEO nightmare

So, if you are already using underscores, do not bother making any changes. If you are starting a new website, then use a hyphen in our URL. 

Summary

Using a hyphen in your URL is much better than an underscore. The Google algorithm views a hyphen as a word separator, but it does not do the same for an underscore. As such, it is easier for Google to separate the words in your URL and index them accordingly.

If you are already using underscores in your URL, there is no reason to panic. Underscores in URLs have minimal impact on SEO and rankings. However, it is better to use hyphens if you are starting a new website. 



John Kilmerstone

I'm an Aussie living in Japan who enjoys traveling, photography, and blogging. Please visit this website and explore the wonderful world of blogging. Discover how to turn your passions and pastimes into an online business.

Recent Posts