The deeper you venture into the SEO rabbit hole, the more specialized and seemingly ridiculous your questions may become. Here we ask whether to use dashes (hyphens) or underscores in our URLs, and the response from Google is characteristically ambiguous.
What Does Google Say About Hyphens and Underscores?
So, does Google have anything official to say on the topic of dashes vs underscores when it comes to SEO? They do. In Search Console help there is an article regarding keeping a simple URL structure. Specifically we get a clear answer: “We recommend that you use hyphens (-) instead of underscores (_) in your URLs.”
Then why the question? Because in 2016 during a Google Webmaster’s clinic, Google SEO guru John Mueller said that Google “doesn’t really have a preference.” In this case, he’s not suggesting that you use underscores instead of dashes, but simply that Google has no preference. Considering that the official Google Search Console’s help article recommends using dashes, that is what we would recommend you do as well.
Using dashes is either preferred, or at the very least there is no difference. We wouldn’t (and don’t) risk using underscores, as the risk is not justified. Also, dashes are more aesthetically appealing, so there’s no reason not to use dashes. It’s unlikely that using dashes or underscores has much of a difference to your SEO and ranking on the Search Engine Results Page (SERP), but it’s not worth the risk. Leave the underscores to your file names, and let dashes reign supreme online.