Hyphens vs Underscores in URLs: Which Is Better?
Why Google recommends hyphens over underscores to separate words in URLs, and whether you should change existing underscore URLs.
When joining words in a URL you have two common choices: seo-tips or seo_tips. For public web pages, hyphens are the recommended choice.
What Google recommends
Google's URL structure guidelines recommend using hyphens to separate words in URLs, because it helps both users and search engines identify the concepts in a URL. Historically, Google's systems treated hyphens as word separators but could read words joined by underscores as a single word, so seo_tips might be understood as "seotips".
Why hyphens are friendlier for people
- Visibility: underscores can be hidden when a link is underlined, so
seo_tipsmay look likeseo tipswith a space. - Convention: most major websites use hyphens, so visitors expect them.
- Readability: hyphens create clearer visual gaps.
Where underscores are still normal
- Programming identifiers such as
snake_casevariables. - File names in some systems and internal tools.
- Database column names.
These are not public URLs, so the convention there is different.
Should you change existing underscore URLs?
Usually not for existing pages that rank and have links. The benefit of switching is small, while changing URLs carries risk:
- Every old URL needs a 301 redirect.
- Internal links must be updated.
- Rankings can fluctuate temporarily.
Use hyphens for all new pages, and consider changing old URLs only during a planned site migration or redesign.
Generate the right format
The slug generator uses hyphens by default. If you need underscores for file names or internal keys, switch the separator to underscore with one click.
Frequently asked questions
Does Google prefer hyphens?
Does Google prefer hyphens? Yes. Google recommends hyphens over underscores to separate words in URLs. A hyphenated URL is clearer for both people and search engines.
Which URL separator should I use?
Use the hyphen as your URL separator. Underscores belong in code and some file names; dots are for configuration keys. Our slug generator lets you choose any of the three.
Try the free Slug Generator
Turn titles into clean, SEO-friendly URL slugs with bulk mode and smart trimming.
Open Slug Generator