URL encoder
Encode and decode URLs and URL components
URL Encoder / Decoder
Encode or decode URL components
TL;DR
What is URL encoder?
URL encoding (percent-encoding) replaces characters that are not allowed or have special meaning in a URL with a % followed by their two-digit hexadecimal byte value. For example, a space becomes %20 and & becomes %26. This is defined in RFC 3986.
Common use cases
- ‣Query string parameters: encode values that contain special characters (spaces, &, =, #) before appending them to a URL
- ‣API testing: encode a parameter value to paste safely into a URL in a browser or curl command
- ‣OAuth and redirect URIs: encode the redirect_uri parameter, which itself contains a URL with special characters
- ‣Debugging: decode a percent-encoded URL to read what parameters are actually being sent
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent in JavaScript?
encodeURI encodes a full URL and leaves characters that are valid in a URL intact (/, :, ?, &, #). encodeURIComponent encodes a single component (like a query parameter value) and escapes those same structural characters. Use encodeURIComponent when encoding individual parameter values.
Why is + sometimes used instead of %20 for spaces?
+ as a space replacement is part of the application/x-www-form-urlencoded format (HTML form submissions), not RFC 3986 URL encoding. In query strings sent by forms, + means space. In path segments and other URL parts, %20 is the correct encoding for a space.
See also
- ‣URL parser: parse a URL into its components first to identify which parts need to be individually encoded
- ‣HTML entities encoder: HTML entity encoding is the complementary operation for embedding special characters inside HTML attributes and body text
- ‣Base64 string encoder: standard Base64 output contains + and / which must be percent-encoded when used inside a URL query parameter