Developer

URL encoder

Encode or decode a string for use in a query parameter.

Loading tool…

  1. 1 Paste the text or the encoded value.
  2. 2 Encode or decode.
  3. 3 Copy the result into your URL or your code.

How it works

Query parameters need encoding so spaces, ampersands, and non-ASCII letters do not break the URL. This page uses encodeURIComponent and decodeURIComponent, which is the right pair for a single parameter value rather than a whole URL. Decoding a broken escape sequence shows an error.

Frequently asked questions

Why are slashes encoded?

encodeURIComponent encodes almost everything except letters, numbers, and a few marks, including slashes. Use it on a parameter value, not on a full URL.

How are spaces written?

As %20, not as a plus. Plus signs are left for application/x-www-form-urlencoded parsers.