Home / Development / Dashes vs. Underscores

Dashes vs. Underscores

When deciding on a naming convention for pages on your site one might assume with good reason that dashes and underscores are equivalent. That is to say that soft_drinks/grape_soda and soft-drinks/grape-soda are viewed the same by Google. This is actually not the case, Google views these pages differently.

The reason for this is one of programming convention. When naming variables and functions in most programming languages, underscores are one of the few allowed characters, whereas dashes usually are not. In the early days of Google, it was a serious concern that programmers be able to search based on variable or function names and find what they were looking for with accuracy, so underscores were given special treatment.

Google views underscores as a character that continues a word, like any alphanumeric character; whereas dashes are a separator like space. That is to say that Google will treat “soft_drinks” as one single entity but “soft-drinks” as two (‘soft’ and ‘drinks’.) In most cases this alone isn’t going to have a ton of impact on your page rankings, but if you are designing a new site from scratch, Google recommends using dashes instead of underscores.

But if your site is already up and running with underscores in place, it’s probably not a big deal. Just because the page is stored as “grape_soda” doesn’t mean it won’t hit on a search for “grape” or a search for “soda” or even a search for “grape soda”. It will still hit it, but just won’t benefit as much for the page name if it were named “grape-soda”.

About Dave Matteson

David is a Lead Developer at A2 Hosting. He has been writing code professionally for nearly twenty years, and enjoys writing and reading about programming. David does his coding from his house in the woods with his wife and dogs

Check Also

A logo on a car.

How to Find Quality Logo Designs on a Budget

Logos are one of the most visible elements of many websites. When you first load …