URL Encoder / Decoder

Encode text for safe use in URLs or decode URL-encoded strings.

Which mode should I use?

  • encodeURIComponent, for values going inside URL query strings. Escapes everything that isn't safe (including /?&=).
  • encodeURI, for entire URLs. Preserves characters that have meaning in a URL structure.

Frequently asked questions

What is the difference between component and full-URL encoding?

Full-URL encoding (encodeURI) preserves reserved characters like /, ?, and & that have meaning in URLs. Component encoding (encodeURIComponent) escapes those too, which is what you want when embedding a value inside a query parameter.

Which characters get encoded?

Anything outside the unreserved set: letters, digits, hyphen, underscore, dot, and tilde. Everything else becomes % followed by two hex digits of its UTF-8 byte representation.

Why do I see %20 in some URLs and + in others?

Both encode a space. %20 is the standard URL form, while + is a legacy convention only valid inside application/x-www-form-urlencoded form bodies and query strings.

Is anything I paste sent to a server?

No. The encoder runs entirely in your browser, so URLs containing tokens or secrets stay on your machine.

Advertisement