1. Home
  2. Computing & Technology
  3. Web Design / HTML
Jennifer Kyrnin
Jennifer's Web Design / HTML Blog

By Jennifer Kyrnin, About.com Guide to Web Design / HTML

Poll: Which do you prefer for word separation in filenames or directories?

Thursday September 24, 2009

Hopefully no one chooses "spaces" as their preferred method of separating words in file names. While most browsers have gotten to the point where they can open a file with a space in the name, they still can cause problems. It's much better to use a special character like a hyphen or an underscore for separating words. What do you use to separate words in file names? And why? Share your thoughts in the comments.

More Help With Web File Names

Comments
September 25, 2009 at 2:44 am
(1) plaster says:

While spaces in filenames can be an issue to poorly designed backend software, they are quite well handled by any modern browser. Let’s face it, other characters are used only because of lazy people :)

September 25, 2009 at 2:50 am
(2) plaster says:

I mean “because of lazy people”, not “by lazy people”.

September 25, 2009 at 4:34 pm
(3) Alex says:

The hyphen. From my (rather generalized) understanding of SEO, many search engines treat words separated by underscores equivalent to single compound words. So searching for “Mariners” might not hit on a file named “MLB_Mariners_2009_schedule.pdf”.

By using the hyphen, you circumvent that issue, encouraging better SEO results.

September 25, 2009 at 5:00 pm
(4) Ben says:

Alex, I never heard that about search engines and the underline character. Though, I often use underline character for includes, data table names, etc. I prefer to use camel case for my web files or all lowercase. I never use spaces on any file names, they cause too much problems with conversion software.

September 26, 2009 at 8:31 am
(5) Jon Stringer says:

I always use hyphens these days, although SEO wise hyphens are technically better than underscores you can still get the same results with underscores.

Google did say that they were going to treat underscores just like hyphens (as word separators) However, I think I remember Matt Cutts saying they havn’t done that yet for some reason.

JP

September 26, 2009 at 9:12 am
(6) Chris from AB Web Design, LLC says:

Underscores are soooo last season. :P

Hyphenation is where it’s at!

September 26, 2009 at 2:21 pm
(7) Debi says:

myFavoriteWayIsWithUseOfUppercase_but_sometimes_underscoring_usually_if_there_is_a_date_like_100309.jpg

September 28, 2009 at 3:18 pm
(8) Alexander says:

Used to rely on underscores, now I’m using hyphens.

September 29, 2009 at 6:13 am
(9) Jakob says:

To tell you the truth, i don’t really have a preference. mod_rewrite hides it from both me and my users anyway…

Perhaps we should never have been allowed to use spaces in filenames at all; either that or the command interpreter should have used something other than space to separate the command from the argument list.

September 29, 2009 at 10:52 am
(10) John says:

Hyphens, hyphens, hyphens …always have, always will. Never have understood the inclination towards underscores by so many. As the default for links is underlined, the underscore can be “hidden” and cause confusion. Email addresses with underscores should be banned! Lastly, for those where every key-stroke counts, you don’t need to press your shift key to get a hyphen.

September 29, 2009 at 12:37 pm
(11) Mary says:

I like CamelCase. It is simple, fewer keystrokes, doesn’t get lost in underlined text, and I hate typing anything that has to use the top row on the keyboard! :-D

September 29, 2009 at 2:29 pm
(12) George says:

Do you know that “,” is much more good to ‘hidden’ files? For example, you can “login,module.php” or even “home,page.html”.

September 30, 2009 at 9:19 pm
(13) Kestrana says:

I used to strictly use underscores. More recently, I have switched to using a combination of underscores and hyphens, usually based on what words are being separated.

For example, I will use about_us.html for the name of a file. I have learned to start versioning files; this is where the hyphens come in:
about_us-v1.html or about_us_09-30-2009.html

At work, I often screenshot images or have to copy date- and/or time-sensitive data into a file. For these, I will separate the date and time with an underscore and use hyphens to separate the MM/DD/YYYY and HH:MM. For example:
09-30-2009_13-12hrs.txt

(I’ve learned to specify hrs in the filename because not everyone at my workplace understands military time–they’re not all technically oriented.)

October 2, 2009 at 11:37 pm
(14) Joy says:

Using anything but hyphens is a pet peeve of mine. I will often get hired by a company that is redoing the Web site only to find out that the top management has specified underscores as the standard. Yuck. Underscores aren’t picked up by search engines, and it has been shown that words separated by hyphens are easier to read than those separated by underscores.

I think it somehow goes back to the convention of only allowing underscores, letters, and numbers in names.

The argument against camel case is the same as that against underscores.

It’s good to keep file names as close to the root as possible. Some search engines will stop after going down three levels. So using too many slashes is out.

Spaces cause issues. They are often converted to %20, and then they most be unconverted.

Periods usually denote extensions. For example, if I have an include file that is for the whole site and it includes other JS files, I will name it something like gobal.js.inc The include filename never gets shown in the browser.

November 5, 2009 at 2:20 am
(15) Sterling Doughty says:

I usually use capital letters to separate words in a file name:
Norway09fjordSM Each word starts with an upper or lower case letter depending on what the word preceding it ended with. SM (small) is my code for a picture I have reduced from its original size to 1024 x 768 pixels.

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.