URL Encoder and Decoder
Percent-encode text for URLs or decode an encoded string, with a choice of component or full URL encoding.
Percent-encode text for URLs, or decode an encoded string back to plain text.
hello%20world%20%26%20more%3Dstuff%3FAbout the url encoder and decoder
There are two encoding functions and picking the wrong one breaks things. encodeURIComponent escapes everything unsafe including slashes and ampersands, which is right for a single query value. encodeURI leaves the URL structure intact, which is right for a whole address.
Encoding a full URL with the component function turns every slash into %2F and produces a link that no longer works.
How to use it
- 1Choose encode or decode.
- 2Pick component for a single value, full URL for a whole address.
- 3Paste the text.
- 4Copy the result.
Questions
Which function should I use?
encodeURIComponent for one query parameter value. encodeURI for an entire URL you want to keep functional.
Why did my encoded URL stop working?
You probably used component encoding on the whole URL, which escaped the slashes and colons that give it structure.
What does %20 mean?
An encoded space. In query strings a plus sign is also sometimes used for a space, which is a separate legacy convention.