← Shiyong Toolkit

Shiyong Toolkit · Updated

URL encoding: full addresses versus parameter values

Handle spaces, Unicode and reserved characters without encoding twice or turning a URL's structure into parameter content.

Choose what to encode

Colons, slashes, question marks, equals signs and ampersands can all have structural roles in a URL. Encoding a complete address and encoding a single query parameter value serve different purposes. This tool offers URI and component conversion options. Check the selected method before running it: component encoding is normally appropriate for a parameter value, while encoding a full URI should preserve its structure.

A practical example

Suppose the search phrase is tea & milk. Simply appending ?q=tea & milk can cause the ampersand to be interpreted as a parameter separator. Encode the phrase alone as a component, producing tea%20%26%20milk, then append it after q=. This preserves the ampersand as part of the search phrase. Do not encode the entire address as a component and expect it to retain normal URL structure.

When writing an application, prefer URL and URLSearchParams for constructing queries instead of assembling them by hand. This tool helps inspect, troubleshoot and understand existing strings; it does not replace parameter validation in your application.

Avoid double encoding

The percent sign can itself be encoded as %25. Encoding an existing %20 again can therefore produce %2520. A recipient that decodes only once will see the literal text %20 instead of a space. Check what each step expects: raw text or text that has already been encoded. Each layer should perform only the transformation it is responsible for.

Plus signs and spaces

In form query strings, a plus sign often represents a space. A plain decodeURIComponent call does not automatically convert every plus sign into a space. Do not immediately replace a + when you see one: it may be a literal character. Use the source format to distinguish form encoding from general percent encoding. Unnecessary substitutions change passwords, signature parameters and other exact values.

Errors and limits

Incomplete percent sequences or invalid UTF-8 bytes can cause decoding errors. Check that the full parameter was copied, especially when text wraps or the browser shortens its display. URL encoding is not HTML escaping, SQL escaping or a security check. Decoded text may still be untrusted. Check the domain before opening an unfamiliar link, and review URLs for tokens, email addresses or private searches before sharing them.

Try the tool

Open tool → · All tool guides