What is URL encoding?
URL encoding (percent-encoding) replaces special characters in a URL with percent-sign followed by their hexadecimal value. This is required for characters like spaces, ampersands, and non-ASCII characters to be safely transmitted in URLs. This tool handles both encodeURIComponent and full URL encoding in your browser.
Why URL encoding is needed
URLs may only contain a limited set of ASCII characters. When a value contains a space, an ampersand, a question mark, or a non-ASCII character, it must be percent-encoded — replaced by a % followed by its hexadecimal byte value — so the URL stays unambiguous. Without encoding, a space would break the address and an ampersand inside a value would be mistaken for a separator between query parameters.
Percent-encoding uses UTF-8: each character is converted to its bytes, and each byte becomes %XX. A space becomes %20, and an emoji or accented letter becomes several percent-encoded bytes.
Reserved and unreserved characters
Unreserved characters — letters, digits, and a few symbols like - _ . ~ — are always safe and are never encoded. Reserved characters such as / ? # [ ] @ & = + have special meaning in a URL, so they are encoded only when they appear inside a value rather than as structural separators. Encoding the right characters at the right time is what keeps a query string readable and correct.
Encoding whole query strings
When you build a query string, encode each key and value separately with component encoding, then join them with & and =. Encoding the assembled string all at once would wrongly escape the & and = that separate the parameters. For repeated parameters, add the same key more than once, such as tag=a&tag=b.
How to encode and decode a URL
- 1Choose Encode or Decode. Select Encode to make text URL-safe, or Decode to turn a percent-encoded string back into readable text.
- 2Enter your value. Paste the text or the encoded URL component you want to convert.
- 3Copy the result. The converted value appears instantly — copy it into your query string or code.
Examples
Encode a query value
Input
name=Ada Lovelace & role=engineer
Output
name%3DAda%20Lovelace%20%26%20role%3Dengineer
Decode a percent-encoded string
Input
search%3Fq%3Dhello%20world
Output
search?q=hello world
Encode a non-ASCII character
UTF-8 bytes, each percent-encoded.
Input
café
Output
caf%C3%A9
Common percent-encodings
Frequently encoded reserved characters.
| Character | Encoded |
|---|---|
| space | %20 |
| ! | %21 |
| # | %23 |
| & | %26 |
| + | %2B |
| / | %2F |
| = | %3D |
| ? | %3F |
| @ | %40 |
| % | %25 |
Frequently asked questions
What is the difference between %20 and + for a space?+
%20 encodes a space anywhere in a URL. The + sign is only interpreted as a space inside a query string (application/x-www-form-urlencoded). Using %20 is the safest, most portable choice.
When should I use encodeURIComponent versus encodeURI?+
Use encodeURIComponent for a single value such as a query parameter — it encodes reserved characters like & and =. Use encodeURI for an entire URL, which leaves those structural characters intact.
Do I need to encode letters and numbers?+
No. Letters, digits, and the unreserved symbols - _ . ~ are always URL-safe and are left unchanged.
What is double-encoding?+
Encoding an already-encoded string, which turns %20 into %2520. It is a common bug; decode once to check whether a value was encoded one time or two.
Is my input sent anywhere?+
No. Encoding and decoding happen locally in your browser and nothing is transmitted.
Is it free?+
Yes — free and unlimited, with no sign-up.
Why did an & split my value into two parameters?+
An unencoded & inside a value is read as a separator between parameters. Percent-encode it as %26 so it stays part of the value.