URL Encode

If you need to URL encode a string, our online tool is here to help. Just enter the string you want to encode and hit the "Encode" button. The encoded string will be output below. URL encoding is used when a character needs to be represented in a URL.

Some characters, such as spaces, are not allowed in URLs. URL encoding converts these characters to a percent sign (%) followed by a two-digit hexadecimal character representation. For example, a space would be encoded as %20.

URL encoding is the practice of translating unprintable characters or characters with special meaning within URLs to a representation that is unambiguous and universally accepted by web browsers and servers. These characters include −

 

, / ? : @ & = + $ #

 

URL encoding replaces these non-ASCII characters with a % followed by hexadecimal digits that represent the character's code point in the ISO-Latin character set. For example, the space character is %20.

While ASCII characters are represented as a single byte, Unicode characters may be represented by multiple bytes. To allow for this, UTF-8 defines a way to encode each of the 1,112,064 code points in the Unicode character set using between one and four bytes.

When a character can be represented using only 7-bits, it is encoded as a single byte with the high-order bit set to 0. For example, ASCII characters are encoded this way. When a character can be represented by multiple 7-bit bytes, it is encoded as a sequence of bytes with the high-order bit set to 1 for each byte except for the last byte in the sequence, which has the high-order bit set to 0.

 

URL encoding is used to ensure that all non-ASCII characters are properly represented in a URL. It is also used to replace spaces and other characters that are not allowed in a URL with %20 or +, respectively. In addition, it is often used to encode data that will be passed in the query string or form data of a URL.

 

When encoding data for use in a URL, certain characters need to be escaped so that they are not interpreted as control characters by the browser or server. The characters that need to be escaped are −

 

, / ? : @ & = + $ #

 

The process of escaping these characters is often referred to as percent-encoding. In percent-encoding, these characters are represented by a % followed by the hexadecimal representation of the character's code point. For example, the space character is represented as %20.

In addition to escaping these characters, data may also need to be encoded for use in a URL if it contains any non-ASCII characters. This is done using the UTF-8 encoding scheme, which encodes each code point in the Unicode character set as a sequence of 1 to 4 bytes.

When decoding a URL, all percent-encoded characters are decoded to their original values. In addition, any plus signs (+) are decoded to spaces. This can be problematic if the data being decoded includes spaces, since it will be difficult to distinguish between encoded and unencoded spaces. For this reason, it is generally preferable to use %20 instead of + for encoding space characters in a URL.

Cookie
We care about your data and would love to use cookies to improve your experience.