dashes-versus_underscores; The Definitive Guide

Computer keyboard and mouse highlighting the use of dashes over spaces and underscores for file naming and SEO optimization

Here we go …

The topic of spaces vs. dashes vs. underscores continues on with respect to how to use them (or not) when naming your files. We’d like to clarify the things that matter when making a choice.

So let’s get right to it, here’s what you need to know.

  1. Despise the spaces
  2. Avoid the underscores
  3. Embrace the dashes

Despise the Spaces

While the avoidance of using spaces in your filenames used to be mostly a computer science issue, it has become a renewed concern as we continually work across platforms and on the web.

For example, macOS allows certain symbols in filenames that Windows does not. This has been an issue for eons that is easily avoided if you just don’t use spaces.

Maybe that’s enough to prevent you from doing so, maybe not. So let’s look at how spaces screw things up on the web.

For files on the web, spaces are replaced with %20 in URLs (or what you can call a web address) turning:

my favorite filename always has spaces in it.jpg

… into:

my%20favorite%20filename%20always%20has%20spaces%20in%20it.jpg

What a mess.

Also, stay away from the following characters:

/ : * ? “ < > | [ ] & $

Avoid the Underscores

Apple will tell you straight up:

Although macOS formatted disks support spaces in filenames, certain processing scripts and applications may not recognize these characters, or may treat your files differently than expected. Consider substituting an underline (_) or dash (-) where you would normally use spaces.

That would leave many thinking underscores are the ticket to the promised land, but hold up.

If you want to use underscores consider the following:

  • Will you ever use the file on the web and/or your own blog?
  • Will you want Google (and other search engines) to be able to index your file?
  • Do you know for sure that your files will never be used on the web, and you’ll never want to have a search engine or site like Pinterest or Instagram index them for easy searching and discovery?
  • Do you want ensure you come up under the proper search terms in Google, Bing, etc.?

All of these items can be affected (unpredictably) by your use of an underscore.

Seems minor, but it’s these minor things that make a huge difference in the above items. Some platforms ignore the underscore entirely, which would toss all your delicately placed characters into one big mess of alphanumeric stew – resulting in miss opportunities to describe keywords for your files and searchability across the web or your own systems.

Embrace the Dashes

Dashes rule. Dashes are your ticket to file naming nirvana.

Why?

First off, Google loves them:

http://www.example.com/my-awesome-photo.html

… is much more useful than

http://www.example.com/myawesomephoto.html.

Many other sites also recommend that you use hyphens (-) instead of underscores (_) in your URLs.

Secondly, they are more human readable:

my-favorite-filename-always-has-dashes-in-it.jpg

Thirdly, if you ever plan to show your work on the web (and enable search indexing beyond Google) or other areas such as Instagram, or any other publicly accessible web resource …

Go with dashes.

It’s an easy insurance policy.

How do you implement?

Most cameras include a facility to define how files are named, and accented with characters such as dashes. There are way too many models to reference here, but a quick review of your user manual should reveal the options for your particular camera make and model.

You can also configure how you prefer files to be named in Lightroom.

What about my previously named files or my blog?

Easy, don’t go back retroactively, simply institute this approach moving forward.

If you’re just starting on a new website, use dashes if you plan to place keywords in your URLs. Those keywords provide a signal of what the page is about and help with your rankings. Every little thing helps with making your site or images searchable.

If you have an existing website that’s already doing well, don’t make such a widespread change like converting from underscores to dashes. The potential problems from changing these URLs might be worse than the potential gains from having dashes rather than underscores in them.

Should you choose to convert to dashes for all new images and blog posts moving forward, you should feel confident you can do so without any negative repercussions.

Brandon Oelling

Hi there! I'm Brandon Oelling, the founder of XEQUALS. My team and I believe deep in our hearts that inside every one of us is an amazing photographer.