URL Encoder
Turn text or a URL into its percent-encoded form. UTF-8, reserved characters and query parameters are handled for you — everything runs in your browser.
Converts locally as you type — 250 ms debounce. Live mode can be turned off in Advanced options.
Decoded text appears here.
Advanced options
What URL Encoding Does
URL encoding replaces characters that a URL cannot carry with a % sign and two hexadecimal digits. A space becomes %20, a literal plus becomes %2B, and a Chinese character such as 中 becomes %E4%B8%AD because it is stored as three UTF-8 bytes. The result is pure ASCII, so it survives every hop between a browser, a proxy and a server. To turn escapes back into readable text, use the URL Decoder.
The tricky part is not the escaping itself but which characters to escape. A slash separates path segments; inside a query value it is data and must travel as %2F. Get that distinction wrong and the URL quietly changes meaning.
How to Encode a URL
A worked example with a query string that contains a space.
Plain input
https://example.com/search?q=hello world&page=2
Encoded output
https://example.com/search?q=hello%20world&page=2
Paste the text or URL
Drop the raw value into the left pane. If it is a full URL, keep it whole — the encoder recognises the scheme, path and query string and encodes only what needs it.
Pick the right method
Component mode is for a single value and escapes reserved characters too. Whole URL mode keeps /, ?, & and = literal. “Preserve reserved characters” applies RFC 3986 to a component-mode string.
Copy the encoded value
Copy result puts the escaped string on your clipboard and Download TXT saves it. The counter under each pane shows characters and UTF-8 bytes, which is handy when a value gets close to a length limit.
Which Characters Get Encoded
The two JavaScript encoders disagree about reserved characters. This is the whole table.
| Character | encodeURI | encodeURIComponent | Why |
|---|---|---|---|
| (space) | %20 | %20 | Not allowed raw in a URL |
| / | / | %2F | Path separator, data inside a value |
| ? | ? | %3F | Starts the query string |
| # | # | %23 | Starts the fragment |
| & | & | %26 | Separates query parameters |
| = | = | %3D | Separates name from value |
| + | + | %2B | Means a space in form data |
| : | : | %3A | Separates scheme from host |
| [ ] | %5B %5D | %5B %5D | Reserved in RFC 3986, escaped by both |
| % | %25 | %25 | Introduces an escape, so it needs one |
| * ' ( ) ! ~ - _ . | unchanged | unchanged | Unreserved or explicitly allowed |
| A-Z a-z 0-9 | unchanged | unchanged | Always safe |
| é | %C3%A9 | %C3%A9 | UTF-8 bytes C3 A9 |
| 中 | %E4%B8%AD | %E4%B8%AD | UTF-8 bytes E4 B8 AD |
| 😀 | %F0%9F%98%80 | %F0%9F%98%80 | UTF-8 bytes F0 9F 98 80 |
encodeURI vs encodeURIComponent
Same idea, different set of characters considered safe. Choosing the wrong one is the usual cause of broken query strings.
encodeURI — for a complete URL
Use it when the string already is a URL and you only need to fix characters that are illegal in a URL, such as a space or a Chinese character in the path. It keeps ; , / ? : @ & = + $ # literal, so the structure is untouched.
encodeURI("a b/c?d=e") → a%20b/c?d=e
encodeURIComponent — for a value
Use it for anything that is data: one query parameter, one path segment, one form field. It escapes reserved characters so a value can contain /, & or ? without breaking the URL apart.
encodeURIComponent("a b/c?d=e") → a%20b%2Fc%3Fd%3De
Rules of thumb
- Encoding a value to put inside
?key=? Use Component. - Encoding a whole URL that already has its structure? Use Whole URL or turn on “Preserve reserved characters”.
- Encoding a value that can contain
+? Use Component, which produces%2B;encodeURIleaves the plus alone and a server will read it as a space. - Encoding several parameters at once? Turn on “Handle multiple parameters” so
&and=stay as separators.
When You Need URL Encoding
Building API requests
Search terms, filters and cursor tokens go into the query string as encoded values so a stray & in the data cannot start a new parameter.
SEO and analytics tags
UTM values with spaces, slashes or non-Latin text must be encoded, otherwise campaign parameters get split and the reports show truncated names.
Redirect and callback URLs
When a URL is itself a parameter, it has to be encoded so its own ? & and # travel as data. Nested redirects are the most common source of double encoding.
Frequently Asked Questions
The details that decide whether an encoded link still works.
Which characters does a URL encoder leave alone?
encodeURIComponent leaves A-Z, a-z, 0-9 and the characters - _ . ! ~ * ' ( ) untouched; everything else becomes %XX. encodeURI also leaves the reserved characters ; , / ? : @ & = + $ # alone so the URL structure survives. In both cases a space becomes %20 and non-ASCII text is encoded as UTF-8 bytes.
Should I encode a whole URL or only its values?
Only the parts that are data. Encoding a whole URL with encodeURIComponent turns the :// and ? into escapes and the result stops being a URL. This tool's “Preserve reserved characters” option encodes only the runs that need it, and “Handle multiple parameters” encodes each key and value separately while keeping & and = as separators.
Why does a space become %20 in some places and + in others?
Both mean a space in form data. %20 is the percent-encoding of the space byte and is safe in every part of a URL; + is only a space inside application/x-www-form-urlencoded data, which is what query strings and form posts use. In a path segment or a fragment, + is a literal plus, so use %20 there.
Why is + not escaped by encodeURI?
Because + is a reserved character, encodeURI leaves it alone — it assumes you are writing URL syntax. In a query string that is dangerous, because a literal plus is read as a space by the server. Use encodeURIComponent, or this tool's parameter mode, for values that can contain +: it produces %2B.
Why did [ and ] get encoded even though they are reserved?
encodeURI follows the older ECMAScript character set, which predates RFC 3986 listing [ and ] as reserved characters for IPv6 hosts. Both encodeURI and encodeURIComponent escape them as %5B and %5D. If you need them literal, use the “Preserve reserved characters” option, which follows RFC 3986.
Can I encode text that is already encoded?
You can, but it will be encoded twice: %20 becomes %2520 because the % itself is escaped as %25. That is sometimes intended, when an encoded URL is passed as a parameter value, and usually a bug. If the output contains %25 followed by two hex digits, the input was already encoded.
Your Text Stays in Your Browser
Encoding runs as plain JavaScript in this tab. Nothing is uploaded, no third-party API is called and no copy of your input is stored in localStorage or in a cookie. Your light or dark theme is the only preference kept on your device.