121

Which is better for search engines?

  1. example.com/my_cool_page.html
  2. example.com/my-cool-page.html
  3. example.com/my+cool+page.html
3
  • use + (plus). Commented Oct 31, 2012 at 14:36
  • 6
    @JanusTroelsen: You should not use + to represent a space in the path part of the URL (the subject of this question). However, + can be used to encode a space in the querystring (URL parameter value). Related: webmasters.stackexchange.com/questions/32867/…
    – MrWhite
    Commented Nov 19, 2012 at 14:31
  • 1
    Good video about it from a Google engineer: youtube.com/watch?v=AQcSFsQyct8 (Matt Cutts was also mentioned in the accepted answer below)
    – JohnB
    Commented May 21, 2015 at 15:35

13 Answers 13

96

Although there seems to be less difference now than there was in the past, hyphens are recommended if you want each of the terms in your URL recognized as an individual word.

The reason for this is that search engines find it easier to treat hyphens as word separators, just as they are in the English language. Underscores, however, are not normally used in English as word separators. In many cases it is desirable to see them as part of the characters before and after them, for instance when underscores are used in function names for programming, and other similar situations.

There are a couple cases where this might matter. For one, if someone uses the full URL as the anchor text for a link, then the search engines will be able to pull out those terms as relevant words. For another, it is possible that search engines use words in the URL as correlative factors to determine the relevance of those terms to the page content.

Matt Cutts has a dated piece that explains this, and there is a more recent Google Webmaster Help video from August 2011 saying that Google still does not treat underscores as word separators. You may as well make life as easy as possible for the search engines, for the same reason that you give them valid HTML.

If you are starting a new site, you are definitely better off using dashes.

1
  • thanks for the answer. is this still the case in 2020?
    – Crashalot
    Commented Aug 17, 2020 at 5:06
77

The Stack Exchange network of sites are highly ranked with Google and The Stack Exchange uses hyphens in their URLs. For example, here is the URL for this question:

https://webmasters.stackexchange.com/questions/374/urls-should-i-use-hyphens-underscores-or-plus-symbols

11
  • 25
    I don't really see this as "proof". Yes, you can assume the Stack guys probably know SEO, but it may be the choice of hyphens in the URL rewriting engine was arbitrary or chosen for some other reason. We don't know and therefore this answer is nothing more than speculation.
    – Dan Diplo
    Commented Aug 5, 2010 at 16:01
  • 4
    @Dan SO gets about 85% of its traffic from google (or so I recall from a blog post I saw) and I have searched for programming related info and found SO pages that were only minutes old. So I think we can say the that Stack guys know a thing or 2 about SEO
    – Sruly
    Commented Aug 5, 2010 at 16:40
  • 1
    Good point. WordPress uses the same convention as well.
    – TFM
    Commented Aug 5, 2010 at 17:03
  • 30
    Sorry, but it's a logical fallacy to say "Stack is highly ranked with Google and Stack uses hyphens in URLs therefore hyphens in URLs are better for SEO". There is no proven causal link. The main reason Stack ranks high on Google is that it's a very popular website and Google knows this.
    – Dan Diplo
    Commented Aug 5, 2010 at 19:21
  • 3
    Although Dan is technically right, all this "proof" discussion is really detracting from the elegance of the answer.
    – Fletch
    Commented Aug 8, 2012 at 14:10
22

This article by Jeff Atwood always clinched it for me: Of Spaces, Underscores and Dashes:

This_is_a_single_word, but this-is-multiple-words.

... though this no longer seems to hold in the case of Google (try searching for "web-site": it is considered as one word).

2
  • I understand and agree with the view point. However, I personally prefer the underscore as a separator for readability reasons. That's why I've switched to using underscores as separators in my delicious tags. Commented Aug 5, 2010 at 20:23
  • I have several websites that use underscores but never dashes and all the major search engines seem to recognize them OK. Really I don't know why I started doing that other than the fact hyphens tend to word wrap when underscores don't. Commented Sep 17, 2010 at 8:00
10

Another downside of underscores is they will be invisible in some browsers when the entire URL is rendered as a link with an underline, which may be confusing if the user attempts to use the URL without copying and pasting (e.g. writing it down or reading it out).

4
  • Unfortunately, this doesn't answer the question (which refers specifically to search engines), although I actually think it's the most useful answer here!
    – Bobby Jack
    Commented Aug 5, 2010 at 17:08
  • 2
    This is true, but when you do have the underline, it looks just as good as a space! (without canonizing effects) Commented Sep 17, 2010 at 8:01
  • This was the original reason from years ago for not using underlines.
    – Rob
    Commented Jun 23, 2013 at 12:43
  • +1. It doesn't really matter for search engines anyway. If they really need text from the URL, the page obviously has no content at all.
    – Oskar Skog
    Commented Jul 19, 2017 at 18:53
8

I think hyphens are easier to read, and it's what is in use the most (so your users will expect the URL to contain hyphens).

5

I believe hyphens will do better on search engines, since they are used as word separators. Plus they are a little easier for users to read.

5

I'm all for hyphens. Using underscores for a multi-word phrase makes sense too. Hyphens are a tad quicker to type because you don't have to hit the shift. It may end up being a preference thing, but with the end user in mind, if hyphens are easier to read, then use em.

1
  • 3
    From an SEO perspective hyphens are better then underscores as they are word delimiters and underscores are not
    – John Conde
    Commented Mar 10, 2011 at 15:41
4

I personally think dashes are easier to type than underscores because you don't need to press shift to get them. I'm also wondering if many people would even know where to find the underscore on the keyboard.

Of course, this isn't a big deal because most users are not typing in website addresses, but it's possible someone might be at sometime.

3

For me, it's easier to read hyphens than underscores. I think it's probably easier for most other people too.

Hyphens are treated as word dividers, which help your page names be seen as real words, which is a good thing.

Underscores, in many, if not most, cases are not treated as word dividers, which renders a page name as a big cluster of letters and underscores.

This means that -- all other things being equal -- your pages will score lower in most places if you use underscores rather than hyphens in your pages names. How much lower? Not much. Will this always be the case? No.

3

What's better for search engines?
Doesn't matter. What does matter is: What's better for users?

  • A modern search engine shouldn't rely on strange rules of what is a word separator and what is a word joiner or whatever. Modern search engines can deal with typos, apostrophes, punctuation, etc. Figuring out which characters separate words shouldn't be much of an issue.

  • I disagree with the people who claim that hyphens are better because they are natural word delimiters. They kind of are, but kind of aren't: they make words semi-attached or semi-delimited. The natural word delimiter is %20.

But the above statements are irrelevant. The URL shouldn't be important anyway.

How important are the keywords in the URL?
They shouldn't be important, if they are there's obviously no content on the page.

  • URLs aren't very visible for humans: links may have anchor text instead, it's not shown on the page and it's not shown on the browser tabs.

  • The <title> and the main heading are more visible and usually contain the same keywords anyway making the keywords in the URL redundant.

How important is it for humans?
It depends.

From a search engine point of view: not at all, the user only needs to enter a search query and click on the snippet with an interesting title and description.

But visitors come from other places too. In some cases, there's a nice anchor text instead making the "URL quality" irrelevant, but there are cases when it does matter.

  • Quick and dirty copy-pasting/sharing of the URL: no issue for the writer, but it does matter for the reader.

  • Needing to enter the URL manually. (Can't copy text from an image for instance.)

What determines the quality of a URL?

  • Length; You don't want address bars to scroll horizontally or URL only links to linewrap. And needless to say: it also takes longer to type a longer URL.

  • Word delimiters; It appears that most people agree on that hyphens are better.

  • Clutter; Eg: Unique IDs, filename extensions, weird URL parameters. These are difficult to remember.

  • Strange characters and syntax; An outdated example would be tildes (http://example.com/~user/), but URL parameter syntax is a bit strange too. Any uncommon character might be difficult to type for some people.

  • Safe characters vs Unicode; This is a two edged sword and deserves its own answer. But briefly: browsers mangle URLs, %c3%a4 etc is a pain in the ass to type, not every keyboard can enter the unsafe characters, possibly some encoding hell, but the keywords make sense for native speakers.

  • Length of the text; Consider the URL to be a form of a title, don't waste words mentioning the obvious and ignore grammar.

People will type something slightly different
Your webserver should be designed to redirect recognized non-canonical URLs to their canonical version. It's up to you to decide:

  • http vs https

  • www vs no www

  • trailing slashes vs no trailing slashes

But your server needs to accept and correct all of them.

A 404 page with search results would be nice for the user. (Use the words from the URL as the search query.)

2

Another point that should be added is that the pixel-width of a hyphen is smaller than an underscore, which may allow you to get another keyword into the search results.

1
  • If pixel width (and available space) is an important factor then maybe a . (dot) - smaller than a hyphen - would work?
    – MrWhite
    Commented Jul 7, 2017 at 23:12
1

Google is pretty clear that they prefer hyphens:

We recommend that you use hyphens (-) instead of underscores (_) in your URLs.

https://support.google.com/webmasters/answer/76329?hl=en

In short - Google views hyphens as word separators in a URL, making it much easier for Google to identify words and figure out what the page is about. Underscores and plus signs can have multiple meanings and are less clear to Google.

0

It depends from what you want to express with the URL:

On the surface, it’s easy to believe that hyphens and underscores are treated the same by search engines. However, this is not the case.

In short, Google treats a hyphen as a space (or word separator). So, while you may not be able to add a traditional space, it still appears this way in the eyes of Google.

An underscore, on the other hand, is considered a “word joiner.” Sticking with the example above, miami_real_estate_agent is the same as miamirealestateagent to Google.

Charlie Rose

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.