How to use
- Choose Encode or Decode.
- Pick the mode — Component for a single parameter value, Full URL to keep the URL structure, or Form for HTML form data where spaces become +.
- Paste your text. The result updates as you type.
- If the input is a URL, its protocol, host, path and query parameters are listed below.
Options explained
- Component
- Encodes everything except letters, digits and - _ . ~ — use it for a query parameter value or a path segment. Matches encodeURIComponent, plus ! ' ( ) * which RFC 3986 reserves.
- Full URL
- Leaves characters that give a URL its structure (: / ? # & =) alone and encodes spaces and non-ASCII characters. Matches JavaScript's encodeURI.
- Form
- application/x-www-form-urlencoded, used by HTML forms. Spaces become + instead of %20; when decoding, + is turned back into a space.
Examples
| Input | Component | Full URL | Form |
|---|---|---|---|
a b&c |
a%20b%26c |
a%20b&c |
a+b%26c |
café |
caf%C3%A9 |
caf%C3%A9 |
caf%C3%A9 |
https://x.com/?q=1 2 |
https%3A%2F%2Fx.com%2F%3Fq%3D1%202 |
https://x.com/?q=1%202 |
https%3A%2F%2Fx.com%2F%3Fq%3D1+2 |
Building a URL with parameters
When you put user input into a query string, encode each value separately:
const url = `https://example.com/search?q=${encodeURIComponent(query)}&page=2`;
Encoding the whole URL at the end would leave & and = inside the value unencoded and break the parameters.
Frequently asked questions
What is the difference between %20 and +?
Both can represent a space, but in different places. %20 works everywhere in a URL; + means a space only in the query string of form submissions. In a path, + is a literal plus sign.
Why is my text double-encoded (%2520)?
It was encoded twice — the % of %20 was itself encoded as %25. Decode it twice, and in your code make sure only one layer encodes the value.
When should I use encodeURI vs encodeURIComponent?
Use encodeURIComponent (Component mode) for each parameter value you insert into a URL. Use encodeURI (Full URL) only for a complete URL that may contain spaces or non-ASCII characters.
What does "malformed percent-encoding" mean?
A % is not followed by two hex digits, or the bytes do not form valid UTF-8. The error shows the position of the first bad sequence.
How are Chinese characters encoded in URLs?
Each character is converted to UTF-8 bytes and each byte is written as %XX, so 中 becomes %E4%B8%AD.
Privacy
This tool runs entirely in your browser. Your files and text are processed on your device and are never uploaded to our servers.