URL Encoder / Decoder
Encode or decode URLs using percent-encoding instantly.
When a URL encoder is the right tool
Percent-encoding is how you put reserved or non-ASCII characters into a URL component: a search term, a path segment, or a value that will later sit after ?. An encoder is for that moment. You paste the text and get a string in which spaces and other reserved characters are written as %HH escapes — or you paste an encoded string and get the original text back.
This page uses encodeURIComponent and decodeURIComponent. It is not encodeURI, and it will not leave :// or ? alone. If you need to inspect the parts of a complete URL, use the URL Parser instead of encoding the whole address.
Use cases
Encoding a query value or a path segment
A search term such as hello world, or a path that contains a space or an ampersand, should be encoded before you insert it into a URL. Paste that piece here, copy the result, and leave the https:// and the ? in your own template unencoded.
Reading an encoded value you were sent
Switch to Decode, paste the percent-encoded string, and read the text. If the paste is truncated or contains a lone %, decoding fails and the page reports an invalid percent-encoded string.
Checking a round trip
Use as Input flips the direction and runs the conversion on the current output, which is a quick way to confirm that an encode-and-decode returns the text you started with.
How encoding and decoding work
Encode and Decode are two modes, chosen with the tabs at the top. In Encode mode, the input is passed to encodeURIComponent. In Decode mode, it is passed to decodeURIComponent. An empty input clears the output. The result updates as you type. Switching tabs resets the fields. Use as Input does not: it copies the output into the input, switches direction, and converts again. The character count is the length of the input, not of the encoded form.
hello world
hello%20worldhello world encodes to hello%20world. Decoding that string returns the original text. A plus sign in the input is encoded as %2B; it is not treated as a space.
https://example.com/a b?q=1
https%3A%2F%2Fexample.com%2Fa%20b%3Fq%3D1The whole string is treated as one component, so the colons, slashes, and question mark are encoded along with the space. That result is correct as a query value, but it is not a working URL. Encode the parts that need it, then assemble the URL yourself — or parse a complete URL with the URL Parser.
What this tool does not do
It does not use encodeURI, application/x-www-form-urlencoded, or the URL-safe Base64 alphabet. It does not parse a URL into parts, and it does not send your text to a server. Encoding almost never fails; decoding fails on malformed escapes. For Base64 rather than percent-encoding, use Base64 Encode / Decode.
How to use URL Encoder / Decoder
- Choose Encode to percent-encode text, or Decode to turn percent-encoding back into text. Switching tabs clears the fields.
- Paste or type in the input pane. The output updates as you type.
- Copy the result from the output pane when it looks right.
- Use as Input if you want to flip the direction and run the conversion on the current output. Use Clear to start over.
Frequently asked questions
Does this use encodeURI or encodeURIComponent?
It uses encodeURIComponent to encode and decodeURIComponent to decode. The whole input is treated as a single component, so reserved characters such as :, /, ?, #, and & are encoded too. encodeURI, which leaves those URL delimiters in place, is not used.
Why does a space become %20 instead of +?
encodeURIComponent uses percent-encoding and writes a space as %20. The + convention is from application/x-www-form-urlencoded query strings, not from this API. When you decode, %20 becomes a space; a raw + is left as a plus sign.
Can I encode a full URL and keep the slashes and question marks?
Not with this page. Encoding https://example.com/a b will also encode the colons and slashes, which is what you want for a query value or a path segment, but not for a complete URL that should still be clickable. Encode only the part that needs escaping, or use encodeURI in your own code if you must leave delimiters alone.
Why does decode fail with “Invalid percent-encoded string”?
decodeURIComponent throws on a malformed escape such as a lone %. The page shows that error and clears the output. Fix the encoding, or encode the text instead of decoding it.
Does encoding happen as I type?
Yes. There is no separate Encode button. The two tabs choose the direction, and the output updates on each change. Switching tabs clears both fields. Use as Input takes the current output, flips the direction, and runs the conversion again.
Is my text sent to a server?
No. Encoding and decoding run in your browser. Closing the tab discards what you pasted. Do not paste tokens or other secrets if you would not be comfortable with them sitting in memory on this device.
Is there a size limit?
There is no server-imposed limit, because nothing is uploaded. Short strings are instant. Very large pastes can make the tab feel slow; in that case, use a local tool.
Related tools and guides
References
- encodeURIComponent and decodeURIComponent are the APIs this page calls. They encode a component, not a complete URL.
- RFC 3986 defines percent-encoding. A space is
%20. The+space convention belongs to form bodies and some query-string styles, not to these two functions.