URL Encoder / Decoder

Encode special characters in URLs and query strings, or decode percent-encoded URLs back to plain text. Choose between component encode or full URL encode. Runs entirely in your browser.

Input URL or Text
Waiting for input…
Encode mode: encodeURIComponent — encodes all special chars including & ? # /
Output

        

What is URL encoding (percent encoding)?

URL encoding — formally called percent encoding — replaces characters that are not safe to include in a URL with a % sign followed by two hexadecimal digits representing the character's UTF-8 byte value. For example, a space becomes %20, an ampersand becomes %26, and a hash becomes %23. This allows any text, including special characters and Unicode, to be safely transmitted as part of a URL without being misinterpreted by browsers, servers, or proxies.

This tool runs entirely in your browser using JavaScript's native encodeURIComponent() and encodeURI() functions. Nothing is sent to any server.

Component encode vs Full URL encode — which should you use?

The choice depends on what you are encoding:

  • Component encode (encodeURIComponent) — encodes everything except letters, digits, and - _ . ! ~ * ' ( ). This includes /, ?, #, &, and =, which means it encodes the characters that have structural meaning in URLs. Use this for individual query parameter values, path segments, or any value that will be embedded inside a URL.
  • Full URL encode (encodeURI) — encodes only characters that are never allowed in a URL (like spaces and most control characters), leaving the URL's structural characters (/, ?, #, &, =, :, @) intact. Use this when you want to encode an entire URL that already has proper structure.

In practice, Component encode is what you need in most situations — when building query strings, constructing API URLs from dynamic values, or encoding search terms.

Common URL encoding use cases

  • Query parameter values — if a user searches for "hello world & more", the query string must encode spaces and ampersands: ?q=hello%20world%20%26%20more.
  • Form submissions — HTML forms with method POST submit data as application/x-www-form-urlencoded, which percent-encodes all special characters in field names and values.
  • Building API URLs programmatically — when you construct a URL by concatenating dynamic values, always encode each segment with encodeURIComponent() before inserting it.
  • Decoding server logs and analytics — web server access logs and analytics tools often display percent-encoded URLs. Decoding reveals the actual search queries and parameters.
  • OAuth and redirect URIs — the redirect_uri parameter in OAuth flows must be percent-encoded when included as a query parameter in the authorization URL.

Common percent-encoded characters reference

  • Space → %20 (or + in form encoding)
  • &%26
  • =%3D
  • +%2B
  • #%23
  • /%2F
  • ?%3F
  • @%40
  • :%3A

When NOT to encode

Do not encode an entire URL as a single string with encodeURIComponent — this will encode the slashes, colons, and question marks that give the URL its structure, turning https://example.com/path?q=hi into an unusable string. Only encode the individual values that go inside the URL, not the URL itself. When you need to encode a full URL (to pass it as a parameter to another URL), use encodeURIComponent on the whole URL string — this is the correct behaviour, as the full URL is the "value" in that context.

Frequently asked questions

Both represent spaces, but in different contexts. %20 is the correct percent encoding in URL paths and is always safe. The + sign represents a space only in application/x-www-form-urlencoded bodies (HTML form submissions) and query strings in some legacy systems. When in doubt, use %20 — it is universally understood. This tool always uses %20 for spaces.

Use decodeURIComponent() to decode a percent-encoded component value, or decodeURI() to decode a full URL string. For example: decodeURIComponent("hello%20world") returns "hello world". If the input uses + for spaces (form encoding), replace them first: decodeURIComponent(str.replace(/\+/g, " "))

Yes. Unicode characters (like accented letters, CJK characters, or emoji) that are not in the ASCII range are first UTF-8 encoded, then each byte is percent-encoded. For example, the € symbol (U+20AC) is encoded as %E2%82%AC in UTF-8. This tool handles Unicode correctly.

No. All encoding and decoding happens in your browser using JavaScript's native encodeURIComponent(), encodeURI(), and decodeURIComponent() functions. Nothing is sent to MockServer or any other server.