Hyphen or underscore for urls?

I often get asked whether I’d recommend dashes or underscores for words in urls. For urls in Google, I would recommend using dashes. Why?
Rudra's picture

Separate SEO URL words using hyphen, or underscore?

The recurring question in SEO URLs is whether to use a hyphen, or dash, (these-are-hyphens) or an underscore (these_are_underscores) to separate your words. Does Google recognize both of them as word separators?

The short answer is that you should use a hyphen for your SEO URLs. Google treats a hyphen as a word separator, but does not treat an underscore that way. Google treats and underscore as a word joiner — so red_sneakers is the same as redsneakers to Google. This has been confirmed directly by Google themselves, including the fact that using dashes over underscores will have a (minor) ranking benefit.

Again, SEO URLs should use hyphens to separate words. Do not use underscores, do not try to use spaces, and do not smash all the words together intoonebigword.

 if you have a URL like 'keyword1_keyword2' Google will only return that page if the user searches for 'keyword1_keyword2' (which almost never happens).

If you have a URL like 'keyword1-keyword2', that page can be returned for the searches for 'keyword1', 'keyword2', and even 'keyword1 keyword2'.