URL Encoding Query Parameters
Why URL encoding exists
URLs use characters such as ?, &, =, #, and / as structure. When those same characters appear inside a value, they must be percent-encoded so the browser does not mistake them for separators.
Common examples
A space may become %20, an ampersand becomes %26, and non-ASCII text is encoded as UTF-8 bytes. This is why a campaign URL, search link, or redirect URL can break when copied by hand.
- Search term
hello worldbecomeshello%20world - Brand name
A&BbecomesA%26B - Hash symbol
#sectioninside a value becomes%23section
encodeURI vs encodeURIComponent
Use encodeURI when you already have a full URL and want to preserve its structure. Use encodeURIComponent for individual query parameter values. Most broken tracking links come from using the full-URL function on a single parameter value.
Debugging broken links
If a URL stops early, look for an unencoded ampersand or hash symbol inside a parameter. If a redirect loses part of the destination, encode the full destination URL before placing it inside the redirect parameter.
Use the encoder
Open the URL Encoder and Decoder, paste the URL or parameter value, then encode or decode it instantly. It supports full UTF-8 text including Arabic, accents, and emojis.
Try the URL Encoder / Decoder →Encode special characters in URLs (spaces, &, ?, =) to %xx escape sequences, or decode percent-encoded URLs back to readable text. Free, instant.Frequently asked questions
Should spaces be encoded as plus or %20?
In URLs, %20 is the clearest general encoding. Plus signs are common in form-encoded query strings, but they are not identical in every context.
Do I encode the whole URL or just the parameter?
Encode the whole URL only when it is being used as a value inside another URL. Otherwise encode each parameter value separately.
Can URL encoding protect secret tokens?
No. It only makes characters safe for transport in a URL. It does not encrypt or hide the value.