What is a URL?
The Uniform Resource Locator, or URL, is the designation given to a particular Internet resource, such as a webpage or website. It is a defined naming convention for addressing webpages that are accessible online. You can locate the exact location of a specific piece of unique content on the Internet by using the URL. URLs only support the ASCII character set, but non-ASCII characters like the space character are regarded as unsafe characters. Unsafe characters are often replaced with special characters called whitespaces when encoding a URL.
Why should spaces not be used in URLs?
Since URLs are how characters are conveyed to the internet, encoding URL is a delicate undertaking in web development and design. Due to their impact on the code and the outcome, some characters are deemed unsafe. These characters are known as non-ASCII characters and the space character is one of these unsafe characters. A URL containing spaces is rendered invalid and when the URL is processed by a word-processing software, the presence of spaces may cause insignificant gaps to appear and unimportant spaces to emerge, rendering the URL unreadable to the computer and human users.
Hyphens and Underscore in URL
White spaces (such as '%20' or '+') are query strings sometimes used by programmers to encode spaces in URLs. This practice is not advised though, because it may lead to broken links, cluttered links, or loss of link equity when users click on the link or share the URL. The URL’s SEO rating may also be affected by the use of whitespaces since it has a negative effect on users’ experience in terms of readability. The URL structure of a website should be as simple and readable by both web crawlers and end users so it is recommended that websites wishing to maintain and expand their platform forgo whitespace and use dashes or hyphens in place of spaces. Due to their user-friendliness, Google recommends using the hyphen symbol as a spacer in the URL.
The hyphen (-)
The hyphen, or dash as it is more generally known, is Google’s recommended substitution for the space character in a URL. The use of hyphens facilitates the computation of the data on your page by Google’s web crawlers, resulting in more accurate and consistent results. As a result, Google views hyphens as word separators. That is, 'voxilo-utm-manager' would be seen as 'voxilo UTM Manager' by Google web crawlers. Users and search engines can quickly distinguish concepts that are separated from one another in a URL by a dash. The inflow of traffic to your website would increase because your URL is clear to web crawlers and humans.
Underscore (_)
In URLs, the underscore symbol is also employed to replace spaces and separate words. But an underscore usually acts as a concatenation marker. It merges the separated words as one. In other words, 'voxilo_utm_manager' would be interpreted as 'voxiloutmmanager' by a machine web crawler. An underscore in a URL for a web page is user-friendly, but because it is not computer-friendly, its inclusion has little effect on boosting the site’s SEO performance.
Hyphens Vs Underscore in URL
As established, web crawlers recognize hyphens as word spacers in URLs making it simpler to read by both computers and people. File names, subdomain names, and subfolder names that are stored on your websites can contain hyphens. Use hyphens for better results when building a new site. Since it provides extra characters to domain names, using hyphens in domain names is not a good idea. Some people may find it more challenging to remember domain names with hyphens. Hyphens in domain names might also harm your brand’s reputation. It may be viewed as a spam link and this would cause your site’s SEO ranking to decrease significantly. Web crawlers do not identify underscores as word separators even though they are user-friendly. Underscores can be used when naming subfolders. Instead of using underscores in your URL, use hyphens. Hyphens are better for spacing words in URLs. If you have an existing webpage containing underscores, you do not need to change it from underscores to hyphens as it would take a long time for the changes to be recognized by Google.