HTML URL Encode
Learn how URLs are encoded so they can be safely transmitted across the Web.
When transmitting data over the internet, browsers use a system known as URL encoding. A URL can only be sent using the ASCII character set. Any characters outside this limited set must be systematically converted into a readable format.
The Anatomy of URL Encoding
Since Web URLs rarely consist solely of ASCII characters, special characters (like spaces) must be swapped out for a ”%” symbol immediately followed by two hexadecimal digits representing the character.
For example, a standard blank space is not allowed in a URL link. The browser replaces space characters with %20 or a + sign.
Common Encoded Values
Here is a list of some frequently encountered character replacements in URL structures:
- Space:
%20 - ! (Exclamation):
%21 - # (Hash):
%23 - $ (Dollar sign):
%24 - & (Ampersand):
%26
Why Can’t I use Spaces?
If a web server receives a raw space character inside a URL path, it might misinterpret it as the absolute end of the request command, leading to a broken 404 Not Found response. Always encode!