What Is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a safe format using the percent sign (%) followed by two hexadecimal digits. For example, a space becomes %20, and an ampersand becomes %26.
URLs can only contain a limited set of ASCII characters. Special characters, spaces, unicode symbols, and reserved characters like &, =, and ? must be encoded when used as data inside a URL.
Encode URL vs. Encode Component
Encode URL uses encodeURI(), which encodes a full URL but preserves characters that have special meaning in URLs, such as :, /, ?, and #.
Encode Component uses encodeURIComponent(), which encodes every special character. Use this for individual query parameter values, form fields, or path segments — not for entire URLs.
Common Use Cases
Query parameters: When building API requests with search terms containing spaces or special characters, encode the value before appending it to the URL.
Debugging redirects: Long redirect URLs often contain encoded characters. Decoding them reveals the original destination and parameters.
Web development: Test how your application handles encoded input from forms, OAuth callbacks, and deep links.
International content: Non-ASCII characters in URLs (like café or 日本語) are encoded as UTF-8 byte sequences prefixed with %.
Frequently Asked Questions
What is the difference between %20 and + for spaces?
In URL query strings, spaces can appear as + (application/x-www-form-urlencoded) or %20 (standard percent-encoding). Our decoder handles both formats.
Is my data sent to a server?
No. All encoding and decoding happens locally in your browser.
Why did decoding fail?
Malformed percent-encoding (like an incomplete %2 without a second hex digit) will cause an error. Check that the input is valid encoded text.