What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a safe format. Each unsafe character is replaced by a % followed by two hexadecimal digits representing the character's ASCII code.
For example, a space becomes %20, and & becomes %26. This ensures URLs are valid and can be transmitted correctly over the internet.
Common Uses
- Encoding query string parameters that contain spaces or special characters.
- Safely embedding URLs inside other URLs (redirect parameters).
- Building API requests where parameter values contain special characters.
- Decoding encoded URLs received from logs, analytics, or API responses.
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a full URL and leaves characters like / ? # & intact. encodeURIComponent encodes everything including those characters — use it for individual query parameter values. This tool uses encodeURIComponent.
Why does a space become %20 and not +?
Both are valid but in different contexts. %20 is standard percent-encoding (RFC 3986). + is used in HTML form encoding (application/x-www-form-urlencoded). For URLs, %20 is the correct choice.
Is URL encoding the same as Base64?
No. URL encoding converts unsafe URL characters to %XX sequences. Base64 converts binary data to a text string using 64 printable characters. They solve different problems.