URL encoding, also known as percent encoding, is a method used to encode information in a Uniform Resource Locator (URL) in a way that is safe to transmit over the Internet. It converts characters into a format that can be transmitted over the Internet.
The main purpose of URL encoding is to ensure that the data within a URL is properly formatted and interpreted by web servers and browsers. This is necessary because URLs can only be sent over the Internet using the ASCII character set. Characters that are not allowed in a URL or that have a special meaning within the URL (such as spaces, &, ?, and #) need to be converted to a different format.
URL encoding replaces unsafe ASCII characters with a "%" followed by two hexadecimal digits representing the character's ASCII code. For example: