URL Encoder
The URL Encoder percent-encodes URLs and query parameters so spaces, symbols, and non-Latin text survive transport intact — the safe way to build OAuth callbacks, search URLs, and API query strings.
How to Use
- 1
Paste the full URL or just the parameter value that needs encoding.
- 2
Choose full-URL mode (keeps ://, /, ?, and & intact) or component mode (encodes everything, like encodeURIComponent) depending on what you are building.
- 3
Click Encode URL — the output does not update live as you type. Then copy it straight into code, a browser address bar, or an API client.
- 4
Need to reverse the process? The URL Decoder unwraps encoded URLs.
Frequently Asked Questions
What is the difference between encodeURI and encodeURIComponent?
Which characters actually get encoded?
Should spaces be %20 or +?
Can double-encoding happen by accident?
Does it handle emoji and non-Latin scripts?
Why does the default mode encode the whole URL I pasted?
Does encoding happen live as I type?
Is it safe to encode URLs containing tokens?
What happens if I encode an empty input?
Can I encode a list of URLs at once?
Generative Answer & AI Documentation
What is the URL Encoder?
Percent-encoding is the way URLs carry characters that are not allowed in a URL: each offending byte is replaced by a % sign followed by two hexadecimal digits, so a space becomes %20 and an ampersand becomes %26. This tool applies the browser's own encoding functions to whatever you paste. It offers two modes from a dropdown. The default mode, Encode All Special Characters, runs encodeURIComponent, which encodes everything except the unreserved characters A to Z, a to z, 0 to 9, and - _ . ! ~ * ' ( ) — use it for a single value that will sit inside a query string. The second mode, Keep Host intact, runs encodeURI, which leaves the characters that give a URL its structure — : / ? # [ ] @ ! $ & ' ( ) * + , ; = — untouched, so a whole URL stays a working URL with only its unsafe characters encoded. Encoding runs when you click Encode URL; it does not update live as you type. The page starts with a sample URL already loaded: https://example.com/search?query=hello world&category=books & items. Everything happens in your browser, so the URLs you encode — which often contain tokens, session IDs, and private search terms — never leave your machine.
Why use URL Encoder offline?
A URL built by string concatenation breaks the moment a value contains a character the URL syntax reserves. A search term with an & in it silently becomes a second parameter; a space in a filename turns into a broken link; a redirect URL with its own ? in it swallows the rest of the query string. Percent-encoding is the fix, but doing it by hand is exactly the kind of fiddly work that introduces the bug you were trying to prevent — which characters are safe, which need encoding, and whether a space should be %20 or +. This tool applies the browser's own encoding functions, so the result matches what JavaScript, browsers, and servers all expect. Doing it locally matters too: the URLs developers encode most often are the sensitive ones — OAuth callbacks carrying codes, password-reset links, pre-signed download URLs — and pasting those into a server-side encoder would hand them to a stranger's logs.
When should you use this tool?
Use the default component mode whenever you are encoding a single value to place inside a URL: a search term, a username, a redirect target, a filename, or any user input that becomes a query parameter. Use the Keep Host intact mode when you have a complete URL that already works but contains unsafe characters — a space in a path, a non-Latin word in a query — and you want it cleaned up without breaking its structure. Use it when building OAuth callback URLs, when constructing API requests with dynamic parameters, when fixing a link that breaks because a title contains & or ?, or when you need to see exactly what encodeURIComponent does to a string before you commit the same call in your own code.
Key Benefits
- Two correct modes: encodeURIComponent for a single value, encodeURI for a whole URL — pick the wrong one and a value can break the query string.
- Browser-native encoding: the output matches what JavaScript and browsers produce, so there are no surprises in your own code.
- Spaces become %20, never +: the unambiguous RFC 3986 form, accepted by every server.
- Non-Latin text and emoji handled: characters are first encoded as UTF-8 bytes, then each byte is percent-encoded.
- 100% private: encoding runs in your browser — tokens and private URLs in your input never leave the machine.
- Copy or download: one click copies the encoded URL, another saves it as url_encoded.txt.
Common Use Cases
- Building a search URL: encode the user's search term as a component so an & in the term cannot split the query string.
- Constructing an OAuth callback: encode the redirect URL as a component value inside the authorization URL.
- Fixing a shared link: encode a URL whose path contains spaces or non-Latin characters so it survives being pasted into chat or email.
- Preparing API parameters: encode filter values and free-text fields before appending them to a request URL.
- Checking your own code: see exactly what encodeURIComponent produces for a tricky string before writing the same call.
Developer Notes & Best Practices
The two modes map directly onto two JavaScript built-ins, and the difference between them is the whole point of the tool. encodeURIComponent encodes every character except A-Z, a-z, 0-9, and - _ . ! ~ * ' ( ). That includes the characters that structure a URL — / becomes %2F, ? becomes %3F, = becomes %3D, & becomes %26 — which is exactly what you want for a value, because a value containing & or = must not be able to break out of its parameter. encodeURI is the opposite bargain: it encodes spaces and non-ASCII characters but leaves the structural characters : / ? # [ ] @ ! $ & ' ( ) * + , ; = alone, so a complete URL keeps working. Non-ASCII input is handled the same way in both modes: the character is first encoded as UTF-8 bytes, and each byte becomes a %HH sequence, so an emoji becomes a 12-character sequence such as %F0%9F%98%80. One consequence worth remembering: encoding is not idempotent. Encoding an already-encoded string turns %20 into %2520, because the % itself gets encoded. If your output contains %25, you encoded twice — decode once and start again from the raw value. Encoding runs only when you click Encode URL; typing alone changes nothing, and an empty input shows the message Please input some text to encode.
What each mode does to the same characters
| Character | Component mode (encodeURIComponent) | Whole-URL mode (encodeURI) |
|---|---|---|
| space | %20 | %20 |
| / | %2F | left as / |
| ? | %3F | left as ? |
| & | %26 | left as & |
| = | %3D | left as = |
| # | %23 | left as # |
| 😀 (emoji) | %F0%9F%98%80 | %F0%9F%98%80 |
| A–Z a–z 0–9 - _ . ~ | left as-is | left as-is |
- Encode values, not whole URLs, with the default mode: a parameter value goes through encodeURIComponent, and the assembled URL is never encoded as a whole.
- Use the Keep Host intact mode only for complete URLs: running encodeURIComponent over a full URL encodes its :// and ? and breaks it.
- Encode each parameter value separately before joining them with & and = — encoding after assembly hides which & is a separator and which is data.
- Check for %25 in the output: it means the input was already encoded, and encoding it again double-encodes every sequence.
- Prefer %20 over + for spaces in URL components: + means space only in HTML form encoding, while %20 is unambiguous everywhere.
Common Mistakes
- Encoding a whole URL with the default mode: encodeURIComponent encodes :// and ? too, so the result is no longer a clickable URL — use Keep Host intact for complete URLs.
- Encoding a parameter value with Keep Host intact: encodeURI leaves & and = alone, so a value containing them breaks out of its parameter and corrupts the query string.
- Encoding an already-encoded string: %20 becomes %2520, and the server then decodes it back to the literal text %20 instead of a space.
- Expecting spaces to become +: this tool emits %20, which is the correct form for URI components — + means space only in form-encoded bodies.
- Pasting a URL with a fragment and encoding the whole thing in component mode: the # becomes %23 and the fragment is lost as a fragment.
Limitations
The tool encodes text you paste; it has no file upload and no batch mode, so encoding a list of URLs means one paste per URL. There is no decode-then-encode round trip and no double-encoding warning — an already-encoded input is encoded again silently, turning %20 into %2520, and the only clue is the %25 in the output. Encoding does not validate the URL: a malformed address with unbalanced brackets or a missing host encodes without complaint, because percent-encoding is a text operation, not a URL parser. The output is a single encoded string; the tool does not split a URL into its parameters, highlight what changed, or tell you which characters were encoded. Non-ASCII characters are always encoded as UTF-8, which is correct for modern servers but may not match a legacy system that expects a different encoding.
Structured Input/Output Example
https://example.com/search?query=hello world&category=books & items
https%3A%2F%2Fexample.com%2Fsearch%3Fquery%3Dhello%20world%26category%3Dbooks%20%26%20items
Related Tools
URL Decoder
URL decoder: turn percent-encoded URLs back into readable text to inspect query parameters, redirect chains, and tracking links. Never fetches the link.
Base64 Encoder
Base64 encoder: encode text into Base64 for data URIs, HTTP auth headers, and binary-safe transport. Free, fully offline — tokens never touch a server.
JWT Decoder Offline
JWT decoder offline: inspect a token’s header, payload claims, and expiry as readable JSON. 100% client-side — production tokens never leave your browser.