Hyphens or Underscores in URLs: Which Is Better for SEO?

Hyphens vs underscores in a URL example

Every page on your website has an address, called a URL. The last part of it, such as /blue-dress, is what people see in the address bar and in search results. A small choice there, using a hyphen (-) or an underscore (_) between words, The hyphens vs underscores question causes a lot of arguments. Google has recently clarified its advice on this, so here is a straight answer. If you are building or fixing a site and want the basics done right, our web development team can help.

Hyphens vs Underscores: The Short Answer

Use hyphens. Google’s URL structure guide says: “We recommend using hyphens (-) instead of underscores (_) to separate words in your URLs, as it helps users and search engines better identify concepts in the URL.”

That is the whole advice. The rest of this post explains why, and what to do about pages you already have.

Why Does Google Prefer Hyphens?

Think about how you read blue-dress and blue_dress.

A hyphen looks like a gap between two words. An underscore looks like it glues them together.

Google gives the same reason. Its guide says underscores are “commonly used for denoting concepts that should be kept together”, for example by programming languages that name things like format_date. Hyphens “clearly signal a word boundary”.

Is This a Ranking Factor?

Be careful here. Google calls this a recommendation, and we found no line on its page saying that underscores are penalised or that hyphens push a page up the rankings.

So do not expect a jump in traffic from swapping a character. Think of it as a tidy habit: it helps people and search engines understand what the page is about, and it costs nothing on a new page.

What About Joining Words Together?

Google lists three styles side by side on its page:

Style Example Google’s view
Hyphens /summer-clothing Recommended
Underscores /summer_clothing Not recommended
Words joined together /summerclothing Not recommended

Joined words are also harder for people to read at a glance. Hyphens show exactly where each word starts and ends.

Should You Change Your Old URLs?

Not automatically. Here is how we would think about it.

A simple way to decide.

  • New pages: use hyphens from day one.
  • Old pages with underscores that already work and get visitors: think carefully before touching them. Google does not say they are broken, and every change carries some risk. This is our suggestion, not a Google rule.
  • If you do change an old URL: tell Google the page has moved. Google’s redirect guide says: “The 301 and 308 status codes mean that a page has permanently moved to a new location.” It also recommends “a permanent server-side redirect whenever possible.”

A redirect is like a forwarding address. Anyone who visits the old URL is sent to the new one automatically.

Four More URL Habits From Google

The same Google guide has other simple advice worth following:

  1. Use real words, not codes. Google prefers readable words over long ID numbers. For example, a page for a black T-shirt is better as /product/black-t-shirt-with-a-white-collar than /product/3243, as Google’s ecommerce URL guide shows.
  2. Stick to one letter case. Google says it treats /APPLE and /apple as “distinct URLs with their own content”. If your server treats both the same, use only lowercase so Google sees one page.
  3. Keep extras to a minimum. Extras after a question mark, such as ?sort=price, are called parameters. Google says to trim the ones that do not change the content.
  4. Write in your audience’s language. If your customers search in Hindi or German, words from that language can go in the URL. Google’s page notes that characters outside the basic English alphabet should be “percent encoded”, which your developer or website platform can handle for you.

A Quick Check You Can Do Today

You do not need a tool.

  1. Open your website and look at five important pages.
  2. Check the address bar. Do the words have hyphens between them?
  3. Look for capital letters, long number codes or many question marks.
  4. Note any messy ones and ask your developer whether changing them is worth it.

If your site is large, a clear, simple address structure also makes it easier for people to find their way, which is part of good website design.

Quick Takeaways

  • Google recommends hyphens, not underscores, to separate words in URLs.
  • It is a recommendation, and we found no line saying underscores are penalised.
  • Joined-together words are not recommended either.
  • Use hyphens on every new page, and weigh the risk before changing old ones.
  • If you change a URL, use a permanent (301) redirect from the old one.
  • Use readable words, one letter case and as few extras as possible.

Want Your Website’s Address Structure Checked?

If you are not sure whether your page addresses are set up well, or you are planning a redesign and want to avoid broken links, reach out through our contact form and we will go through it with you. Good URLs also make your digital marketing easier to track.