Answer

How to URL-encode a string

Percent-encode text for safe use in URLs and query strings, instantly in your browser.

URL encoding (percent-encoding) replaces characters that are unsafe in a URL with a "%" followed by their hex byte value. For example, a space becomes %20, "&" becomes %26, and "=" becomes %3D, so the value can be placed safely in a query string.

Input
name=John Doe&city=São Paulo
Output
name%3DJohn%20Doe%26city%3DS%C3%A3o%20Paulo

Non-ASCII characters are encoded as their UTF-8 bytes (São → S%C3%A3o).

Open the URL Encoder Advanced → Free · runs in your browser · nothing uploaded

Steps

  1. Open the URL Encode tool and select the Encode direction.
  2. Paste the text you want to make URL-safe.
  3. Copy the percent-encoded output for use in a URL or query parameter.
  4. Use the Decode direction to turn percent-encoded text back into plain text.

Frequently asked questions

What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent encodes a single value (it escapes &, =, ?, /, etc.), so use it for query-string parts. encodeURI is for a whole URL and leaves those structural characters intact.