Content
- Home
- Action
- Blogging
- Croydon Residents Against Parking Plans
- CSS
- Flashmobs
- Gallery
- Garden Project
- Holidays and trips
- Life
- Listening
- Media Management MA
- News
- Opinion
- Pittock Reunion
- Rants
- Reading
- Simon Cox's
- Standards
- Tech
- Tickled
- Watching
- Web
- Webcam
- All entries
- Tag Cloud
- Loxley Barton Falls
Webcam
Home » Web » Standards » Dashes vs Underscores
« England car flags | Main | English will be first telepaths »
Dashes vs Underscores
Dashes vs Underscores is an ongoing debate about whether it is better to use a dash, or hyphen, in file name or to use an underscore instead. Over the past few years I have always used the underscore both at work and in home projects. This was for two reasons - the first being that underscores make the file name easier to read and secondly it means that I can use hyphenated words correctly in file names.
Example:
- my_day_out_with_co-pilot_paula.jpg
- my-day-out-with-co-pilot-paula.jpg
I think that the first is far more readable than the second from a grammatical sense it is correct.
However there seems to be a great deal of talk in the SEO communities, and especially from Matt Cutts of Google, that hyphens, dashes are better than underscores in file names hence the Dashes vs Underscores debate.
Matts argument is that Google reads underscores as part of the word and that the dash is seen as a separator. This would mean that "co-pilot" is read as "co" and "pilot" by Google and "co_pilot" is read as a single word "co-pilot".
Hang on though this is back to front - the wrong way around! This would mean that all my hyphenated words in file names should have underscores to allow Google to correctly read them.
Hence the best file name for the jpeg file above should therefore be:
my-day-out-with-co_pilot-paula.jpg
which is just semantically silly.
The reasoning given (found in a post on webmasterworld) behind this is that it was to allow techies like us to easily do searches for HTTP_USER_AGENT and not have to sort through millions of results containing "HTTP", "user", and "agent." But why would they not use quotes to get the correct term?
So I did some searching on this term in Google and these are my results:
| Search term | Number of results | |
|---|---|---|
| 1 | HTTP_USER_AGENT | 1,440,000 |
| 2 | HTTP-USER-AGENT | 3,240,000 |
| 3 | "HTTP-USER-AGENT" | 3,220,000 |
| 4 | HTTP USER AGENT | 138,000,000 |
| 5 | "HTTP USER AGENT" | 3,220,000 |
| 6 | co_pilot | 1,230 |
| 7 | co-pilot | 7,740,000 |
| 8 | "co-pilot" | 4,070,000 |
| 9 | co pilot | 95,200,000 |
| 10 | "co pilot" | 4,070,000 |
Interesting reading I think. With the first search term HTTP USER AGENT numbers 4 has the most results as it is just the three words but 3 and 5 are the same suggesting that Matt Cutts (and reiterated again recently) is correct in saying that hyphens are seen as spaces. 8 and 10 would also confirm that this is a fact but if the hyphen is the same as a space then 7 would be the same as 9. So adding the dash without the parenthesis does do something.
So am I going to change all my file names to use a dash? No. Like Shawn Hall I have had very favourable results using underscores and especially from Google. What Matt Cutts is saying might be technically correct but grammatically it is the wrong solution. Other search engines will get resolve this correctly and perhaps Google will soon follow.
Posted by Simon at June 1, 2006 12:37 PM
Trackback Pings
Listed below are links to weblogs that reference Dashes vs Underscores:
» Dashes Vs Underscores In URLs from you've been HAACKED
Dashes Vs Underscores In URLs [Read More]
Tracked on March 16, 2007 1:06 AM
Comments
- 1 March 16, 2007 2:58 AM Jeff Atwood
Also, I demand that all sentences end in exclamation points! I eagerly await Google's attention in this matter! Thank you!
- 2 November 12, 2007 6:02 PM Jeff
The problem I have seen with underscores is that the underscore disappears when the word is hyperlinked - this causes confusion and errors.
- 3 November 13, 2007 12:30 AM Simon Cox
![[TypeKey Profile Page]](http://www.simoncox.com/nav-commenters.gif)
Fair point Jeff but I can't think of a situation where you would actually need to use a file name in your text. For example if you have an example_text.html page and wanted to link to it you should make the visible text part of the link something more readable anyway: Example text as this is getting picked up by the search engines as contextual content for the link.
I am sure there are plenty of pages on the web with hypelinks to files where the file name is displayed on the page - you don't need to do it.









