Type or paste text below to percent-encode it for use in a URL. By default the tool encodes a single value, the way you would for a query parameter. Tick "Whole URL" to encode a complete address while keeping its :, /, ?, & and # intact.
Value or whole URL?
The two modes match JavaScript's two built-in functions. Pick by what you are encoding, not by how much of the output looks encoded.
| Mode | Function | Leaves unencoded | Use for |
|---|---|---|---|
| Value (default) | encodeURIComponent | A–Z a–z 0–9 - _ . ! ~ * ' ( ) | One query value, path segment or redirect URL inside a parameter |
| Whole URL | encodeURI | The above plus ; , / ? : @ & = + $ # | A complete URL that contains spaces or non-ASCII characters |
A URL passed as a parameter value, such as a redirect_uri, needs the value mode: its own ? and & must be encoded, or they become part of the outer URL.
Non-ASCII characters
Characters outside ASCII are converted to UTF-8 bytes and each byte is encoded, as RFC 3986 recommends for new URI schemes. So café becomes caf%C3%A9, and an emoji becomes four escapes. See Unicode in URLs for internationalised domain names, which use Punycode instead.
%20 or + for spaces?
The tool writes a space as %20, which is valid everywhere in a URL. HTML forms write it as + in query strings (application/x-www-form-urlencoded); servers that read form data accept both, but in a path + stays a literal plus sign.