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 Encoder

Why 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

  1. Decide whether the input is a component, a complete URL, or a form value.
  2. Paste the original unencoded text.
  3. Choose the matching mode.
  4. Select Encode URL text.
  5. 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?

ModeTypical inputSpace
URL componentOne query value or path segment%20
Whole URLA complete URL with delimiters%20
Form valueOne 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 %20 again 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.

Encode URL text