Developer guide
How to encode text for a URL
URL encoding converts UTF-8 text into a representation that can travel safely in a particular URL context, with different rules for components, whole URLs, and form data.
Open the URL EncoderWhy URL context matters
Characters such as &, =, /, ?, and # can act as URL syntax. They should be escaped inside a single value but preserved when they are deliberate delimiters in a complete URL.
coffee & tea → coffee%20%26%20tea
How to encode URL text
- Decide whether the input is a component, a complete URL, or a form value.
- Paste the original unencoded text.
- Choose the matching mode.
- Select Encode URL text.
- Place the result only in the context for which it was encoded.
The ToolPixels encoder never opens the submitted value as a URL.
Component, whole URL, or form value?
| Mode | Typical input | Space |
|---|---|---|
| URL component | One query value or path segment | %20 |
| Whole URL | A complete URL with delimiters | %20 |
| Form value | One form field value | + |
Component mode escapes separators such as &, =, /, and ?. Whole-URL mode preserves them, so it is unsafe for encoding one query value.
Building a query safely
Encode names and values separately, then join the already encoded pairs with = and &. Do not concatenate raw user text into a complete URL and encode the entire result afterward.
q=coffee%20%26%20tea&page=2
Avoid double encoding
- Encoding
%20again produces%2520. - Keep raw data internally and encode at the output boundary.
- Do not use URL encoding as HTML, JavaScript, or SQL escaping.
- Use a URL-building API when assembling several components in application code.
- Test non-ASCII values with the receiving system's UTF-8 expectations.
Open the ToolPixels tool
Percent-encode URL components, complete URLs, or form values locally with explicit mode selection.