Search

Hypens or Undercores? Here’s the difference

  • Share this:
post-title

Over the years, I’ve seen a lot of designers and developers get a little befuddled about when to use either of the two. Today, let’s look at the difference between hyphens and underscores, and when should use them.

Hyphens:
Hyphens are short little lines used to connect two or more words that work together as a single concept. They’re often used to form compound modifiers before a noun, such as in “hyphens-vs-underscores” or “coding-the-world.” A hyphen can also join a prefix to a number, like “pre-2000 economy.” Hyphens may also be helpful to add clarity when adding prefixes to regular words: For instance, is a “small business owner” someone who owns a small business, or is it a business owner who is small? If confusion is possible, we use a hyphen.

Underscores:
When to use this? The short answer to this question is “don’t“, by and large, or on the whole. The underscore was originally created to make an underline on a typewriter. So before the days of word processing, you’d normally type however many letters worth you needed, then go back and type the letters on top of the line you’d created. Whew. That was tedious. These days, however, we’re perfectly capable of underlining and even italicizing with the help of word-processing software. Nowadays, the only place where the underscore is still predominant is in technical uses like within email addresses, social media handles, or sometimes, file names.

Now, the big fish:
If you’re very concerned about SEO then read this.
Google views hyphens in URLs as word separators while an underscore in your URL will not be recognized. This means using hyphens makes it much easier for Google to figure out what a page is about. For example, a URL containing the phrase “all_top_devs” would be interpreted as “busystory.com“, whilst a URL containing the phrase “busy-story” would be interpreted as “busy story”.

Hopefully, this should help you toe the line on using these useful types of separators correctly. Use them wisely in file naming to make your text clearer and more readable. Use them in your URLs to make Google understand you better.

Enjoy!

Design | UX | Software Consultant
More from Author