How to use the URL encoder and decoder
- Pick Encode or Decode.
- Pick a mode. Component is right most of the time: it encodes one value that goes into a URL, such as a search term. Whole URL fixes spaces and accents in a URL that is already put together. Form writes spaces as +, as HTML forms do. RFC 3986 strict also encodes ! ' ( ) and *.
- Type or paste your text. The result updates as you type; Copy output copies it. The panel shows the same call in JavaScript and Python.
- To take a URL apart, paste it into Parse a URL. You get the scheme, host, port, path, each query parameter decoded, and the fragment.
A decoding error, such as a % that is not followed by two hex digits, is explained in words with its position. Everything runs in this page: your entries are not saved or sent.
What percent encoding is
RFC 3986, the standard for URIs, splits characters into two groups. Unreserved characters are always safe: unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~". Reserved characters have jobs in a URL: the general delimiters : / ? # [ ] @ and the sub-delimiters ! $ & ' ( ) * + , ; =. When a reserved character is meant as plain data, or a character is not allowed at all (a space, an accent, an emoji), it is percent-encoded.
A percent-encoded byte is a % followed by two hex digits. Text is first turned into UTF-8 bytes, so é (bytes C3 A9) becomes %C3%A9 and 😀 (F0 9F 98 80) becomes %F0%9F%98%80. RFC 3986 says producers "should use uppercase hexadecimal digits for all percent-encodings", which this tool does. The % sign itself "must be percent-encoded as "%25"" when it is data.
URL encoding table: space, forward slash, ampersand and more
| Character | UTF-8 bytes | Component | Whole URL | Form | RFC 3986 strict |
|---|---|---|---|---|---|
| space | 20 | %20 | %20 | + | %20 |
| & ampersand | 26 | %26 | & (kept) | %26 | %26 |
| = equals | 3D | %3D | = (kept) | %3D | %3D |
| ? question mark | 3F | %3F | ? (kept) | %3F | %3F |
| / forward slash | 2F | %2F | / (kept) | %2F | %2F |
| # hash | 23 | %23 | # (kept) | %23 | %23 |
| + plus | 2B | %2B | + (kept) | %2B | %2B |
| % percent | 25 | %25 | %25 | %25 | %25 |
| ! exclamation | 21 | ! (kept) | ! (kept) | %21 | %21 |
| ~ tilde | 7E | ~ (kept) | ~ (kept) | %7E | ~ (kept) |
| é | C3 A9 | %C3%A9 | %C3%A9 | %C3%A9 | %C3%A9 |
| 😀 | F0 9F 98 80 | %F0%9F%98%80 | %F0%9F%98%80 | %F0%9F%98%80 | %F0%9F%98%80 |
URL encode forward slash: in a query value or a single path segment, write / as %2F (Component mode). Whole URL mode keeps it, because there it separates the path. URL encode ampersand: & separates query parameters, so an ampersand inside a value must be %26: the search term Tom & Jerry is q=Tom%20%26%20Jerry, or q=Tom+%26+Jerry as form data.
URL encode space: %20 or +?
Both appear, and which one is right depends on where the text goes. In a path, and in RFC 3986 percent-encoding generally, a space is %20. The + for a space comes from HTML forms. The WHATWG URL Standard, which browsers follow, defines the application/x-www-form-urlencoded format (it calls it "in many ways an aberrant monstrosity", a result of history), and when serializing it says: "If spaceAsPlus is true and byte is 0x20 (SP), then append U+002B (+)". Its parser does the reverse: "Replace any 0x2B (+) in name and value with 0x20 (SP)."
So in a query string built by a form or by URLSearchParams, a + means a space, and a real plus sign must be %2B. In a path, + is just a plus. That is why this decoder turns + into a space only in Form mode. When in doubt, %20 is read as a space everywhere.
URL encode in JavaScript: encodeURIComponent vs encodeURI
MDN says encodeURIComponent() escapes all characters except A-Z a-z 0-9 - _ . ! ~ * ' ( ). encodeURI() also leaves ; / ? : @ & = + $ , #, the characters that "may be part of the URI syntax". MDN's advice: encodeURI "is used to encode a URL as a whole, assuming it is already well-formed", and to build a URL from values, use encodeURIComponent on each value.
| Input | encodeURIComponent | encodeURI |
|---|---|---|
| café & cake | caf%C3%A9%20%26%20cake | caf%C3%A9%20&%20cake |
| price: 5+3=8 | price%3A%205%2B3%3D8 | price:%205+3=8 |
| https://example.com/a b?q=café | https%3A%2F%2Fexample.com%2Fa%20b%3Fq%3Dcaf%C3%A9 | https://example.com/a%20b?q=caf%C3%A9 |
Using encodeURI on a value is a common bug: the & in café & cake would split the parameter in two. For RFC 3986 strictness, MDN shows encodeURIComponent followed by replacing !'()*, because "The more recent RFC3986 reserves !, ', (, ), and *"; that is this tool's RFC 3986 strict mode. Both functions throw URIError on a lone surrogate (half of an emoji); this page names its position instead.
URL encode in Python: quote and quote_plus
Python's urllib.parse.quote never encodes "Letters, digits, and the characters '_.-~'", and by default it is "intended for quoting the path section of a URL", so its safe parameter defaults to '/'. quote_plus is "Like quote(), but also replace spaces with plus signs, as required for quoting HTML form values".
| Python | Result for '/El Niño/' | Same as this tool's mode |
|---|---|---|
quote(s) | /El%20Ni%C3%B1o/ | Whole URL, for this text |
quote(s, safe='') | %2FEl%20Ni%C3%B1o%2F | RFC 3986 strict |
quote_plus(s) | %2FEl+Ni%C3%B1o%2F | Form |
The first and last results are the examples in the Python documentation. To decode, use unquote, or unquote_plus for form data.
URL decode: errors and double encoding
Decoding turns each %XX back into a byte, then reads the bytes as UTF-8. Two things can go wrong, and the decoder tells you where:
- A % that is not followed by two hex digits, such as
50%off. The literal percent sign should have been written%25. - Bytes that are not UTF-8, such as
%E9t%E9. That is é in the old Latin-1 or Windows-1252 encoding; in UTF-8, é is%C3%A9.
If decoding once still leaves %20 or %2F in the text, it was encoded twice (the % became %25). Decode again. The encoder warns you when the text you are about to encode already contains escapes.
Parse a URL into its parts
RFC 3986 names the parts with this example: foo://example.com:8042/over/there?name=ferret#nose has the scheme foo, the authority example.com:8042, the path /over/there, the query name=ferret and the fragment nose. The parser on this page uses the browser's own URL API, so it splits a URL exactly as browsers do. Query parameters are decoded the form way (+ is a space), and an international domain name is shown in its xn-- form, which is what is sent over the network. If your parameters hold JSON, paste the value into the JSON formatter; if one looks like eyJ..., it is probably a token for the JWT decoder. URL encoding is not Base64: to carry binary data as text, use the Base64 encoder.
Questions and answers
What is the difference between URL encoding and percent encoding?
None: they are two names for the same thing. Each unsafe byte is written as % and two hex digits, as RFC 3986 describes.
Should a space be %20 or + in a URL?
Use %20 in a path. In a query string sent by a form or built with URLSearchParams, + also means a space. %20 is safe in both places.
How do I URL encode an ampersand?
Write it as %26. An unencoded & starts a new query parameter, so a value such as Tom & Jerry must be sent as Tom%20%26%20Jerry.
Should I URL encode a forward slash?
Encode it as %2F when it is part of a value, such as a file name in a query string. Leave it as / when it separates parts of the path.
Why does decoding say my URL is malformed?
Usually a % that is not followed by two hex digits, such as 100% or 50%off, or escapes that are not UTF-8, such as %E9 for é. The error shows the position; write a literal percent sign as %25.
Is URL encoding a way to hide or secure data?
No. Anyone can decode it. It only makes text safe to put in a URL. Do not put passwords or secret keys in URLs, since they can end up in logs and browser history.
Sources
Checked on 13 October 2026. If a rule has changed, please tell us.