URL Encoder
Percent-encode any string or URL component for safe use in URLs and HTTP requests.
About the URL encoder
The DevGizmo URL Encoder converts any string into a percent-encoded format safe for use inside URLs. It uses the encodeURIComponent algorithm, which encodes every character that is not an unreserved URI character: leaving only A–Z, a–z, 0–9, and the symbols - _ . ! ~ * ' ( ) unmodified. Everything else, including spaces, slashes, question marks, and Unicode characters, is replaced with a %XX hex-encoded sequence.
Encoding runs entirely in your browser, so no data is sent to any server. Paste your text and the encoded result appears instantly.
When do you need to URL encode?
- Query string parameters: values passed after
?in a URL must be encoded so that special characters like&and=are not misinterpreted as delimiters. - Form submissions: HTML forms with
application/x-www-form-urlencodedencoding require all field values to be percent-encoded. - REST API paths: resource identifiers that contain spaces or special characters must be encoded to produce a valid URL.
- OAuth and redirect URIs: the
redirect_uriparameter in OAuth 2.0 flows must be percent-encoded when passed as a query value.
encodeURI vs encodeURIComponent
JavaScript provides two encoding functions. encodeURI is designed for complete URLs and preserves characters like / : ? & = #. encodeURIComponent encodes those characters too, making it the correct choice for encoding individual query parameter values, path segments, or any string that will be embedded inside a URL rather than used as a complete URL. This tool uses encodeURIComponent.
Guides & Tutorials
- URL encoding (percent-encoding) explained
URL encoding makes special characters safe in URLs and query strings. Learn which characters need it and and when to use encodeURI or encodeURIComponent.