What URL encoding is
A URL has a grammar. ? starts the query string, & separates parameters,
= splits a name from its value, / divides path segments and #
begins the fragment. Those characters are reserved: they mean something structural. The moment
a piece of your data contains one of them, the URL stops meaning what you intended.
URL encoding — properly called percent-encoding — resolves this. Each problematic
character is converted to its UTF-8 bytes, and each byte is written as a % followed by two
hexadecimal digits. A space becomes %20, & becomes %26,
= becomes %3D, and é becomes %C3%A9 because it is two
bytes in UTF-8. The receiving side reverses the process and recovers the original value exactly.
Component encoding vs full-URL encoding
This distinction causes more bugs than anything else in this area. When you encode a
component — one parameter value, one path segment — you want every reserved character
escaped, because the value must arrive as one opaque unit. A search term of
shoes & boots has to become shoes%20%26%20boots, or the
& will be read as the start of a new parameter.
When you encode a whole URL, the opposite is true: the reserved characters are doing
their job and must be left alone, or https://x/y?a=b would collapse into an unusable string.
Full-URL encoding therefore escapes only characters that are never legal, such as spaces and control
characters. Use the right button for the situation — component encoding on a full URL will mangle it, and
full-URL encoding on a parameter value will leave dangerous characters intact.
Characters you will meet most often
| Character | Encoded | Why it must be escaped in a value |
|---|---|---|
| space | %20 (or + in form data) | Not legal in a URL at all |
& | %26 | Would start a new query parameter |
= | %3D | Would split the name from the value |
? | %3F | Would begin the query string |
# | %23 | Everything after it is a fragment and never reaches the server |
/ | %2F | Would create an extra path segment |
+ | %2B | Read as a space by form decoders |
% | %25 | Would begin an escape sequence of its own |
The # row is worth dwelling on, because the failure is invisible. A fragment is processed
entirely by the client and is never transmitted, so an unencoded # in a parameter value
means the server receives a silently truncated request — no error, just missing data.
Common pitfalls
Double encoding
Encoding an already-encoded string escapes the percent signs themselves: %20 becomes
%2520, and the far end receives the literal characters %20 rather than a space.
This usually happens when two layers both try to be helpful — a client library encodes, then a gateway
encodes again. Encode exactly once, at the point the value enters the URL. If output here contains
%25 followed by hex digits, you are looking at a double-encoded string; decode it twice to
confirm.
Plus signs and form encoding
HTML forms use application/x-www-form-urlencoded, which encodes a space as +
rather than %20. Decoders built for that format convert every + back to a space
— so a value such as C++ or a phone number like +44 20 7946 0000 arrives
corrupted unless the plus was escaped as %2B. The form-specific buttons above apply that
convention; the standard ones do not. Which rule applies is decided by the
Content-Type of the request — see the HTTP headers
guide for how that header steers body parsing.
Encoding is not sanitisation
Percent-encoding preserves data faithfully — including hostile data. It is a transport concern, not a security control. After decoding, input still needs validation, SQL still needs parameterised queries, and anything rendered into a page still needs HTML escaping.
Reserved characters that are legal but unwise
Some characters are technically permitted unencoded in certain positions but cause trouble in practice:
; and , are treated as sub-delimiters by some frameworks, and : is
ambiguous in a path. Encoding them in values costs nothing and avoids surprises.
Non-ASCII and internationalised domains
Percent-encoding operates on UTF-8 bytes, so a single accented character becomes two or three escapes and
an emoji becomes four. Hostnames are the exception: they use Punycode
(xn-- prefixes) rather than percent-encoding, so you cannot percent-encode your way to a
valid internationalised domain name.
Frequently asked questions
Which button should I use?
Use Encode component for a single parameter value or path segment. Use Encode full URL when you have a complete URL that merely contains spaces or other illegal characters and you want to keep its structure intact.
Why did my plus sign turn into a space?
Because something decoded the value using form-encoding rules, where + means space. Encode
a literal plus as %2B.
What does %2520 mean?
It is a double-encoded space: %20 where the percent was itself encoded as
%25. Find the layer that is encoding twice and remove one of them.
Does URL encoding protect against injection?
No. It only ensures data survives transport. Validation and escaping still have to happen after the server decodes the value.
Is anything I paste sent to a server?
No. Encoding, decoding and URL parsing all run in this page with no network requests, so pasting a URL containing a token or session identifier is safe.
Related tools and reference
API Tester
Build a request with query parameters and let the tester handle encoding for you.
Base64 Encoder & Decoder
Percent-encode a Base64 value, or decode one you pulled out of a query string.
JSON Formatter
Format a JSON value that was passed as an encoded query parameter.
400 Bad Request
Why a malformed or badly encoded URL gets rejected before your handler runs.