{"id":417,"date":"2023-02-20T15:00:12","date_gmt":"2023-02-20T15:00:12","guid":{"rendered":"https:\/\/eye10.io\/en\/blog\/pros-and-cons-should-you-use-underscores-or-hyphens-in-urls\/"},"modified":"2023-02-20T15:00:12","modified_gmt":"2023-02-20T15:00:12","slug":"pros-and-cons-should-you-use-underscores-or-hyphens-in-urls","status":"publish","type":"post","link":"https:\/\/eye10.io\/blog\/pros-and-cons-should-you-use-underscores-or-hyphens-in-urls\/","title":{"rendered":"Pros and Cons: Should You Use Underscores or Hyphens in URLs?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">In this article, we&#8217;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&#8217;re building a new website or optimizing an existing one, this topic deserves your attention.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let&#8217;s dive in and find out which one is right for you.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400;\">Underscores vs. Hyphens<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">A hyphen (&#8220;-&#8220;) 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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">An underscore (&#8220;_&#8221;) 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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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 &#8220;store.com\/buythebestproduct,&#8221; it can be challenging for the reader to understand the message.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">However, if you use hyphens to separate the words, it becomes &#8220;store.com\/buy-the-best-product,&#8221; which is much easier to read and understand. On the other hand, using underscores will give you \u201cstore.com\/buy_the_best_product.&#8221;<\/span><\/p>\n<p><span style=\"font-weight: 400;\">As you\u2019ll notice from the <\/span><a href=\"https:\/\/eye10.io\/on-page-seo\"><span style=\"font-weight: 400;\">Eye10 On-Page SEO tool<\/span><\/a><span style=\"font-weight: 400;\">, the use or non-use of underscores is a content analysis factor.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><picture><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/f8ac46798d8e01c00a0262dd876b36d25e071fd9.webp\" type=\"image\/webp\"><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/f8ac46798d8e01c00a0262dd876b36d25e071fd9.png\" type=\"image\/png\"><img loading=\"lazy\" decoding=\"async\" style=\"max-width: 100%; height: auto;\" src=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/f8ac46798d8e01c00a0262dd876b36d25e071fd9.png\" alt=\"image\" width=\"633\" height=\"280\"><\/picture><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">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?<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400;\">Should You Use Hyphens or Underscores?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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 &#8220;best_online_store&#8221; is read as one word, whereas &#8220;best-online-store&#8221; is read as three separate words. Therefore, using hyphens is more effective in improving the readability and SEO of your website or web page.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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 <\/span><a href=\"https:\/\/eye10.io\/blog\/a-review-of-eye10-on-page-seo-tool\/\"><span style=\"font-weight: 400;\">Eye10 On-Page SEO tool<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\"><picture><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/9d3aaa625dd9a8a1308660cc2058bcdf84d08de5.webp\" type=\"image\/webp\"><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/9d3aaa625dd9a8a1308660cc2058bcdf84d08de5.png\" type=\"image\/png\"><img loading=\"lazy\" decoding=\"async\" style=\"max-width: 100%; height: 434px;\" src=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/9d3aaa625dd9a8a1308660cc2058bcdf84d08de5.png\" alt=\"image\" width=\"519\" height=\"434\"><\/picture><\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">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, &#8220;https:\/\/www.example.com\/my-page.html&#8221; uses a hyphen in the domain name, while &#8220;https:\/\/www.example.com\/search?q=red_shirt&#8221; uses an underscore in the parameter name.<\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400;\">General Tips for URL Structure:<\/span><\/h2>\n<ol>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Don\u2019t use hyphens or underscores in the domain name<\/strong><span style=\"font-weight: 400;\">: 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.)<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Don\u2019t combine words in the URL<\/strong><span style=\"font-weight: 400;\">: 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.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Please keep it simple<\/strong><span style=\"font-weight: 400;\">: Short URLs are easier to remember and share. Avoid using unnecessary words or characters in your URLs; keep them as concise as possible.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Use readable words rather than ID numbers<\/strong><span style=\"font-weight: 400;\">: 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.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>UTF-8 Encoding<\/strong><span style=\"font-weight: 400;\">: 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.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Use a locale-specific URL for multi-regional sites<\/strong><span style=\"font-weight: 400;\">: If your website targets users in different regions or countries, it\u2019s important to use a locale-specific URL for each region. This can help improve your website\u2019s search engine optimization and make it easier for users to find the information they need.<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><strong>Add keywords in URLs<\/strong><span style=\"font-weight: 400;\">: Including relevant keywords in your URL can help improve your site&#8217;s visibility in search results and make it easier for users to find what they&#8217;re looking for. However, avoiding stuffing with too many keywords is important, as this can be seen as spammy or manipulative. <\/span><a href=\"https:\/\/eye10.io\/pricing\"><span style=\"font-weight: 400;\">Eye10 On-Page SEO<\/span><\/a><span style=\"font-weight: 400;\"> helps you check if the keyword has been properly used in the URL and for meta tags.<\/span><\/li>\n<\/ol>\n<p><span style=\"font-weight: 400;\"><picture><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/ecf6c1e7121ca7f6b524971596987da365947c6e.webp\" type=\"image\/webp\"><source srcset=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/ecf6c1e7121ca7f6b524971596987da365947c6e.png\" type=\"image\/png\"><img loading=\"lazy\" decoding=\"async\" style=\"max-width: 100%; height: 400px;\" src=\"https:\/\/wsnonline.dk\/storage\/uploads\/external\/3596\/ecf6c1e7121ca7f6b524971596987da365947c6e.png\" alt=\"image\" width=\"536\" height=\"400\"><\/picture><\/span><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400;\">Conclusion<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">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.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">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. <\/span><a href=\"https:\/\/eye10.io\/start-trial\"><span style=\"font-weight: 400;\">Sign up<\/span><\/a><span style=\"font-weight: 400;\"> today to start experiencing simplified SEO analysis <\/span><a href=\"https:\/\/eye10.io\/\"><span style=\"font-weight: 400;\">with Eye10 tools<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<div class=\"schema-faq-wrapper\">\n<h2 style=\"text-align: center; margin-bottom: 20px;\"><span style=\"border: 1px solid black; padding: 10px 50px;\">FAQ<\/span><br \/>\n\t\t<\/h2>\n<div itemscope itemtype=\"https:\/\/schema.org\/FAQPage\" style=\"border: 1px solid black; padding: 20px;\">\n<div itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3><span itemprop=\"name\">Can I change my URLs after my website is launched?<\/span><\/h3>\n<div itemscope itemprop=\"acceptedAnswer\" itemtype=\"https:\/\/schema.org\/Answer\">\n<div itemprop=\"text\">It&#039;s technically possible to change your URLs after your website is launched, but it&#039;s generally not recommended, as it can cause broken links and other issues. If you must change your URLs, it&#039;s important to use redirects to ensure that users and search engines are directed to the correct pages.<\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3><span itemprop=\"name\">How can I optimize my URLs for SEO?<\/span><\/h3>\n<div itemscope itemprop=\"acceptedAnswer\" itemtype=\"https:\/\/schema.org\/Answer\">\n<div itemprop=\"text\">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&#039;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.<\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<h3><span itemprop=\"name\">What is a good URL structure?<\/span><\/h3>\n<div itemscope itemprop=\"acceptedAnswer\" itemtype=\"https:\/\/schema.org\/Answer\">\n<div itemprop=\"text\">A good URL structure is easy to read, relevant and contains descriptive keywords. A well-structured URL should also be consistent with your site&#039;s navigation and should accurately reflect the content of the page.<\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ll explore the pros and cons of each option, so you can make an informed decision about which one to use [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":418,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-417","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo"],"_links":{"self":[{"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/posts\/417","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/comments?post=417"}],"version-history":[{"count":0,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/posts\/417\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/media\/418"}],"wp:attachment":[{"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/media?parent=417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/categories?post=417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eye10.io\/blog\/wp-json\/wp\/v2\/tags?post=417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}