Skip to main content

URL Encode / Decode

Percent-encode and decode URL parameters with encodeURIComponent.

A search term, safe for a query string

One value encoded so it can sit after <code>?q=</code> without breaking the URL.

Input
台北 101 & friends?
Output
%E5%8F%B0%E5%8C%97%20101%20%26%20friends%3F

The & became %26 and the ? became %3F. That is the whole point: had you left them raw, the server would have read them as a new parameter and the end of the path.

URL encoder / decoder

URLs may only contain certain characters — spaces, non-ASCII text, & or ? break them. URL encoding turns those into %XX form so the URL is transmitted and parsed correctly. This tool switches between encoding and decoding in one click.

How to use

  1. To encode: paste text or a parameter with special characters and click Encode.
  2. To decode: paste a %XX string and click Decode to restore it.
  3. To encode a whole URL instead of one parameter, tick the option to use encodeURI.

Common use cases

  • Build query strings with non-ASCII or special characters.
  • Read an encoded URL copied from the address bar.
  • Debug parameter encoding in API requests.

Encode the value, not the whole URL

Two everyday jobs: packing a query parameter that contains spaces, Chinese characters, & or ? into a URL — a search term or an API argument, say — and decoding a long %E4%B8%AD… string from a log back into readable text. The classic trap is scope: you should only encode the value of each parameter, not the entire URL.

  • Feed a whole address in and you'll encode the ://, ? and = as well, which breaks the link.
  • Encode something that's already encoded and you get double encoding% turns into %25, and the far end decodes to garbage.

Encode each parameter value on its own, then stitch the URL back together with & and =.

Which characters get replaced, and which do not?

The actual output of this page draws the line best. hello worldhello%20world, a+b=ca%2Bb%3Dc, 100%100%25, ?q=x&r=y%3Fq%3Dx%26r%3Dy. But ~_.- comes back untouched: those four are unreserved, and a correct encoder must leave them alone. Note that the plus sign itself becomes %2B — left as-is, any decoder that reads + as a space would silently corrupt the value.

Frequently Asked Questions

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent also encodes structural characters like / ? & =, ideal for a single parameter value; encodeURI keeps those characters, ideal for a whole URL.

Why does a space become %20?

Spaces must be encoded in URLs; the standard is %20. Some form encodings use + for a space instead; this tool uses the standard %20.

Do non-ASCII URLs need encoding?

Yes. When passed in code or placed in HTML attributes, characters usually still need percent-encoding (e.g. %E4%B8%AD) to be parsed correctly.

Is my data uploaded?

No. Encoding and decoding happen locally in your browser and nothing is sent to a server.

Related reading

URL Encoding Explained: Percent-Encoding, Spaces (%20) & How to Encode Online →

Embed this tool

Add this tool to your own website or blog for free — just copy and paste the code below (it includes a link back to this site).