Naming Your Files for the Web

Browsers and servers have their own set of rules when they try to read the files you create for the web. Follow the suggestions below and your pages will speed to your audience without a hitch.

Rule

Do it like this...

and not like this...

1. Never use spaces within, before or after the name of any file that is destined to go on a web server.

howtofish.html
abouttrawlers.htm
sand_crab.gif

how to fish.html
  abouttrawlers.htm
sand crab.gif

2. Never use unusual characters within a file name. Avoid punctuation marks (other than period hyphen and underscore), accented vowels and other special characters.

gmunoz.html
oceanvolcano.gif

 

gmuñoz.html
ocean/volcano.gif

 

3. Keep your file names short (under 27 characters) but meaningful.

howtofish.html
sandcrab.gif

howtofishtutorialpart1.html
picture352.gif

4. All web page files must end in

  • .html or
  • .htm

All graphic files must end in

  • .gif or
  • .jpg or
  • .jpeg

Pragmatic suggestion: To make your files equally acceptable to both Mac and Windows-based editors and servers, you might want to stick with the least common denominator which is the 3-letter versions of all extensions.

webquest1.html
jellyfish.jpg

webquest1
jellyfish

5. Some servers are case-sensitive. That is, the file hello.htm isregarded as a different file than Hello.htm If you use upper case, you need to be consistent in all your links to that file.

Pragmatic suggestion: The safest course is to keep everything in lower case.

theend.htm

TheEnd.Htm

These rules are simple, but novice webwranglers often forget them and end up scratching their heads when the result is a graphic that doesn't show up or a link that doesn't work. To cement your understanding of this page, try out the Practice Exercise.


This page by
Bernie Dodge. Last updated June 27, 1998.