URL Encoder
Percent-encode text for a URL path, query value or component.
Paste text on the left.
How it works
Percent-encoding replaces a character with % and its byte value in hex, so that characters which
would otherwise be read as structure can appear inside a URL as data. Which characters those are depends entirely
on where in the URL the value is going, which is why this tool asks rather than picking one.
Component or whole URI
Component escapes the delimiters — &, =, ?,
/, # — so the result is safe as a single query value or path segment. Use it for
anything you are putting into a URL.
Whole URI leaves those delimiters intact and escapes only what is never legal, such as spaces.
Use it when the input is already a complete URL whose structure you intend to keep. Encoding a whole URL in
component mode turns its structure into literal text; encoding a value in whole-URI mode leaves an
& free to split the query in two. Both mistakes are common and both are silent.
Form data: + or %20
Form data is application/x-www-form-urlencoded, the format an HTML form submits and
URLSearchParams produces. It writes a space as + rather than %20, and
escapes ~, which RFC 3986 leaves alone. Use it for a query string a server will parse as form fields;
use component mode anywhere else, because outside form data a + is a literal plus sign.
Non-ASCII
Encoded as UTF-8 octets, one %XX per byte — which is why é becomes
%C3%A9 rather than a single escape. RFC 3986 requires this and servers expect it.
Example
a&b=c in component mode becomes a%26b%3Dc, which survives as one query value. In
whole-URI mode it comes back unchanged — correct for a URL, wrong for a value. Reverse either with the
URL Decoder.
Frequently asked questions
What is the difference between the modes?
Component mode escapes the delimiters — & = ? / # — so the result is safe as a single query value or path segment. Whole-URI mode leaves them intact, which is what you want when encoding a complete URL whose structure you intend to keep. Choosing the wrong one is the most common percent-encoding mistake.
Should a space be %20 or +?
It depends where it is going. In form data (application/x-www-form-urlencoded, what an HTML form submits and URLSearchParams produces) a space is +, and the Form data mode writes exactly that format. Everywhere else a + is a literal plus sign and a space must be %20, which is what component mode produces.
Why does it escape characters encodeURIComponent leaves alone?
JavaScript's own encodeURIComponent leaves ! ' ( ) and * unescaped. They are legal in a query value but not universally safe in one, so this tool escapes them as well — the output is then correct everywhere rather than correct in most places.
How are non-ASCII characters encoded?
As UTF-8 octets, one %XX per byte, which is why é becomes %C3%A9 rather than a single escape. That is what RFC 3986 requires and what servers expect.
Related tools
URL Decoder
Decode percent-encoded text, including repeatedly-encoded strings.
LocalURL Parser
Split a URL into scheme, host, path, query and fragment.
LocalBase64 Encoder
Encode text or bytes to Base64 or Base64URL.
LocalHTML Entity Encoder & Decoder
Convert between raw characters and HTML entity references.
LocalHex ↔ ASCII Converter
Convert between hex byte sequences and readable text.
LocalBinary, Decimal & Hex Converter
Convert a number between binary, octal, decimal and hexadecimal.
Local