Percent-encoding
Characters that are not allowed in a URL are replaced by % followed by two hex digits,
so a space becomes %20 and & becomes %26.
URL encode text so it can be used safely in links and query strings, or URL decode
%20-style strings back to readable text. Unicode and emoji are encoded as UTF-8.
Characters that are not allowed in a URL are replaced by % followed by two hex digits,
so a space becomes %20 and & becomes %26.
Non-ASCII characters are first converted to UTF-8 bytes, and each byte is encoded:
ø becomes %C3%B8.
Encode a single query value to escape &, = and /.
Encode a full URL to keep its structure and only fix spaces and special characters.
HTML forms send spaces as +. Everywhere else in a URL, %20 is the safe choice.
Letters, digits and - _ . ~ never need encoding. The "Query value" option encodes every
character in this table; the "Full URL" option keeps the ones that give a URL its structure.
| Character | Encoded | "Full URL" option | Meaning in a URL |
|---|---|---|---|
| space | %20 | encoded | Not allowed in URLs. Form data uses + instead. |
" | %22 | encoded | Not allowed in URLs. |
# | %23 | kept as-is | Starts the fragment – everything after it is not sent to the server. |
% | %25 | encoded | Starts an encoded byte, so a literal percent sign must be encoded. |
& | %26 | kept as-is | Separates query parameters. |
+ | %2B | kept as-is | Means a space in form-encoded query strings. |
/ | %2F | kept as-is | Separates path segments. |
: | %3A | kept as-is | Ends the scheme (https:) and separates host and port. |
= | %3D | kept as-is | Separates a parameter name from its value. |
? | %3F | kept as-is | Starts the query string. |
@ | %40 | kept as-is | Separates user info from the host. |
ø | %C3%B8 | encoded | Non-ASCII: one %XX per UTF-8 byte. |
€ | %E2%82%AC | encoded | Three UTF-8 bytes. |
😀 | %F0%9F%98%80 | encoded | Emoji take four UTF-8 bytes. |
URL encoding, also called percent-encoding, replaces characters that have a special meaning
or are not allowed in URLs with a % sign and their hexadecimal byte value.
Decoding fails when the text contains a % that is not followed by two hex digits,
or a byte sequence that is not valid UTF-8. A literal percent sign must be encoded as %25.
encodeURIComponent (the "query value" option) also encodes reserved characters like
/ ? & =. encodeURI (the "full URL" option) leaves them alone so the URL keeps working.
Switch to Decode and paste the encoded text. With "Query value" selected the result matches
JavaScript's decodeURIComponent(). Turn on "Spaces as +" to decode form data the way
PHP's urldecode() does.
It has been encoded twice. %25 is an encoded percent sign, so %2520 is an
already-encoded %20 that was encoded again. Decode it twice to get the original text,
and make sure your code encodes each value only once.
The unreserved characters: A–Z, a–z, 0–9 and - _ . ~. Everything else is either
reserved for URL syntax (like / ? # &) or not allowed, and must be encoded when it
appears inside a value.