URL Encode / Decode

Uses encodeURIComponent / decodeURIComponent so query values and path segments stay safe in URLs.

About this tool

Percent-encode text so it can be placed inside a URL, or decode a percent-encoded string back to plain text. It uses the browser's encodeURIComponent and decodeURIComponent.

How to use

  1. Choose Encode or Decode.
  2. Paste into Input; Output updates live.
  3. Use Copy Output when ready.

Example

Input:     hello world & you
Encode:    hello%20world%20%26%20you

Input:     caf%C3%A9
Decode:    café

What encodeURIComponent does

It escapes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ), so a space becomes %20, & becomes %26, and non-ASCII characters are encoded as UTF-8 bytes — é becomes %C3%A9.

Because it also escapes /, : and ?, it is meant for a single query value or path segment, not for a whole URL. Encoding https://example.com/a b this way would break the scheme and the slashes.

Limits

  • This is not form encoding. application/x-www-form-urlencoded encodes spaces as + rather than %20; use a form encoder if that is what the server expects.
  • Decoding is strict: a lone % or an incomplete escape such as %E9 raises an error instead of being passed through.
  • It is not an HTML or JavaScript escaper. Encoded output is safe inside a URL, not inside markup.

FAQ

Which function is used?

encodeURIComponent and decodeURIComponent, as defined by the ECMAScript standard.

Why does Decode fail?

The input is not valid percent-encoding — for example a lone %, or a byte sequence that is not valid UTF-8.

Should I encode a whole URL?

No. Encode the individual query values or path segments, then assemble the URL around them.

Is my text uploaded?

No. Encoding and decoding run in the page.