About URL Encoder / Decoder
Putting a string safely into a URL is unavoidable when assembling API addresses, building shareable links with parameters, or passing a search phrase into a query string. URLs allow only a limited set of ASCII characters literally, while spaces, non-Latin text, slashes, question marks and hashes all carry meaning, so naive concatenation makes the server resolve a completely different path or parameter. The encoding replaces disallowed characters with a percent sign followed by two hexadecimal digits representing the UTF-8 byte. The hard part is usually not whether to encode but which part to encode. Inside a full address the structural characters, such as the scheme colon, slashes, question mark, hash, ampersand and equals sign, must stay literal or the address breaks. Inside a single parameter value those same characters must be encoded. Tools therefore offer two modes, a conservative one for a whole URL and a full one for a single value, and picking the wrong one is the most common source of bugs. Practical notes: When the parameter value is itself a URL, such as a redirect or callback target, it must be fully encoded before being appended. The nesting is where mistakes cluster, so decode the result immediately and verify a round trip matches the original. Watch how spaces are handled: in a query string a space may be a plus sign or percent-twenty, and frameworks differ, so standardize on percent-twenty across languages. Encode non-Latin text as UTF-8 rather than legacy multibyte encodings, since the same character produces entirely different bytes under each. Limits: Encoding irreversibly discards part of the information about what the original text was. A string that already contained percent-twenty decodes to a space, and re-encoding may not restore the original form, so keep that ambiguity in mind when verifying with a decode. Certain characters also differ in legality between path and query, for instance a plus is a literal plus in a path but a space in a query string, so process segment by segment rather than encoding the whole thing at once. One more often overlooked point: encoding answers whether a value can be placed in a URL, not whether the server can be trusted, so validate user input against an allowlist before concatenating it. Data and privacy: what gets encoded may be a signed callback URL, a share link carrying a user identifier, or an internal service address. This tool encodes and decodes in the browser, issues no requests and records nothing. For signed links, prefer working offline or with the Network panel visible. Treating encoding as translation rather than protection avoids a great deal of misuse: the result is fully reversible by anyone who receives it, so it neither protects privacy nor substitutes for a signature. With nested parameters, such as passing an address that already has parameters as a parameter of another address, the common approach encodes the inner value once and the outer context again. You must record how many layers were applied, because one layer short lets the outer parser swallow the inner parameters, a failure that presents as "some parameters mysteriously vanished".
How It Works Internally
Encoding replaces characters that may not appear literally with a percent sign plus the hex of their UTF-8 bytes. The question is never whether to encode but which span: structural characters in a full address (colon, slash, question mark, ampersand) must stay literal or the address breaks, while inside a single parameter value those same characters must be encoded. A space may also be a plus in a query string, so standardise on percent-twenty across systems.
a&b=c dWhole URL: a&b=c%20d | Parameter value: a%26b%3Dc%20dMeasured on This Page
| Same as encodeURIComponent | Space to %20, Chinese to UTF-8 byte escapes, emoji to four bytes (%F0%9F%98%80) |
|---|---|
| Reserved set | ~ - _ . ! * ' ( ) stay literal — encodeURIComponent's set, not encodeURI's |
| Structural chars | a/b?c#d becomes a%2Fb%3Fc%23d, so the output is safe inside a query parameter value |
| Decoding | %E4%B8%AD%E6%96%87 to 中文, a%20b to a b, 100%25 to 100% all correct |
| Invalid input | %ZZ reports invalid URL encoding instead of emitting partial output |
This follows encodeURIComponent, not encodeURI: encodeURI keeps / ? # & = intact so a whole URL survives encoding, while a query parameter value must use encodeURIComponent or its & and = will be read as separators. This page does the latter, which is why a/b becomes a%2Fb — correct, but do not use it on a whole URL. Spaces also become %20 here, whereas form posts under application/x-www-form-urlencoded use +; the two are not interchangeable.
How to Use
- Open "URL Encoder / Decoder"
- Choose encode or decode
- Enter a link, a parameter or an encoded string
- The result refreshes as you type
- Click the copy icon to take the percent-encoded text
Use Cases
- Build query parameters — User input (non-ASCII, special chars) must be encoded before being appended to a URL, otherwise the backend will mis-parse it.
- Debug GET requests — URLs copied from browser DevTools Network tab are encoded — use this tool to read the original text.
- Handle special filenames — When uploading filenames with spaces or non-ASCII chars, HTTP paths require encoding for correct routing.
- OAuth callback URLs — The redirect_uri parameter is itself a URL — when nested as a query parameter it needs double-encoding.
- Mailto links — Pre-filled subject and body in mailto: links must be URL-encoded for special characters.
- Form data encoding — Encode application/x-www-form-urlencoded form payloads so that special characters in field values are transmitted correctly.
- Cookie value encoding — Percent-encode special characters in cookie values to comply with HTTP cookie specification requirements.
FAQ
How is URL encoding different from HTML entity encoding?
Entirely different. URL encoding uses %XX to represent bytes (space → %20). HTML entities use & + name (< → <). The former is for URLs, the latter for HTML body text.
Why is space sometimes + and sometimes %20?
application/x-www-form-urlencoded (form submission) uses + for space; URL paths and most modern contexts use %20. This tool defaults to %20.
Which characters need encoding?
RFC 3986 "unreserved" characters (A-Z, a-z, 0-9, - _ . ~) never need encoding. Others should be?#&= depend on position — encoded inside query values, raw as delimiters.
What happens if I encode twice?
You get %25XX (an encoded percent sign) — and a single decode only unwraps one layer. This is the most common backend bug; encode exactly once.
Can I put non-ASCII characters directly in a URL?
Modern address bars display them, but under the hood they're encoded as UTF-8 bytes + %XX. When constructing URLs in code, encode manually.
What's the difference between encodeURI and encodeURIComponent?
encodeURI leaves URI delimiters such as : / ? # & = unescaped, making it suitable for encoding a whole URL; encodeURIComponent escapes even those delimiters, making it correct for encoding query parameter values. The most common mistake is swapping them: using encodeURI on a value lets embedded & or = act as separators so the backend splits fields wrongly and returns 400, while using encodeURIComponent on a whole URL mangles the scheme and host. Build params by encoding each key/value with encodeURIComponent and joining with & — that's the safest pattern.
Why does my backend see garbled params or return 400?
Two usual causes. One is a charset mismatch: the frontend encodes as UTF-8 but the backend decodes as GBK or ISO-8859-1, turning non-ASCII text into mojibake. The other is double-nested URLs that were only encoded one layer or not at all, so & and = inside values like redirect_uri are taken as new parameters. To debug, copy the real request URL sent from the browser Network panel and decode it here to read the original; then confirm both sides use UTF-8; and double-encode any value that is itself a URL. Restoring and comparing segment by segment usually pinpoints the failing layer immediately.