{
"$type": "site.standard.document",
"canonicalUrl": "https://www.simoncox.com/short-articles/2006-06-01-dashes-vs-underscores/",
"description": "An ongoing debate about whether it is better to use a dash, or hyphen, in a file name or to use an underscore instead. I used the underscore for many years.",
"path": "/short-articles/2006-06-01-dashes-vs-underscores/",
"publishedAt": "2006-06-01T00:00:00.000Z",
"site": "at://did:plc:tki7vwlanxbwrz2er67eaeqa/site.standard.publication/3mp4h4md7zv2y",
"tags": [
"Web",
"SEO"
],
"textContent": "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.\n\nExample:\n\nmy_day_out_with_co-pilot_paula.jpg\n\nmy-day-out-with-co-pilot-paula.jpg\n\nI think that the first is far more readable than the second from a grammatical sense it is correct.\nHowever 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.\n\nMatts 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 and 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.\n\nHence the best file name for the jpeg file above should thefore be:\nmy-day-out-with-co_pilot-paula.jpg\nwhich is just semantically silly.\n\nThe reasoning given found in a post on webmasterworld behind this is that it was to allow techies like us to search 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?\n\nSo I did some searching on this term in Google and these are my results:\n\nDashes vs Underscores searches on Google\nSearch term\t– Number of results\n1. HTTP_USER_AGENT\t– 1,440,000\n2. HTTP-USER-AGENT\t– 3,240,000\n3. \"HTTP-USER-AGENT\"\t– 3,220,000\n4. HTTP USER AGENT\t– 138,000,000\n5. \"HTTP USER AGENT\"\t– 3,220,000\n6. co_pilot\t– 1,230\n7. co-pilot\t– 7,740,000\n8. \"co-pilot\"\t– 4,070,000\n9. co pilot\t– 95,200,000\n10. \"co pilot\"\t– 4,070,000\n\nInteresting 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.\n\nSo 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 resolve this correctly and perhaps Google will soon follow.",
"title": "Dashes vs Underscores"
}