URL Encoder/Decoder
Encode and decode URL strings
Input
Output
How to use the URL Encoder/Decoder
- •Paste or type a string into the input field. This can be a full URL, a query parameter value, or any text you need to encode or decode.
- •Choose the operation: click "Encode" to convert special characters to percent-encoded format, or "Decode" to convert percent-encoded strings back to readable text.
- •View the result in the output field. Encoded output uses
%XXnotation for each special character byte. Decoded output shows the original characters. - •Copy the result to your clipboard for use in URLs, API requests, or configuration files.
What is URL Encoding?
URL encoding (also called percent-encoding) is a mechanism for encoding characters in a Uniform Resource Identifier (URI) that might otherwise cause ambiguity. The URL specification (RFC 3986) defines a limited set of unreserved characters that can appear in a URL without encoding: letters (A-Z, a-z), digits (0-9), hyphen (-), underscore (_), period (.), and tilde (~).
Any other character must be percent-encoded: converted to its UTF-8 byte representation where each byte is written as % followed by two hexadecimal digits. For example:
- •Space becomes
%20(or+in form data) - •
&becomes%26 - •
=becomes%3D - •
/becomes%2F - •Non-ASCII characters like
uwith umlaut become%C3%BC(the two UTF-8 bytes for that character)
This encoding is critical because characters like &, =, ?, and # have special meaning in URLs. The & separates query parameters, = separates keys from values, ? starts the query string, and # starts the fragment. If your data contains these characters, they must be encoded to avoid being misinterpreted as URL structure.
JavaScript provides two built-in functions: encodeURIComponent() encodes a URI component (recommended for query parameter values), while encodeURI() encodes a full URI but preserves structural characters like /, ?, and #. This tool uses encodeURIComponent behavior, which is the safer choice for encoding individual values.
Common use cases
- •Building API query strings: When constructing URLs with query parameters that may contain special characters, spaces, or non-ASCII text, encoding prevents malformed requests.
- •Debugging broken URLs: When a URL is not working as expected, decoding it reveals the actual values being sent and helps identify double-encoding or missing encoding issues.
- •Form data handling: HTML forms use URL encoding (
application/x-www-form-urlencoded) to submit data. Understanding this encoding helps debug form submissions. - •Deep links and redirects: Encoding a full URL as a query parameter value (e.g.,
?redirect=https%3A%2F%2Fexample.com%2Fpath) is common in OAuth flows and link shorteners. - •Internationalization: URLs containing non-ASCII characters (e.g., Chinese, Arabic, accented Latin characters) require percent-encoding to be valid URIs.
FAQ
Q: What is the difference between encodeURI and encodeURIComponent?
A: encodeURI is for encoding a complete URI and leaves structural characters (/, ?, #, &, =) untouched. encodeURIComponent encodes everything except unreserved characters, making it correct for encoding individual parameter values. This tool uses encodeURIComponent behavior.
Q: Why do I see + instead of %20 for spaces?
A: The + for space is a convention from the application/x-www-form-urlencoded format used by HTML forms. In standard percent-encoding (RFC 3986), spaces are %20. Both are valid but used in different contexts.
Q: What is double encoding and why is it a problem?
A: Double encoding happens when an already-encoded string is encoded again, turning %20 into %2520. This causes the server to see literal %20 text instead of a space. Always decode first if you are unsure whether input is already encoded.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.
How to use the URL Encoder/Decoder
- Paste or type a string into the input field. This can be a full URL, a query parameter value, or any text you need to encode or decode.
- Choose the operation: click "Encode" to convert special characters to percent-encoded format, or "Decode" to convert percent-encoded strings back to readable text.
- View the result in the output field. Encoded output uses
%XXnotation for each special character byte. Decoded output shows the original characters. - Copy the result to your clipboard for use in URLs, API requests, or configuration files.
What is URL Encoding?
URL encoding (also called percent-encoding) is a mechanism for encoding characters in a Uniform Resource Identifier (URI) that might otherwise cause ambiguity. The URL specification (RFC 3986) defines a limited set of unreserved characters that can appear in a URL without encoding: letters (A-Z, a-z), digits (0-9), hyphen (-), underscore (_), period (.), and tilde (~).
Any other character must be percent-encoded: converted to its UTF-8 byte representation where each byte is written as % followed by two hexadecimal digits. For example:
- Space becomes
%20(or+in form data) &becomes%26=becomes%3D/becomes%2F- Non-ASCII characters like
uwith umlaut become%C3%BC(the two UTF-8 bytes for that character)
This encoding is critical because characters like &, =, ?, and # have special meaning in URLs. The & separates query parameters, = separates keys from values, ? starts the query string, and # starts the fragment. If your data contains these characters, they must be encoded to avoid being misinterpreted as URL structure.
JavaScript provides two built-in functions: encodeURIComponent() encodes a URI component (recommended for query parameter values), while encodeURI() encodes a full URI but preserves structural characters like /, ?, and #. This tool uses encodeURIComponent behavior, which is the safer choice for encoding individual values.
Common use cases
- Building API query strings: When constructing URLs with query parameters that may contain special characters, spaces, or non-ASCII text, encoding prevents malformed requests.
- Debugging broken URLs: When a URL is not working as expected, decoding it reveals the actual values being sent and helps identify double-encoding or missing encoding issues.
- Form data handling: HTML forms use URL encoding (
application/x-www-form-urlencoded) to submit data. Understanding this encoding helps debug form submissions. - Deep links and redirects: Encoding a full URL as a query parameter value (e.g.,
?redirect=https%3A%2F%2Fexample.com%2Fpath) is common in OAuth flows and link shorteners. - Internationalization: URLs containing non-ASCII characters (e.g., Chinese, Arabic, accented Latin characters) require percent-encoding to be valid URIs.
FAQ
Q: What is the difference between encodeURI and encodeURIComponent?
A: encodeURI is for encoding a complete URI and leaves structural characters (/, ?, #, &, =) untouched. encodeURIComponent encodes everything except unreserved characters, making it correct for encoding individual parameter values. This tool uses encodeURIComponent behavior.
Q: Why do I see + instead of %20 for spaces?
A: The + for space is a convention from the application/x-www-form-urlencoded format used by HTML forms. In standard percent-encoding (RFC 3986), spaces are %20. Both are valid but used in different contexts.
Q: What is double encoding and why is it a problem?
A: Double encoding happens when an already-encoded string is encoded again, turning %20 into %2520. This causes the server to see literal %20 text instead of a space. Always decode first if you are unsure whether input is already encoded.
Is my data safe?
Yes. This tool runs entirely in your browser. Your data is never sent to our servers.