What Is URL Encoding?
URL encoding (also called percent-encoding) converts characters that aren't allowed in URLs into a safe format. Each unsafe character is replaced with a percent sign followed by two hexadecimal digits — for example, a space becomes %20 and an ampersand becomes %26.
When Do You Need URL Encoding?
You need to URL encode whenever you're:
- Passing user input as a query string parameter (e.g.,
?search=hello+world) - Constructing URLs programmatically in JavaScript or a backend language
- Sending data in a POST request with application/x-www-form-urlencoded content type
- Embedding special characters like #, &, +, =, or spaces in a URL path or query
- Debugging API calls where the URL looks garbled
Common URL Encoding Examples
- Space →
%20 - & →
%26 - = →
%3D - + →
%2B - / →
%2F - ? →
%3F - # →
%23 - @ →
%40
Frequently Asked Questions
What is URL encoding?
URL encoding converts characters that are not safe in URLs into a %XX hex format so they can be transmitted correctly.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL and preserves structural characters like /, ?, and &.encodeURIComponent (what this tool uses) encodes a URL component like a query parameter value — it encodes those structural characters too, making it suitable for embedding values in query strings.