Go to top

Pros and Cons: Should You Use Underscores or Hyphens in URLs?

Category: seo Posted on 20-02-2023

When creating a website, choosing the right URL structure is crucial for search engine optimization and user experience. One of the most debated topics is using underscores or hyphens in URLs.

In this article, we’ll explore the pros and cons of each option, so you can make an informed decision about which one to use in your URLs. Whether you’re building a new website or optimizing an existing one, this topic deserves your attention.

Let’s dive in and find out which one is right for you.

 

Underscores vs. Hyphens

A hyphen (“-“) is used to join words or parts of words together to form compound words, to indicate a word break at the end of a line, or to separate numbers in a range.

An underscore (“_”) is typically used to represent a space in a computer programming context. It is commonly used in file names, variable names, and other programming identifiers where spaces are not allowed.

The main challenge with determining whether to use underscores or hyphens is to address the readability of URLs. If you have a URL such as “store.com/buythebestproduct,” it can be challenging for the reader to understand the message.

However, if you use hyphens to separate the words, it becomes “store.com/buy-the-best-product,” which is much easier to read and understand. On the other hand, using underscores will give you “store.com/buy_the_best_product.”

As you’ll notice from the Eye10 On-Page SEO tool, the use or non-use of underscores is a content analysis factor.

image

 

Either way, the URL looks cleaner than just mashing the words together. So, which should you use? Which is better for SEO? Is one method even better than the other? Or should you do whatever you like?

 

Should You Use Hyphens or Underscores?

First of all, hyphens are more widely used than underscores. Google recommends using hyphens in URLs, as they are easier for humans and search engines to read. On the other hand, underscores can be harder to distinguish from spaces, especially when they are used in long URLs.

Search engines recognize hyphens as word separators and can help improve the readability of URLs, making them more SEO-friendly. On the other hand, underscores are treated as a character. This means that “best_online_store” is read as one word, whereas “best-online-store” is read as three separate words. Therefore, using hyphens is more effective in improving the readability and SEO of your website or web page.

In addition, hyphens are more easily distinguishable by assistive technologies and screen readers, making them a better option for ensuring accessibility. However, certain screen readers and other assistive technologies may have difficulty distinguishing between underscores and spaces, which could impact the accessibility of your website.

It is also important to note that using hyphens for URLs is the standard practice in the industry. Most websites and web pages use hyphens to separate words in their URLs. As a result, using hyphens helps to make your website or web page more professional and credible.

Of course, there are some cases where using underscores might be preferable. For example, some programming languages use underscores to separate words in variables and function names, so using underscores in URLs can be more consistent with the rest of the code. However, in most cases, the benefits of using hyphens far outweigh any potential advantages of using underscores. For other technical information about the SEO of your webpage, you can check the content analysis section of the Eye10 On-Page SEO tool.

image

 

This does not mean that underscores are entirely avoided. They still obviously have some use. Hyphens are more commonly used in domain names, while underscores may be preferred in file names or parameter names in the URL. For example, “https://www.example.com/my-page.html” uses a hyphen in the domain name, while “https://www.example.com/search?q=red_shirt” uses an underscore in the parameter name.

 

General Tips for URL Structure:

  1. Don’t use hyphens or underscores in the domain name: Hyphens and underscores can confuse and make it harder for users to remember your domain name. Using a simple, memorable domain name without any special characters is best. Domain name refers to the part of the URL up to the TLD (.com, .gov, .io, etc.)
  2. Don’t combine words in the URL: As mentioned, you can use either hyphens or underscores. Regardless of your route, you should avoid joining words together, as that can make the URL hard to read and understand.
  3. Please keep it simple: Short URLs are easier to remember and share. Avoid using unnecessary words or characters in your URLs; keep them as concise as possible.
  4. Use readable words rather than ID numbers: URLs that use ID numbers can be confusing for users and search engines. Instead, use descriptive words that accurately describe the content of the page.
  5. UTF-8 Encoding: UTF-8 is a character encoding representing various characters from different languages and scripts. Using UTF-8 encoding in your URLs can help ensure that they are displayed correctly in different browsers and devices.
  6. Use a locale-specific URL for multi-regional sites: If your website targets users in different regions or countries, it’s important to use a locale-specific URL for each region. This can help improve your website’s search engine optimization and make it easier for users to find the information they need.
  7. Add keywords in URLs: Including relevant keywords in your URL can help improve your site’s visibility in search results and make it easier for users to find what they’re looking for. However, avoiding stuffing with too many keywords is important, as this can be seen as spammy or manipulative. Eye10 On-Page SEO helps you check if the keyword has been properly used in the URL and for meta tags.

image

 

Conclusion

Ultimately, the key is to stay consistent with your choice and ensure that your URLs are optimized for both search engines and human visitors. With a thoughtful approach, you can create a user-friendly and search engine-friendly website.

Of course, that also means using tools such as Eye10 On-Page SEO which helps you to manage all the technical bits of your SEO strategy, including whether to use underscores or hyphens. Sign up today to start experiencing simplified SEO analysis with Eye10 tools.

FAQ

Can I change my URLs after my website is launched?

It's technically possible to change your URLs after your website is launched, but it's generally not recommended, as it can cause broken links and other issues. If you must change your URLs, it's important to use redirects to ensure that users and search engines are directed to the correct pages.

How can I optimize my URLs for SEO?

To optimize your URLs for SEO, use hyphens to separate words, keep URLs short and descriptive, and include keywords that accurately reflect the content of the page. It's also important to avoid duplicate URLs and to ensure that your URLs are included in your sitemap and linked from other pages on your website.

What is a good URL structure?

A good URL structure is easy to read, relevant and contains descriptive keywords. A well-structured URL should also be consistent with your site's navigation and should accurately reflect the content of the page.

More Blog Posts

Keep Up To Date With Eye10

Subscribe To Our Eye10 Newsletter

Get Eye10 Updates - Learn SEO Tips - Read Our Latest Blog Posts