Using URL encoding, a certain character in a URL is encoded by replacing it with a number of character triplets consisting of the percent character “%” followed by two hexadecimal digits. The numeric value of the replaced character is represented by the two hexadecimal digits of the triplet(s). As URLs (Uniform Resource Locators) are not the only URIs (Uniform Resource Identifiers) that can be encoded, the term URL encoding is somewhat inexact. This encoding procedure can also be applied to other URIs (Uniform Resource Identifiers), such as URNs (Uniform Resource Names). It is, therefore, preferable to refer to encoding as percent-encoding.
Creating a Valid URL Structure
You could believe that a “valid” URL is obvious. However, that is not the case. A URL entered in a browser’s address bar, for instance, could have special characters (like ” 上海+中國”), which the browser must internally transform into a different encoding before transmission. Likewise, any code that creates or takes UTF-8 input may regard URLs containing UTF-8 characters as “valid,” but it must translate those characters before sending them to a web server.
When and Why Would You Use URL Encoding?
Form fields and values are encoded when submitted into HTML forms through HTTP request messages using methods GET or POST, or, historically, via email.
Encoding by default uses an early version of the general URI percent-encoding rules modified by replacing spaces with “+” rather than “%20”. In the HTML and XForms specifications, application/x-www-form-urlencoded is defined (in an outdated manner) as a MIME type of data encoded in this way. Moreover, the CGI specification specifies how web servers decode this type of data and make it available to applications. A request URL that is sent via HTTP GET includes application/x-www-form-urlencoded data in its query component. When sent in an HTTP POST request or via email, the data is placed in the body of the message, and the name of the media type is included in the message’s Content-Type header.
Which Characters Are Allowed in a URL?
In a URI, characters may be either reserved or unreserved (or a percent character if they are part of a percent-encoding). A reserved character is a character that sometimes has a special meaning, while an unreserved character has no meaning. As a result of percent-encoding, characters that would otherwise not be allowed are represented as permitted characters. With each revision of specifications governing URIs and URI schemes, the sets of reserved and unreserved characters have changed slightly, as have the circumstances under which certain reserved characters have special meaning.
A URL can only contain characters from a defined set of unreserved and reserved ASCII characters. Unreserved characters can be encoded but are not recommended. There are the following unreserved characters:
The following are the letters A B C D E F G H I J K L M N O P Q R S T U V W X Y Z and the following number series: 0 1 2 3 4 5 6 7 8 9 – _.
It is only necessary to encode reserved characters under certain circumstances. There are the following reserved characters:
! * ‘ ( ) ; : @ & = + $ , / ? % # [ ]
What is URL Decoding, and How Does it Work?
It is a reverse operation of URL encoding to decode a URL. It simply means converting an encoded URL string into its standard or readable form. In order to convert a set of a percent (%) and hexadecimal values into standard or regular representations, it simply replaced them with a set of percent (%) and hexadecimal values.
Here is how to decode the URL. Perform the following steps.
- Open Free and Online Decode Tool.
- If you want the encoded URL, use “Load from URL” or “Browse”.
- You can decode the encoded URL by clicking on the “URL Decode” button.
- For encoding the decoded URL, click the “URL Encode” button.
- In the upper section, you will see the results.
- Copy and paste the output into the desired location.
You can try a URL Decoding tool such as https://url-decode.com/ in order to decode any URL.
Characters are changed by URL encoding so they can be sent over the Internet. Only the ASCII character set can be used to send URLs over the Internet. The URL must be transformed into a suitable ASCII format since URLs frequently contain characters that are not part of the ASCII character set. URL Decode is a simple utility for converting URL parameters to plain and readable text. Copied, pasted, and decoded. Our tool is completely free to use.