π URL Encoder / Decoder
Percent-encode or decode URLs and query parameters instantly.
How to Use This Tool
Choose Encode or Decode mode and select the encoding type that matches your context. Component encoding is the right choice for query parameter values. Full URI encoding preserves the structure characters like slashes and question marks.
Select Encode mode to percent-encode a string, or Decode to convert %XX sequences back to readable text.
Choose Component for query parameter values, or Full URI if encoding a complete URL.
Paste your input. The result appears in the output box instantly.
Use Swap to move the output back to the input for decoding a just-encoded string.
encodeURIComponent vs encodeURI: Which One to Use
The choice between these two functions determines which characters get encoded and which are left alone. encodeURI() encodes a full URL but leaves the structural characters intact: it will not encode /, ?, #, :, @, and the other characters that give a URL its meaning. Use it when you have a complete URL that is already properly structured and you just need to handle non-ASCII characters. encodeURIComponent() encodes everything including those structural characters, because it is designed for encoding individual values that go inside a URL, not the URL itself. A practical example: if a user searches for "cafΓ© & pastries", the query string value must be encoded as caf%C3%A9%20%26%20pastries before it goes into the URL. If you used encodeURI(), the & would survive unencoded and break the parameter boundary. Always use encodeURIComponent() for any user-supplied value that you embed in a URL. Non-ASCII characters like Chinese (δΈ becomes %E4%B8%AD) or Arabic script are also encoded correctly since the function works on UTF-8 bytes.
Common Use Cases
Frequently Asked Questions
What is URL encoding?
URL encoding (percent-encoding) converts special characters into %XX format where XX is the hex ASCII value. Required because URLs can only contain certain safe characters.
What characters are safe in URLs?
Letters (A-Z, a-z), digits (0-9), and - _ . ~ are unreserved and safe. All other characters should be percent-encoded.
What is the difference between encodeURI and encodeURIComponent?
encodeURI() encodes a complete URL, leaving reserved chars (/, ?, #, :) intact. encodeURIComponent() encodes everything including reserved chars β use it for query parameter values.
Why is space encoded as + or %20?
In HTML form data (application/x-www-form-urlencoded), spaces become +. In standard percent-encoding (RFC 3986), space is %20.
When should I encode URLs?
Always encode query string values. Encode path segments that contain non-ASCII characters or reserved characters like & # = ?.