URL Encoder / Decoder
Percent-encode or decode text with encodeURIComponent or encodeURI, switch on form encoding for + spaces, and break any URL into its parts with editable query parameters.
- Component vs full-URL modes
- URL parser with editable params
- Clear errors for bad % sequences
Options
Encoded output
The result appears here as you type.How it works
How to use the URL encoder
- 1
Pick a direction
Choose Encode to escape text, or Decode to turn %XX sequences back into readable characters.
- 2
Choose the function
Use encodeURIComponent for a single value (a search term, a redirect URL inside a parameter). Use encodeURI for a whole URL you want to keep working.
- 3
Set form encoding if needed
Turn it on when the value goes into a query string built like an HTML form, so spaces become + and + is read as a space when decoding.
- 4
Copy or parse
Copy the result, or open the URL Parser tab to see the protocol, host, path, query parameters and hash, edit the parameters, and copy the rebuilt URL.
What is URL encoding?
URLs may only contain a limited set of ASCII characters, and some of them, such as ?, &, = and #, have a special job. Percent-encoding (defined in RFC 3986) replaces any other character with a percent sign and the two-digit hexadecimal value of each of its UTF-8 bytes. A space becomes %20, an ampersand becomes %26, and é becomes %C3%A9.
Encoding a value before you put it into a URL stops it from being read as part of the URL structure. Without it, a search for salt & pepper would cut the query string at the ampersand.
| space | ! | # | $ | % | & | + |
|---|---|---|---|---|---|---|
| %20 | %21 | %23 | %24 | %25 | %26 | %2B |
| , | / | : | = | ? | @ |
|---|---|---|---|---|---|
| %2C | %2F | %3A | %3D | %3F | %40 |
Worked examples
| Input | Mode | Output |
|---|---|---|
| summer sale & 50% off | encodeURIComponent | summer%20sale%20%26%2050%25%20off |
| summer sale & 50% off | Form encoding | summer+sale+%26+50%25+off |
| https://example.com/a b?q=café | encodeURI | https://example.com/a%20b?q=caf%C3%A9 |
| https://example.com/?q=1 | encodeURIComponent | https%3A%2F%2Fexample.com%2F%3Fq%3D1 |
Notice that encodeURI keeps ://, ? and =, while encodeURIComponent escapes them so the whole URL can safely sit inside another URL's parameter.
Common use cases
Building query strings
Encode search terms, filters and user input before adding them to a link or API request.
Debugging tracking links
Decode UTM-tagged or redirect URLs to read the real destination and parameters.
Editing parameters
Paste a long URL into the parser, change or remove parameters, and copy the clean result.
Fixing broken links
Find the stray % or truncated UTF-8 sequence that makes a URL fail to decode.
Frequently Asked Questions
What is the difference between encodeURIComponent and encodeURI?
encodeURIComponent escapes every character except A-Z, a-z, 0-9 and - _ . ! ~ * ' ( ), so it is the right choice for a single query value or path segment. encodeURI leaves characters that have a meaning in a full URL, such as : / ? # & =, untouched, so it is used on a complete URL that only needs spaces and non-ASCII characters escaped.
Should spaces be encoded as %20 or +?
Both are valid in different places. %20 works everywhere in a URL. The + sign only means a space inside a query string that uses application/x-www-form-urlencoded, which is what HTML forms and URLSearchParams produce. Turn on the form-encoding option when you need that format.
Why do I get a malformed URI error when decoding?
Decoding fails when a percent sign is not followed by two hexadecimal digits, for example "100%", or when the bytes do not form valid UTF-8, for example a cut-off "%E2%82". The tool shows where the problem is and gives a best-effort result that decodes the valid parts and leaves the broken sequence as it is.
How are non-English characters and emoji encoded?
They are converted to UTF-8 bytes and each byte is written as %XX. For example, é becomes %C3%A9 and 😀 becomes %F0%9F%98%80.
Is my data sent to a server?
No. Encoding, decoding and URL parsing all run in your browser with built-in JavaScript functions.
Keep going
Related Tools
Hand-picked tools that pair well with this one. All free, no sign-up.
- Developers
Base64 Encoder / Decoder
Convert text, files, and images to and from Base64 with live previews and MIME detection.
- Text and file modes
- Image preview
- URL-safe option
Open tool - Developers
Slug Generator
Create SEO-friendly URL slugs from any text instantly.
- SEO optimized
- Remove numbers
- Copy to clipboard
Open tool - Developers
JWT Decoder
Decode JSON Web Token headers and payloads instantly, with readable expiry times and token status, right in your browser.
- Header & payload
- Expiry status
- Runs locally
Open tool