Percent-encode text for a URL. By default the tool encodes a
single component, so / becomes %2F. Tick
Encode Full URL to keep /, : and
? as they are. Picking the wrong mode is a common way
to break a redirect.
https://example.com/search?q=hello world&lang=en https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den Leaves the structural characters alone, so :, /, ?, & and = keep working, and encodes spaces and non-ASCII characters. Use it when you are fixing up a complete address.
Use this for any value going into a query parameter. It escapes every reserved character, including / and &. Without that, an ampersand in the value splits it into two parameters.
const value = "hello world & more/100%";
// Encode a single query value (matches the tool's default)
console.log(encodeURIComponent(value));
// hello%20world%20%26%20more%2F100%25
// Encode a whole URL but keep :, /, ? and & intact
console.log(encodeURI("https://example.com/search?q=hello world&lang=en"));
// https://example.com/search?q=hello%20world&lang=en
// Build a query string safely (spaces become +)
const params = new URLSearchParams({ q: value, lang: "en" });
console.log(params.toString()); encodeURIComponent leaves A-Z a-z 0-9 - _ . ! ~ * ' ( ) unencoded, which is slightly looser than RFC 3986 because ! * ' ( ) are reserved there.
<?php
$value = "hello world & more/100%";
// RFC 3986 encoding: space becomes %20 (same as encodeURIComponent)
echo rawurlencode($value), PHP_EOL;
// Form encoding: space becomes + (application/x-www-form-urlencoded)
echo urlencode($value), PHP_EOL;
// Build a full query string from an array
echo http_build_query(["q" => $value, "lang" => "en"], "", "&", PHP_QUERY_RFC3986), PHP_EOL; Use rawurlencode() for path segments and REST-style APIs, and urlencode() only for form bodies.
from urllib.parse import quote, quote_plus, urlencode
value = "hello world & more/100%"
# safe="" so the slash is encoded too, like encodeURIComponent
print(quote(value, safe=""))
# Form style: space becomes +
print(quote_plus(value))
# Build a query string from a dict
print(urlencode({"q": value, "lang": "en"})) quote() keeps / unencoded by default because it is meant for paths. Pass safe="" for query values.
RFC 3986 splits characters into two groups. Unreserved ones (letters, digits, - . _ ~) never need encoding. Reserved ones (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) mean something in certain positions, so they must be percent-encoded whenever they are data instead of structure. Everything else, spaces included, becomes UTF-8 bytes and then %XX.
Use encodeURIComponent() unless you are fixing a complete URL. The two functions differ only in which reserved characters they leave alone. encodeURI() assumes it has a whole URL and keeps the delimiters. encodeURIComponent() assumes it has one value and encodes everything reserved.
This tool follows the specifications below. Read them when you need the exact normative wording, for example to settle an edge case between two implementations.
It replaces characters that are not allowed in a URL, or that would be read as structure, with a percent sign and two hex digits. For example, a space becomes %20 and an ampersand becomes %26, so the server reads them as data.
Encode each parameter value on its own. Encoding a full URL with encodeURIComponent also encodes the slashes and question mark that give it structure. If you only need to fix spaces or non-ASCII characters in a complete address, tick Encode Full URL (preserve ://).
Form submissions (application/x-www-form-urlencoded) use + for spaces. Everywhere else in a URL, use %20. This tool writes %20.
Yes. Characters outside ASCII are encoded as their UTF-8 bytes, each written as a percent sequence. For example, é becomes %C3%A9.
encodeURIComponent() for values and encodeURI() for a full URL. The tool calls encodeURIComponent() by default and encodeURI() when Encode Full URL (preserve ://) is ticked.
The URL decoder reverses it. The URL parser shows which part of an address a value belongs to, and the query string parser lists every parameter at once.