URL Encode and Decode
Percent-encode a query-string value or a whole URL, or decode one back to readable text.
To URL encode text, paste it into the Input box, set Direction to Encode a value (encodeURIComponent) and click Convert; spaces become %20 and symbols like & are escaped so the value is safe in a query string. Choose Encode a whole URL to keep slashes and question marks intact, or Decode to reverse either. Nothing leaves your browser.
How do I URL encode a string?
- Paste the text, value or URL into the Input box.
- Set Direction: Encode a value (encodeURIComponent) for a query-string parameter, Encode a whole URL (keeps / ? & =) for a complete address, or Decode.
- Click Convert, or wait a moment for the output to update on its own.
- Check the output panel: spaces should show as %20 and any special characters as % followed by two hex digits.
- Click Copy output and paste the result into your link, code or API call.
URLs can only contain a limited set of ASCII characters, so anything else, including spaces, accented letters, emoji and the reserved characters that have special meaning in a URL, has to be written as a percent sign followed by the hexadecimal value of each UTF-8 byte. A space becomes %20, an ampersand %26, a pound sign %C2%A3 and é becomes %C3%A9. This is percent-encoding, defined in RFC 3986, and browsers, servers and APIs all rely on it.
The two encoding modes exist because the right answer depends on what you are encoding. Encode a value uses encodeURIComponent and escapes everything that is not a letter, digit or one of - _ . ! ~ * ' ( ), including ? & = / and #. Use it for a single parameter value, such as a search term or a redirect URL you are putting inside another URL's query string. Encode a whole URL uses encodeURI and leaves the structural characters alone, so https://example.com/path?q=fish and chips becomes https://example.com/path?q=fish%20and%20chips with the slashes and question mark intact.
A common mix-up is + versus %20. HTML forms submitted with the default encoding turn spaces into +, which is why you see them in some search URLs, but that convention only applies to query strings submitted from forms. This tool always produces %20, which is valid everywhere. Decode reverses either encoding mode but, like the browser's own decodeURIComponent, leaves a + as a literal plus sign, so replace those with spaces first if you are decoding a form-submitted query string.
Decode also helps when reading the tracking parameters in a marketing link or the encoded redirect target in a login URL: paste the whole thing and the readable version appears. Everything runs as JavaScript in your browser tab, so the URLs you paste, which often contain session tokens and email addresses, are never transmitted or stored.
How it works: this tool uses plain JavaScript running in your browser tab. No server is involved, so Kilnfile never sees your file. Last reviewed 20 September 2026.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURIComponent escapes every reserved character including / ? & = and #, so it is for a single value going into a query string. encodeURI leaves those structural characters alone and is for encoding a complete URL that already has its path and parameters in place. Using the wrong one either breaks the URL or leaves an ampersand in a value that then splits the parameter.
Should a space be %20 or +?
%20 is correct everywhere in a URL. The + form is only a convention for form submissions (application/x-www-form-urlencoded) and only in the query string; in a path a + is a literal plus. This tool always outputs %20.
Why did my link with an ampersand in it break?
An unencoded & starts a new parameter, so redirect=https://a.com/?x=1&y=2 gives the server y=2 as a separate parameter. Encode the inner URL with Encode a value first so it becomes redirect=https%3A%2F%2Fa.com%2F%3Fx%3D1%26y%3D2.
Can I decode a URL that has been encoded twice?
Yes, run Decode twice. Double encoding shows up as %25 sequences, for example %2520 where you expected %20, because the percent sign itself was encoded on the second pass. Each Decode removes one layer.
Is what I paste sent anywhere?
No. Encoding and decoding run inside your browser tab and nothing is uploaded or stored, so it is safe to paste links containing tokens, email addresses or internal hostnames.
Cite this page: “URL Encode and Decode: Percent-Encode Any Query String”, Kilnfile, https://kilnfile.com/text/url-encode-decode/
Related tools
Guides
- How to format and validate JSONPretty-print, minify and check JSON in your browser. The RFC 8259 rules that cause most errors, how to read the line and column, and when to sort keys.
- How to count words for essays and applicationsCheck your word and character count the way markers and UCAS do. UK limits for personal statements, essays and dissertations, plus what counts as a word.