Should You Use Spaces in Filenames?

Don't start or end your filename with a space, period, hyphen, or underline. Keep your filenames to a reasonable length and be sure they are under 31 characters. Most operating systems are case sensitive; always use lowercase. Avoid using spaces and underscores; use a hyphen instead.

Why is it not a good idea to have a space in the filename?

It is extremely cumbersome to handle space escaping correctly over multiple levels of scripting languages. So if there is any chance that your program is supposed to be compiled by a Makefile-based build system, don't use spaces in your filenames.

Should file names be all lowercase?

Key Point: Use all-lowercase, and separate words with hyphens. Make file and directory names lowercase. In general, separate words with hyphens, not underscores. Use only standard ASCII alphanumeric characters in file and directory names.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.