ToolPane
Blog

URL Encode/Decode

Percent-encode or decode URLs and query string parameters.

Plain Text
URL Encoded

What is URL Encoding?

URL encoding (percent-encoding) replaces unsafe characters with % followed by two hex digits. Defined in RFC 3986. Required because URLs can only contain ASCII characters, and certain characters like &, =, ?, / have special meaning. For example, a space becomes %20 and & becomes %26.

Characters That Need Encoding

Space → %20 (or +), & → %26, = → %3D, ? → %3F, # → %23, / → %2F, + → %2B, @ → %40, : → %3A. Note: encodeURIComponent() encodes everything except A-Z a-z 0-9 - _ . ~ ! * ' ( )
// JavaScript
encodeURIComponent("hello world&foo=bar")
// "hello%20world%26foo%3Dbar"

decodeURIComponent("hello%20world%26foo%3Dbar")
// "hello world&foo=bar"

// Python
from urllib.parse import quote, unquote
quote("hello world&foo=bar")

encodeURI vs encodeURIComponent

encodeURI encodes a full URL but preserves :/?#[]@!$&'()*+,;= since they're valid in URLs. encodeURIComponent encodes everything except unreserved chars — use it for query parameter values. Common mistake: using encodeURI for query params leaves & and = unencoded.

Frequently Asked Questions

What's the difference between %20 and + for spaces?
Both represent spaces but in different contexts. %20 is used in URL paths (RFC 3986). + is used in query strings (application/x-www-form-urlencoded, from HTML forms). Most servers accept both, but %20 is more universal.
Do I need to encode the entire URL?
No. Only encode the parts that might contain special characters — typically query parameter values and path segments. The structure characters (:, /, ?, &, =) should remain unencoded for the URL to work.
Why are my API requests failing with special characters?
You probably need to URL-encode your query parameters. Characters like &, =, and # have special meaning in URLs. Use encodeURIComponent() on each parameter value before building the URL.

Guides

Related Tools