URL Encode / Decode

Percent-encode or decode URLs and query strings.

Runs in your browser — nothing is uploaded

 

Why URLs need encoding

URLs may only contain a limited set of ASCII characters, and some of those, such as ? & = # / and %, have special meaning. Percent-encoding replaces any other character with % followed by its byte value in hex, so a space becomes %20 and é becomes %C3%A9 (its two UTF-8 bytes).

Without encoding, a value containing & or = would break a query string apart, and a value containing # would cut the URL short at what the browser treats as a fragment.

Component encoding

This tool uses component encoding, the same as JavaScript's encodeURIComponent. It escapes everything except letters, digits and - _ . ! ~ * ' ( ), which makes it the right choice for a single query-string value, a path segment or a form field. Do not run it over a whole URL, because it will also encode the :// and / separators.

Decoding reverses it, turning every %XX sequence back into the original characters. A lone % that is not followed by two hex digits is invalid and is reported as an error rather than guessed at.

Spaces: %20 or +?

HTML form submissions (application/x-www-form-urlencoded) encode spaces as +, while URL paths and encodeURIComponent use %20. Both are common in query strings. If you are decoding a form-encoded value, replace + with a space first.

Examples

Encode a query-string value

Input

name=Ada Lovelace&city=São Paulo

Output

name%3DAda%20Lovelace%26city%3DS%C3%A3o%20Paulo
Encode a file name for one path segment

Input

reports/2026 Q3 (final).pdf

Output

reports%2F2026%20Q3%20(final).pdf
Decode an encoded URL

Input

https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Djson%20formatter

Output

https://example.com/search?q=json formatter

How to use

  1. Paste your text or URL.
  2. Choose Encode or Decode.
  3. Copy the result.

FAQ

What's the difference between encodeURI and encodeURIComponent?

encodeURI leaves URL syntax characters such as : / ? & = # intact so a whole URL stays usable. encodeURIComponent escapes them too, for embedding one value inside a URL. This tool uses component encoding.

Why do I get 'Invalid percent-encoding'?

The input contains a % that is not followed by two hexadecimal digits, or the bytes do not form valid UTF-8. A literal percent sign must itself be encoded as %25.

How do I URL-encode in code?

In JavaScript, use encodeURIComponent(value). In Python, urllib.parse.quote(value, safe="!*'()") matches it exactly; the default safe='/' would leave slashes unencoded. PHP's rawurlencode($value) is close but also encodes ! * ' ( ).

Which characters never need encoding?

The unreserved characters: A–Z, a–z, 0–9 and - _ . ~ are safe anywhere in a URL and never need encoding. encodeURIComponent also leaves ! * ' ( ) as they are, which is harmless in almost every context.

Related tools