What Is URL Encoding?
URL encoding, officially called percent-encoding, converts characters that aren't allowed or have a special meaning in a URL into a safe format: a % sign followed by two hexadecimal digits for each byte. A space becomes %20, & becomes %26, and non-ASCII characters are first converted to UTF-8 bytes, so é becomes %C3%A9. URLs can only contain a limited set of ASCII characters (RFC 3986), and characters like ? & = # / act as delimiters, so any data placed in a URL must be encoded to avoid breaking it or changing its meaning.
Developers need URL encoding when building query strings, API requests, redirect URLs, OAuth callbacks, tracking links and form submissions. This URL encoder and decoder does it correctly and shows exactly which parts of a URL are which.
How to Use It
- Choose Encode or Decode.
- Pick the type. Use "Component" for individual values going into a query string or path segment, "Full URL" to tidy up a complete link without breaking its structure, and "Form data" for
application/x-www-form-urlencoded. - Paste your text or URL. The result appears instantly. Tick "each line separately" to convert a list.
- Check the URL breakdown to see the protocol, host, path, fragment and every decoded query parameter.
encodeURIComponent vs encodeURI
| Function | Leaves unencoded | Use for |
|---|---|---|
| encodeURIComponent | A–Z a–z 0–9 - _ . ~ (this tool also encodes ! ' ( ) *) | Individual query values and path segments |
| encodeURI | The above plus ; , / ? : @ & = + $ # | A complete URL that is already structured |
| Form encoding | Like component, but a space becomes + | HTML form posts, some older APIs |
The most common bug is using encodeURI on a query value. A value like fish & chips keeps its &, which then splits the parameter in two. Always encode each value with the component method, then join them with & and =.
Common Percent-Encoded Characters
| Character | Encoded | Character | Encoded |
|---|---|---|---|
| space | %20 (or + in forms) | # | %23 |
| & | %26 | % | %25 |
| = | %3D | / | %2F |
| ? | %3F | + | %2B |
| @ | %40 | é | %C3%A9 |
Decoding Problems and Double Encoding
If you see %2520 in a URL, the text has been double-encoded: the % of %20 was itself encoded as %25. Decode twice to recover the original. A "malformed URI" error usually means a stray % not followed by two hex digits. This tool points to its exact position. In form data, remember that + means a space, so choose the "Form data" type when decoding it.
URL Encoding in Code
Most languages have built-in functions, so you rarely need to encode by hand. In JavaScript, use encodeURIComponent() for values, or let URLSearchParams build query strings for you. In Python, use urllib.parse.quote() and urlencode(). PHP has rawurlencode() (spaces become %20) and urlencode() (spaces become +). Java has URLEncoder.encode(value, UTF_8), which uses form encoding. When a URL misbehaves, paste it here to see which parts are encoded, spot double encoding, and check every query parameter's decoded value.
Internationalised URLs
Non-English page paths such as /café or Arabic and Chinese slugs are percent-encoded as UTF-8 bytes when sent over the network, even though browsers display them readably in the address bar. Domain names are handled differently: they use Punycode (xn--) instead of percent-encoding.
Reserved and Unreserved Characters
RFC 3986 divides URL characters into two groups. Unreserved characters (letters, digits, hyphen, full stop, underscore and tilde) never need encoding. Reserved characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) have special meaning as delimiters, so they must be percent-encoded whenever they appear inside a value rather than as part of the URL's structure. Every other character, including spaces, quotes, angle brackets and all non-ASCII text, must always be encoded. Following these rules keeps links working across browsers, servers, email clients and messaging apps, which may otherwise cut a URL short at the first unexpected character.
Safe Sharing of Links
When you share a link that contains a search query, UTM tracking parameters or a redirect target, encode each value separately. Otherwise characters like & and # can silently truncate the link or send people to the wrong page.
Frequently Asked Questions
Should spaces be %20 or +?
%20 is correct everywhere in URLs. + means a space only in form-encoded query strings.
Why are non-English characters encoded as several %XX codes?
They're encoded as UTF-8 bytes first, and each byte becomes one %XX. é is two bytes, and emoji are four.
Is URL encoding the same as encryption?
No. It's fully reversible and provides no security.
Do I need to encode a URL in HTML href attributes?
Encode the query values, and HTML-escape & as & inside HTML attributes.
Is my data sent anywhere?
No. Everything runs locally in your browser.