URL Encoding Query Parameters

Updated 2026-09-09 · 3 min read

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.

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.

More guides

HTML Entities and EscapingLearn when to escape HTML, which characters need entities, how encoding helps prevent XSS, and when decoding HTML entities is safe.How to Convert JSON to CSVConvert JSON arrays and objects into CSV for spreadsheets, databases, and reports, including headers, nested values, and escaping rules.How to Validate JSON and Fix Common Syntax ErrorsLearn how to validate JSON and fix the most common errors: trailing commas, single quotes, unquoted keys, comments and unescaped characters — with examples.Base64 Is Not Encryption: What It Actually DoesBase64 is reversible encoding, not encryption. Learn what Base64 is for, when to use it, its 33% size cost, and safe alternatives for protecting data.