URL Encoder and Decoder: percent-encode and decode text, query strings and URLs

Direction
Mode

About URL Encoder/Decoder

This tool percent-encodes text so it can sit safely inside a URL, and decodes it back. It updates as you type, and both JavaScript modes are available: encodeURIComponent for a single value, and encodeURI for a whole address.

Decoding checks the input before it converts it. If a percent sign is not followed by two hex digits, or a run of bytes is not valid UTF-8, you get the exact sequence and its position instead of a silent failure.

Swap moves the result into the input and flips the direction, so you can check a round trip. Everything runs in your browser and nothing is sent anywhere.

How to use it

  1. Choose Encode or Decode.
  2. For encoding, pick Component for a single value or Full URL for a whole address.
  3. Type or paste your text. The result appears at once.
  4. Press Copy, or Swap to run the result back the other way.

Frequently asked questions

What is the difference between encodeURIComponent and encodeURI?

Component mode (encodeURIComponent) escapes everything except letters, digits and - _ . ! ~ * ' ( ). Use it for a single value, such as a query parameter or a path segment. Full URL mode (encodeURI) also leaves : / ? # [ ] @ & = + $ , ; alone, so a whole address keeps its structure.

Why does decoding say my input is malformed?

A percent sign must be followed by two hex digits, like %20, and a run of them must form valid UTF-8, like %C3%A9. The error names the exact sequence and its position. A stray % in plain text should be written as %25.

Is a space %20 or +?

Percent-encoding writes a space as %20, and that works everywhere in a URL. The + form is only a convention for HTML form data in the query string. If you are decoding form data, turn on Treat + as a space.

Which characters get encoded?

Anything outside the safe set is converted to UTF-8 bytes and each byte is written as %XX. That is why an accented letter becomes two sequences and an emoji becomes four.

Is my text sent to a server?

No. Encoding and decoding run in your browser with built-in functions, and nothing is uploaded or stored.