What is URL Encoding?

URL encoding (percent-encoding) replaces characters that are unsafe in a URL with a % followed by two hex digits. For example, a space becomes %20 and & becomes %26. This tool uses encodeURIComponent, which encodes everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ).

How to Use

  1. Paste the string you want to encode or decode into the input box.
  2. Click Encode to percent-encode it, or Decode to reverse percent-encoding.
  3. The result appears instantly. Click Copy Output to copy it.

Common Use Cases

  • Query parameters — Encode values before appending to a URL: ?q=hello+world should be ?q=hello%20world.
  • Decoding API responses — URLs returned by APIs or in redirect headers often contain percent-encoded characters.
  • curl & HTTP clients — Special characters in request bodies or headers must be encoded to avoid parse errors.
  • OAuth & webhook URLs — Callback URLs passed as query parameters must be fully encoded.

FAQs

What is the difference between encodeURI and encodeURIComponent?

encodeURI preserves characters that are valid in a full URL (: / ? # & =). encodeURIComponent encodes all of them — use it for individual query values, not full URLs.

Why is a space sometimes + and sometimes %20?

+ is the application/x-www-form-urlencoded encoding for a space (used in HTML forms). %20 is the RFC 3986 percent-encoding. Use %20 in URLs; + only in form bodies.

Can I encode an entire URL at once?

Encoding a complete URL with encodeURIComponent will also encode the :// and / path separators, breaking the URL. Only encode the individual values you are embedding as query parameters.