URL Encoder/Decoder
Encode or decode URLs and query strings online. Choose full-URL or component encoding and handle plus signs as spaces. Free, instant and browser-based.
Why URLs need encoding
A URL can only contain a limited set of ASCII characters, and some of those have special jobs. ? starts the query, & separates parameters and # starts a fragment. If a search term contains one of these, or a space or a non-English letter, it has to be percent-encoded. Each byte becomes % plus two hex digits, so a space becomes %20.
This tool encodes and decodes text in both directions, using UTF-8 so that every language is handled correctly. It is handy when you are building query strings, reading redirect links and tracking URLs, or debugging an API call whose parameters look wrong.
Component mode and full URL mode
Choosing the right mode prevents the most common bug. The two modes match the JavaScript functions they are named after.
- Component (
encodeURIComponent) encodes everything with a special meaning, including/,?,&and=. Use it for a single parameter value. - Full URL (
encodeURI) keeps the structure of the address intact. Use it when you have a complete URL that only needs spaces and non-ASCII characters fixed.
Input: https://example.com/search?q=tea & coffee
Component: https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dtea%20%26%20coffee
Full URL: https://example.com/search?q=tea%20&%20coffeeEncoding one parameter correctly
Look at the full URL result above. The & was left alone, so a server would split the query at that point and read q as tea only. To avoid this, encode each value separately with component mode, then join the pieces. For example q=tea%20%26%20coffee keeps the whole phrase in one parameter. Most languages have helpers such as URLSearchParams in JavaScript and urlencode in PHP, and these are safer than building strings by hand.
The plus sign and spaces
HTML forms traditionally send a space as +, while a path needs %20. This is why a decoded value can have plus signs where you expected spaces. The Treat + as a space option covers form-style data. Turn it off if your input has real plus signs that must stay, such as a phone number like +91 that was not encoded properly in the first place.
Frequently Asked Questions
What is the difference between %20 and +?
Both can mean a space in a query string, but + only has that meaning in form-encoded data. %20 is correct everywhere, so prefer it.
Why does decoding fail with an error?
The input contains a % that is not followed by two hex digits, or bytes that do not form valid UTF-8. A literal percent sign should be written as %25.
My URL has been encoded twice. How can I fix it?
If you see %2520, the % itself was encoded. Decode it once to get %20, and again to get the original character.
Which characters are never encoded?
Letters, digits and -, _, ., !, ~, *, ', ( and ) stay as they are in component mode.