handy.moe

All tools / Debug tools

A digital stamp on a phone

URL encode and decode

Percent-encode text for URLs or decode %XX sequences, and take a whole URL apart into its protocol, host, path and parameters.

Runs in your browser. Pasted data never leaves it.

How to use it

  1. Paste text, a query value, or a whole URL.
  2. Choose how to encode (component, whole URL, form or every byte), then press Encode; press Decode to reverse it.
  3. If you pasted a full URL, the parts are broken out underneath.
  4. Copy the result.

Questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent escapes everything except letters, digits and - _ . ! ~ * ' ( ), so it is right for a single value such as a query parameter. encodeURI leaves the characters that make up a URL's structure (: / ? # & =) alone, so it is for a whole address.

Why do spaces become + sometimes and %20 other times?

%20 works everywhere. + means a space only in form data (application/x-www-form-urlencoded, the query string of a form submit). Use the Form mode for that.

Why does decoding fail with “malformed URI”?

A % that isn't followed by two hex digits, or bytes that aren't valid UTF-8, are errors in strict decoding. This page decodes the valid parts and leaves the rest as it is, so you can see what is wrong.

Can it take a URL apart?

Yes: paste a full URL and the parts below (protocol, host, path, query parameters, hash) are listed and decoded.

Is what I paste or test sent anywhere?

No. This page works entirely inside your browser, and pasted data never leaves your device. It makes no network requests while you use it, and the page also tells your browser to block them (a Content-Security-Policy with connect-src 'none'), so even a bug could not send your data out. To check it yourself, open your browser's developer tools, go to the Network tab, and use the tool: nothing will appear. There is no account, no analytics and no logging.