What is URL encoding (percent-encoding)?
In a URL (a website address), some characters have a very specific technical meaning. For example, the question mark ? separates the address from its parameters, and the & separates multiple parameters from each other.
L'URL encoding (or percent-encoding) is a mechanism that hides these special characters when you need to use them as "data" in your link, without disrupting how the browser works. The tool replaces forbidden characters with a % symbol followed by their UTF-8 hexadecimal code.
A few very common encodings:
- The space ( ) becomes %20
- The slash (/) becomes %2F
- The ampersand (&) becomes %26
- The equals sign (=) becomes %3D
- The question mark (?) becomes %3F
encodeURI vs encodeURIComponent
Our tool uses the JavaScript function encodeURIComponent(). It is the safest method for developers, because it encodes almost all special characters, ensuring your data can be passed in the query strings of a GET request (API) without breaking the URL syntax.