URL Decode and Encode: Percent-Encoding Explained
By FindMySum · Last reviewed
To URL decode a link or a query string, paste it into the box above with the direction set to decode: escapes such as %20 and %C3%A9 turn back into spaces and accented letters as you type, in your browser. To go the other way, choose encode and the tool writes your text in the form that can travel safely inside a web address.
Why URLs need encoding
A URL may only contain a limited set of ASCII characters, and several of them have jobs to do: / separates path segments, ? starts the query, & separates parameters, = joins a name to its value and # starts the fragment. If a search term contains one of those characters, or a space, or a letter outside ASCII such as é or 中, it has to be written as percent escapes so the server reads it as data rather than structure. That is percent-encoding, defined in RFC 3986.
Picking a format
- URL component (RFC 3986) is the strictest and the safest default for one value: a query parameter, a path segment or a file name.
- encodeURIComponent matches what JavaScript developers get from the built-in function, which leaves
! ' ( ) *alone. Use it when you need identical output to a script. - Whole URL fixes a complete link that contains spaces or accented letters without breaking its slashes, question mark and ampersands.
- Form data is what a browser sends when an HTML form is submitted, and what many APIs expect in a request body: spaces become
+and a real plus sign becomes%2B.
A worked example
Take the search phrase café & crème. In UTF-8, é is the two bytes C3 and A9, and è is C3 and A8. Encoded as a URL component, the phrase becomes caf%C3%A9%20%26%20cr%C3%A8me: the spaces are %20, the ampersand is %26 so it can't split the query, and each accented letter is two escapes. As form data the same phrase is caf%C3%A9+%26+cr%C3%A8me, because form data writes spaces as plus signs.
Mistakes to watch for
Encoding a whole URL as a component. Running https://example.com/?q=1 through the component format escapes the colon and slashes, so the result is no longer a working link. Encode each value before you assemble the URL, or use the whole-URL format on the finished link.
Decoding plus signs in the wrong format. In a path, + is a literal plus; in a query string written by a form, it is a space. If decoded text shows plus signs where spaces should be, switch to the form-data format.
Double encoding. Frameworks often encode values for you. Encoding them again by hand produces %2520 and similar sequences that show up on the page as literal percent signs.
Mixing character sets. Old systems sometimes encode with Latin-1 or Windows-1252. Those escapes are not valid UTF-8, and this tool will tell you where the decode failed rather than guessing.
For other encodings, the Base64 decoder handles binary data in text form, and the number system converter turns hex byte values like C3 into decimal or binary.