URL Encoder
Percent-encode and decode query strings and paths
Percent-encoding is how a URL carries characters that would otherwise change its meaning. A space becomes %20, an ampersand inside a value becomes %26, and every byte outside the unreserved set — letters, digits, hyphen, period, underscore and tilde — is written as a percent sign followed by two hex digits. RFC 3986 is the specification that defines which characters are reserved and where.
The subtlety that trips people up is that the correct encoding depends on where in the URL the value sits. A slash is perfectly legal in a path but must be escaped inside a query parameter; a question mark separates the query but is ordinary data once you are inside it. This tool encodes and decodes both ways so you can check what a server will actually receive.
How to use it
- Paste the value or the whole URLYou can work on a single parameter value or on a complete address; the output updates as you type.
- Choose component or full-URI encodingComponent encoding escapes reserved characters such as slash, question mark and ampersand, which is what you want for a value going into a query string. Full-URI encoding leaves the structural characters alone so an assembled address stays valid.
- Decode to check the other directionPaste an encoded string to see what it decodes to. A malformed sequence — a stray percent sign, or one followed by something that is not two hex digits — is reported rather than silently dropped.
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI assumes you handed it a complete URL and leaves the characters that give a URL its structure intact: colon, slash, question mark, hash, ampersand and equals. encodeURIComponent assumes you handed it a single value and escapes those characters too. Use the component form for anything going into a query parameter, and the full form only when encoding an address you assembled yourself.
Why is a space sometimes %20 and sometimes a plus sign?
Both appear in the wild. Percent-20 is the correct percent-encoding and works anywhere in a URL. The plus sign comes from the older application/x-www-form-urlencoded format used by HTML form submissions, where it means a space only inside the query string. A plus in a path segment is a literal plus, which is why encoding a value with the wrong rules quietly corrupts it.
Do I need to encode non-English characters?
Yes. Characters outside ASCII are first converted to UTF-8 bytes, then each byte is percent-encoded, so an accented e becomes %C3%A9 — two escapes for one character. Modern browsers display the decoded form in the address bar, which can make an already-encoded URL look as though it does not need encoding.
Can I encode the same string twice?
You can, and it is a common bug. Encoding twice turns each percent sign into %25, so %20 becomes %2520 and the receiving server decodes it once to %20 rather than to a space. If your values arrive with stray percent-25 sequences, something in the chain is encoding an already-encoded string.
Which characters are never escaped?
The unreserved set from RFC 3986: uppercase and lowercase letters, digits, hyphen, period, underscore and tilde. Those are safe everywhere in a URL and encoders leave them as they are. Everything else is either reserved, meaning it has a structural role, or must be escaped.