Possible Duplicate:
Underscores vs. hyphens in URLs

I'm going to implement a sort of "friendly url" for geography like a regex


and then I wonder which type is best:




I can understand advantages and disadvantages with both ways of writing the name. Which way do you think I should represent the whitespace? I'm passing on the name to a geocoding lookup that encodes the whitespace with this python code

param = {"address" : region,
        "sensor" : "false"
encoded_param = urllib.urlencode(param)
url = 'http://maps.googleapis.com/maps/api/geocode/json'
url = url + '?' + encoded_param
result = urlfetch.fetch(url)
jsondata = json.loads(result.content)
latlng = jsondata['results'][0]['geometry']['location']
lat = latlng['lat']
lon = latlng['lng']

And the result will have the longitude and the latitude of for instance New York and doing it this way it will work for any region and city. Could you please answer, comment my whole scenario or just say if you prefer a slug like new_york or new-york.

Thanks in advance

  • 2
    Will your friendly URLs survive chopping .. that is, what will happen if someone takes /us/new-york/shoes and truncates it to /us/new-york ?
    – Erics
    Commented Dec 10, 2011 at 6:30
  • 1
    Dashes are generally more common. I personally find the _ underscore very ugly and old fashioned but that's just opinion. Slightly more objectively I don't see it used very often any more.
    – Ben Brocka
    Commented Dec 11, 2011 at 1:53
  • dashes are easier to spot in print and Google (SEO) prefers dashes as word separators. Thus, dashes win.
    – DA01
    Commented Dec 11, 2011 at 23:16

4 Answers 4


I don't think there is any difference from a UX standpoint. But I'd say dashes are much more common and common is good. :)

PHP content management systems like Drupal and WordPress prefer dashes. In the past, Matt Cutts at Google has also recommended dashes:


Edit: Google recommends dashes/hyphens too: http://support.google.com/webmasters/bin/answer.py?hl=en&answer=76329

  • Good answer. I think a good argument is that dash is easier to pronounce as well. Commented Dec 12, 2011 at 8:12
  • 1
    Depending on the rendering engine and font - when underlined as part of a link, underscores are virtually indistinguishable from spaces (eg compare a-link-with-dashes vs a_link_with_underscores (may need to hover here on ux.se) - so dashes are better from that perspective too. Commented Dec 12, 2011 at 10:08

Not professing to be a UX pro by any means, but could dashes be easier for the user because a) typing an underscore requires the use of the shift button in conjunction with the key and b) when reading, a dash is in the center of the words, assisting the flow of the eye. An underscore is at the bottom of the words, perhaps subtly drawing the eye down and creating a small distraction.

Just a couple of thoughts.

  • Thank you for the answer. I'm likely to choose dashes now. I think that dash is easier to pronounce as well. Commented Dec 12, 2011 at 8:13

There might be difference from UX position. "-" is way more common than "_" and it might affect users.

The question is how are you going to expose users to those links and if they really will notice them.

  • Also technically a python filter named slugify makes a format with dashes and it can be good to be compatible with a known algorithm that also has implementation for special cases such as escape chars and foreign characters. Commented Dec 12, 2011 at 8:14

Dashes tend to be more readable, and perhaps even less "techy", than underscores.


Not the answer you're looking for? Browse other questions tagged or ask your own question.