Skip to main content
ToolsBay

URL Encoder & Decoder

Percent-encode or decode URLs and query string values.

Runs entirely in your browser — nothing is uploaded

Plain string

1 line

Percent-encoded

1 line

Frequently asked questions

What is the difference between "encode value" and "encode whole URL"?

Encode value escapes everything unsafe including / ? & = # — use it for a single query parameter value. Encode whole URL leaves the structural characters intact so the address still works — use it when you have a complete URL containing spaces or accents.

Why does decoding turn + into a space?

HTML form submissions encode spaces as + rather than %20. Since most percent-encoded strings people paste come from form data or query strings, decoding treats + as a space.

Why do I get an error on a string ending in %?

A percent sign must be followed by two hexadecimal digits. A trailing % or something like %E0%A4%A is an incomplete escape sequence, which is genuinely undecodable rather than something to guess at.

Percent-encoding, and which function to use

URLs may only contain a restricted set of characters. Everything else — spaces, accented letters, most punctuation — has to be written as a percent sign followed by the hexadecimal value of each UTF-8 byte. A space becomes %20, and é becomes %C3%A9 because it is two bytes in UTF-8.

The common mistake is escaping the wrong amount. Escaping a whole URL with the aggressive rule turns https://example.com into https%3A%2F%2Fexample.com, which is no longer a link. Escaping a single parameter value with the permissive rule leaves an & inside the value intact, which splits it into two parameters and silently corrupts the data.

The practical rule

  • Building a query string from user input? Escape each value with the aggressive rule, then join them with & and = yourself.
  • Have a finished URL containing spaces or non-ASCII? Use the whole-URL rule, which leaves the structure alone.

To take a URL apart and inspect its parameters, use the URL parser. For escaping text destined for HTML rather than a URL, use the HTML entity encoder.