Have you ever wondered why web links use characters such as hyphens and underscores over spaces? There is a very valid and practical reason for this.

While humans use spaces in text to split parts of speech to make it more readable, this practice causes all sorts of issues for computers. For computers, spaces are instead used to separate parts of code. For example, on the command line, spaces separate commands and symbols from each other. If a command were two words separated by a space, the command line interpreter would not know to process that accordingly. 

In the old days of the internet, CGI scripts were used to run code on the command line to power the Web. Often, links on a website would correspond to a file path on a server that the user would access. Because of this, the same naming conventions carried over.

Despite the fact that the Web has seen significant changes since those days, the problem with spaces (as well as some other special characters) remains, and we continue to avoid these “nasty” characters to make our lives easier by using simpler, albeit less-readable URLs.