URLs only allow ASCII, and have other rules that disallow special characters like spaces. Everything else gets percent-encoded (% + 2 hex digits) so browsers/servers worldwide understand it perfectly! 🌍

Let's take the simple example of sending the text "Hello World!" to our server. When forms send data to servers, they often append the data to URLs like this:

https://mysite.com/search?q=Hello World

Space breaks URLs, browsers/servers can't reliably parse them, which is why you'll see spaces URL encoded. We're going to see later how this is done, but to appease your curiosity, URL encoding first converts the character to one or more bytes, and then each byte is represented by 2 hexadecimal digits preceded by a percent sign (%) - (e.g. %20).

So in our over simplistic example above, we'll have something like this:


URL encoding examlpe

URL encoding is also called percent encoding since it uses percent sign (%) as an escape character.

Don't worry if this is still a bit fuzzy. We'll get into a ton of detail soon.

Onwards and upwards 💪